Chromium Code Reviews| 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..c299bb604a7a0dd9a7ebe231c9a2cd581c31b1a2 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,40 @@ 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) { |
|
Devlin
2016/05/31 22:45:30
This almost seems like a test that would be good t
nasko
2016/06/01 21:22:19
There is already enough coverage for the regular c
|
| + ASSERT_TRUE(LoadExtensionAndWait("event_page_with_web_iframe")); |
| + |
| + // Lazy Background Page doesn't exist anymore. |
| + EXPECT_FALSE(IsBackgroundPageAlive(last_loaded_extension_id())); |
| +} |
| + |
| } // namespace extensions |