chromium/extensions/common/api/scripts_internal/script_serialization_unittest.cc

// Copyright 2023 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "extensions/common/api/scripts_internal/script_serialization.h"

#include <string_view>

#include "base/test/values_test_util.h"
#include "extensions/common/api/scripts_internal.h"
#include "extensions/common/extension_builder.h"
#include "extensions/common/manifest_constants.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace extensions::script_serialization {

SerializedUserScript;

namespace {

// Returns the SerializedUserScript object from the given `json` blob.
// Note: this will crash if `json` doesn't parse to a valid script.
SerializedUserScript SerializedScriptFromJson(std::string_view json) {}

}  // namespace

// Tests parsing a minimally-specified serialized user script. This ensures all
// defaults are properly set.
TEST(ScriptSerializationUnitTest, ParseMinimalScript) {}

// Tests parsing a maximally-specified serialized user script. This ensures each
// field is properly deserialized and curried to the outcoming UserScript.
TEST(ScriptSerializationUnitTest, ParseMaximalScript) {}

// Tests serializing a UserScript object to a SerializedUserScript.
TEST(ScriptSerializationUnitTest, SerializeUserScript) {}

// Tests that scripts cannot specify `"match_origin_as_fallback": true` if
// they include match patterns with paths.
TEST(ScriptSerializationUnitTest, DisallowMatchOriginAsFallbackWithPaths) {}

}  // namespace extensions::script_serialization