chromium/extensions/common/manifest_handlers/extension_action_handler_unittest.cc

// Copyright 2018 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/manifest_handlers/extension_action_handler.h"

#include "base/files/file_path.h"
#include "base/path_service.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/values.h"
#include "components/version_info/channel.h"
#include "extensions/common/api/extension_action/action_info.h"
#include "extensions/common/api/extension_action/action_info_test_util.h"
#include "extensions/common/constants.h"
#include "extensions/common/error_utils.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_paths.h"
#include "extensions/common/features/feature_channel.h"
#include "extensions/common/file_util.h"
#include "extensions/common/icons/extension_icon_set.h"
#include "extensions/common/manifest.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/common/manifest_test.h"
#include "extensions/common/warnings_test_util.h"
#include "extensions/test/test_extension_dir.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace extensions {

namespace {

base::FilePath GetTestDataDir() {}

}  // namespace

// Tests that an unpacked extension with an invisible browser action
// default icon fails as expected.
TEST(ExtensionActionHandlerTest, LoadInvisibleBrowserActionIconUnpacked) {}

// Tests that an unpacked extension with an invisible page action
// default icon fails as expected.
TEST(ExtensionActionHandlerTest, LoadInvisiblePageActionIconUnpacked) {}

// Tests that an action is always validated in manifest V3.
TEST(ExtensionActionHandlerTest, InvalidActionIcon_ManifestV3) {}

ExtensionActionHandlerManifestTest;

TEST_F(ExtensionActionHandlerManifestTest, NoActionSpecified_ManifestV2) {}

TEST_F(ExtensionActionHandlerManifestTest, NoActionSpecified_ManifestV3) {}

// A parameterized test suite to test each different extension action key
// ("page_action", "browser_action", "action").
class ExtensionActionManifestTest
    : public ManifestTest,
      public testing::WithParamInterface<ActionInfo::Type> {};

// Tests that parsing an action succeeds and properly populates the given
// fields.
TEST_P(ExtensionActionManifestTest, Basic) {}

// Tests that specifying an empty action (e.g., "action": {}) works correctly,
// with empty defaults.
TEST_P(ExtensionActionManifestTest, TestEmptyAction) {}

// Tests specifying an icon dictionary (with different pixel sizes) in the
// action.
TEST_P(ExtensionActionManifestTest, ValidIconDictionary) {}

// Tests some invalid cases.
TEST_P(ExtensionActionManifestTest, Invalid) {}

// Tests success when default_popup is valid.
TEST_P(ExtensionActionManifestTest, ValidDefaultPopup) {}

// Tests success when default_popup is empty.
TEST_P(ExtensionActionManifestTest, EmptyDefaultPopup) {}

// Tests warning when the default_popup seems to be for another extension.
TEST_P(ExtensionActionManifestTest, OtherExtensionSpecifiedDefaultPopup) {}

// Tests warning when the default_popup doesn't exist on file system.
TEST_P(ExtensionActionManifestTest, NonexistentDefaultPopup) {}

// Test the handling of the default_state key.
TEST_P(ExtensionActionManifestTest, DefaultState) {}

INSTANTIATE_TEST_SUITE_P();

}  // namespace extensions