Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1943)

Unified Diff: chrome/browser/extensions/lazy_background_page_apitest.cc

Issue 2028873002: Fix event page process cleanup when running in --isolate-extensions mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address review comments. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/lazy_background_page/event_page_with_web_iframe/event_page.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/lazy_background_page/event_page_with_web_iframe/event_page.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698