#include <stddef.h>
#include <stdint.h>
#include <memory>
#include <utility>
#include "base/base64.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/files/file_path.h"
#include "base/functional/bind.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
#include "base/path_service.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "base/synchronization/waitable_event.h"
#include "base/values.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/api/messaging/incognito_connectability.h"
#include "chrome/browser/extensions/browsertest_util.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_util.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ssl/https_upgrades_util.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/test/base/ui_test_utils.h"
#include "components/crx_file/id_util.h"
#include "components/embedder_support/switches.h"
#include "components/infobars/content/content_infobar_manager.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/service_worker_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_features.h"
#include "content/public/test/back_forward_cache_util.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/browsertest_util.h"
#include "extensions/browser/event_router.h"
#include "extensions/browser/extension_host_registry.h"
#include "extensions/browser/extension_prefs.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/extension_system.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/process_manager.h"
#include "extensions/browser/test_extension_registry_observer.h"
#include "extensions/common/api/runtime.h"
#include "extensions/common/extension_builder.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 "services/network/public/cpp/features.h"
#include "third_party/blink/public/common/features.h"
#include "url/gurl.h"
namespace extensions {
namespace {
class MessageSender : public ExtensionHostRegistry::Observer { … };
class MessagingApiTest : public ExtensionApiTest { … };
class MessagingApiWithoutDisconnectExtensionMessagePortWhenPageEntersBFCacheTest
: public MessagingApiTest { … };
class MessagingApiWithoutBackForwardCacheTest : public MessagingApiTest { … };
IN_PROC_BROWSER_TEST_F(MessagingApiTest, Messaging) { … }
IN_PROC_BROWSER_TEST_F(
MessagingApiWithoutDisconnectExtensionMessagePortWhenPageEntersBFCacheTest,
Messaging) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiWithoutBackForwardCacheTest, Messaging) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiTest, MessagingCrash) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiTest, SendMessageDisconnect) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiTest, MessagingExternal) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiTest, MessagingNoBackground) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiTest, MessagingEventURL) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiTest, MessagingBackgroundOnly) { … }
class ExternallyConnectableMessagingTest : public MessagingApiTest { … };
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest, NotInstalled) { … }
#if !BUILDFLAG(IS_WIN)
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
WebConnectableAndNotConnectable) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
SendMessagePromiseSignatureExposed) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
DISABLED_BackgroundPageClosesOnMessageReceipt) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
WebConnectableWithoutTlsChannelId) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
WebConnectableWithTlsChannelIdWithNonMatchingSite) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
WebConnectableWithTlsChannelIdWithEmptyTlsChannelId) { … }
IN_PROC_BROWSER_TEST_F(
ExternallyConnectableMessagingTest,
DISABLED_WebConnectableWithEmptyTlsChannelIdAndClosedBackgroundPage) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
EnablingAndDisabling) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
FromIncognitoDenyApp) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
FromIncognitoDenyExtensionAndApp) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
FromIncognitoNoEventHandlerInApp) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
FromIncognitoAllowApp) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
DISABLED_FromIncognitoPromptApp) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest, IllegalArguments) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
FromIncognitoAllowExtension) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
FromIframeWithPermission) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
FromIframeWithoutPermission) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest, FromPopup) { … }
class ExternallyConnectableMessagingTestNoChannelID
: public ExternallyConnectableMessagingTest { … };
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTestNoChannelID,
TlsChannelIdEmptyWhenDisabled) { … }
IN_PROC_BROWSER_TEST_F(
ExternallyConnectableMessagingTest,
DISABLED_WebConnectableWithNonEmptyTlsChannelIdAndClosedBackgroundPage) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiTest, MessagingUserGesture) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiTest, UserGestureFromContentScript) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiTest, UserGestureFromExtensionPage) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiTest,
RestrictedActivationTriggerBetweenExtensions) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest, HostedAppOnWebsite) { … }
IN_PROC_BROWSER_TEST_F(ExternallyConnectableMessagingTest,
InvalidExtensionIDFromHostedApp) { … }
#endif
IN_PROC_BROWSER_TEST_F(MessagingApiTest, MessagingOnPagehide) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiTest, LargeMessages) { … }
IN_PROC_BROWSER_TEST_F(MessagingApiTest, MessageChannelName) { … }
class ServiceWorkerMessagingApiTest : public MessagingApiTest { … };
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingApiTest,
DISABLED_InflightCountAfterSendMessage) { … }
class MessagingApiFencedFrameTest : public MessagingApiTest { … };
IN_PROC_BROWSER_TEST_F(MessagingApiFencedFrameTest, Load) { … }
}
}