#include <map>
#include <memory>
#include <string>
#include "base/memory/raw_ptr.h"
#include "base/run_loop.h"
#include "base/scoped_observation.h"
#include "base/strings/strcat.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/test/scoped_feature_list.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/extension_action/extension_action_api.h"
#include "chrome/browser/extensions/api/extension_action/test_extension_action_api_observer.h"
#include "chrome/browser/extensions/api/extension_action/test_icon_image_observer.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/extensions/extension_action_test_helper.h"
#include "chrome/browser/ui/tabs/tab_enums.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/toolbar/toolbar_actions_model.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/sessions/content/session_tab_helper.h"
#include "components/version_info/channel.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/background_script_executor.h"
#include "extensions/browser/extension_action.h"
#include "extensions/browser/extension_action_manager.h"
#include "extensions/browser/extension_icon_image.h"
#include "extensions/browser/process_manager.h"
#include "extensions/browser/script_executor.h"
#include "extensions/browser/service_worker/service_worker_test_utils.h"
#include "extensions/browser/state_store.h"
#include "extensions/common/api/extension_action/action_info.h"
#include "extensions/common/api/extension_action/action_info_test_util.h"
#include "extensions/common/extension.h"
#include "extensions/common/extension_features.h"
#include "extensions/common/extension_id.h"
#include "extensions/common/manifest_constants.h"
#include "extensions/test/extension_test_message_listener.h"
#include "extensions/test/result_catcher.h"
#include "extensions/test/test_extension_dir.h"
#include "net/dns/mock_host_resolver.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "ui/base/window_open_disposition.h"
#include "ui/gfx/color_utils.h"
namespace extensions {
namespace {
constexpr char kSetIconBackgroundJsTemplate[] = …;
constexpr char kPageHtmlTemplate[] = …;
void RunTestAndWaitForSuccess(content::WebContents* web_contents,
const std::string& script) { … }
class TestStateStoreObserver : public StateStore::TestObserver { … };
class ActionTestHelper { … };
void FlushStateStore(Profile* profile) { … }
}
class ExtensionActionAPITest : public ExtensionApiTest { … };
BrowserActionAPITest;
PageActionAPITest;
class MultiActionAPITest
: public ExtensionActionAPITest,
public testing::WithParamInterface<ActionInfo::Type> { … };
class MultiActionAPICanvasTest : public MultiActionAPITest { … };
IN_PROC_BROWSER_TEST_F(BrowserActionAPITest, TestNoUnnecessaryIO) { … }
IN_PROC_BROWSER_TEST_P(MultiActionAPITest,
ValuesAreClearedOnNavigationAndTabRemoval) { … }
IN_PROC_BROWSER_TEST_P(MultiActionAPITest, TitleLocalization) { … }
IN_PROC_BROWSER_TEST_P(MultiActionAPITest, OnClickedDispatching) { … }
IN_PROC_BROWSER_TEST_P(MultiActionAPITest, PopupCreation) { … }
#if BUILDFLAG(IS_LINUX)
#define MAYBE_SessionStorageDoesNotPersistBetweenOpenings …
#else
#define MAYBE_SessionStorageDoesNotPersistBetweenOpenings …
#endif
IN_PROC_BROWSER_TEST_P(MultiActionAPITest,
MAYBE_SessionStorageDoesNotPersistBetweenOpenings) { … }
ActionAndBrowserActionAPITest;
IN_PROC_BROWSER_TEST_P(ActionAndBrowserActionAPITest, PRE_ValuesArePersisted) { … }
IN_PROC_BROWSER_TEST_P(ActionAndBrowserActionAPITest, ValuesArePersisted) { … }
IN_PROC_BROWSER_TEST_P(MultiActionAPICanvasTest, DISABLED_DynamicSetIcon) { … }
IN_PROC_BROWSER_TEST_P(MultiActionAPITest, SetIconWithJavascriptHooks) { … }
IN_PROC_BROWSER_TEST_P(MultiActionAPITest, SetIconWithSelfDefined) { … }
IN_PROC_BROWSER_TEST_P(MultiActionAPITest, SetIconInTabWithInvalidPath) { … }
IN_PROC_BROWSER_TEST_F(ExtensionActionAPITest, SetIconInWorkerWithInvalidPath) { … }
IN_PROC_BROWSER_TEST_P(MultiActionAPITest, SetPopupWithInvalidPath) { … }
IN_PROC_BROWSER_TEST_P(MultiActionAPITest, GettersAndSetters) { … }
IN_PROC_BROWSER_TEST_P(MultiActionAPITest, EnableAndDisable) { … }
IN_PROC_BROWSER_TEST_F(ExtensionActionAPITest, IsEnabled) { … }
IN_PROC_BROWSER_TEST_F(ExtensionActionAPITest, IsEnabledIgnoreDeclarative) { … }
ActionAPITest;
IN_PROC_BROWSER_TEST_F(ActionAPITest, TestGetUserSettings) { … }
IN_PROC_BROWSER_TEST_F(ActionAPITest, OnUserSettingsChanged) { … }
IN_PROC_BROWSER_TEST_F(ActionAPITest, TestBadgeTextColorErrors) { … }
IN_PROC_BROWSER_TEST_P(ActionAndBrowserActionAPITest,
TestSetBadgeTextGlobalAndTab) { … }
class ExtensionActionWithOpenPopupFeatureDisabledTest
: public ExtensionActionAPITest { … };
IN_PROC_BROWSER_TEST_F(ExtensionActionWithOpenPopupFeatureDisabledTest,
OpenPopupAvailabilityOnStableChannel) { … }
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
INSTANTIATE_TEST_SUITE_P(…);
}