#include "chrome/browser/extensions/api/messaging/native_messaging_test_util.h"
#include "chrome/browser/extensions/browsertest_util.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/service_worker_context.h"
#include "content/public/test/browser_test.h"
#include "content/public/test/service_worker_test_helpers.h"
#include "extensions/browser/api/messaging/message_service.h"
#include "extensions/browser/browsertest_util.h"
#include "extensions/browser/extension_util.h"
#include "extensions/browser/service_worker/service_worker_test_utils.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"
namespace extensions {
namespace {
base::FilePath WriteExtensionWithMessagePortToDir(TestExtensionDir* test_dir) { … }
base::FilePath WriteServiceWorkerExtensionToDir(TestExtensionDir* test_dir) { … }
}
class ServiceWorkerMessagingTest : public ExtensionApiTest { … };
class ServiceWorkerMessagingTestWithActivityLog
: public ServiceWorkerMessagingTest { … };
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest, TabToWorkerOneWay) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest, TabToWorker) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest,
TabToWorker_StopWorkerDisconnects) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest,
WorkerShutsDownWhileNativeMessagePortIsOpen) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest, WorkerToTab) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest,
TabsSendMessageWithoutCallback) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest,
TabToWorker_ConnectAndDisconnect) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest,
TabToWorker_ConnectAndPostMessage) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest, ExternalMessageToWorker) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest, ConnectExternalToWorker) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest,
UnrelatedPortsArentAffectedByServiceWorker) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTestWithActivityLog, ActivityLog) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest, LongLivedChannelNoMessage) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest, OneTimeChannel) { … }
IN_PROC_BROWSER_TEST_F(ServiceWorkerMessagingTest,
LongLivedChannelPostMessage) { … }
}