Index: chrome/browser/extensions/lazy_background_page_apitest.cc |
diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc |
index a14bd040585e6607e7b7a2040dbbb2d4545a8479..9a8deb52d535beab58aae68fdcb1bcd589f55550 100644 |
--- a/chrome/browser/extensions/lazy_background_page_apitest.cc |
+++ b/chrome/browser/extensions/lazy_background_page_apitest.cc |
@@ -37,6 +37,7 @@ |
#include "extensions/browser/extension_registry_observer.h" |
#include "extensions/browser/process_manager.h" |
#include "extensions/common/extension.h" |
+#include "extensions/common/switches.h" |
#include "extensions/test/extension_test_message_listener.h" |
#include "extensions/test/result_catcher.h" |
#include "net/dns/mock_host_resolver.h" |
@@ -104,8 +105,8 @@ class LazyBackgroundPageApiTest : public ExtensionApiTest { |
ExtensionApiTest::SetUpCommandLine(command_line); |
// Disable background network activity as it can suddenly bring the Lazy |
// Background Page alive. |
- command_line->AppendSwitch(switches::kDisableBackgroundNetworking); |
- command_line->AppendSwitch(switches::kNoProxyServer); |
+ command_line->AppendSwitch(::switches::kDisableBackgroundNetworking); |
+ command_line->AppendSwitch(::switches::kNoProxyServer); |
} |
// Loads the extension, which temporarily starts the lazy background page |
@@ -659,4 +660,39 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, OnSuspendUseStorageApi) { |
// TODO: background page with timer. |
// TODO: background page that interacts with popup. |
+// Test class to allow test cases to run in --isolate-extensions mode. |
+class LazyBackgroundPageIsolatedExtensionsApiTest |
+ : public LazyBackgroundPageApiTest { |
+ public: |
+ LazyBackgroundPageIsolatedExtensionsApiTest() {} |
+ ~LazyBackgroundPageIsolatedExtensionsApiTest() override {} |
+ |
+ void SetUpInProcessBrowserTestFixture() override { |
+ LazyBackgroundPageApiTest::SetUpInProcessBrowserTestFixture(); |
+ |
+ // This is needed to allow example.com to actually resolve and load in |
+ // tests. |
+ host_resolver()->AddRule("*", "127.0.0.1"); |
+ } |
+ |
+ void SetUpCommandLine(base::CommandLine* command_line) override { |
+ LazyBackgroundPageApiTest::SetUpCommandLine(command_line); |
+ command_line->AppendSwitch(switches::kIsolateExtensions); |
+ } |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(LazyBackgroundPageIsolatedExtensionsApiTest); |
+}; |
+ |
+// Ensure that the events page of an extension is properly torn down and the |
+// process does not linger around when running in --isolate-extensions mode. |
+// See https://crbug.com/612668. |
+IN_PROC_BROWSER_TEST_F(LazyBackgroundPageIsolatedExtensionsApiTest, |
+ EventProcessCleanup) { |
+ ASSERT_TRUE(LoadExtensionAndWait("event_page_with_web_iframe")); |
+ |
+ // Lazy Background Page doesn't exist anymore. |
+ EXPECT_FALSE(IsBackgroundPageAlive(last_loaded_extension_id())); |
+} |
+ |
} // namespace extensions |