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

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

Issue 1414783002: Don't keep the lazy background page alive after a view with a Pepper plugin is closed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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/chrome_tests.gypi » ('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 02434b805888867f68f749af3f8912b5374d3008..ce37ca10518adf172377d2e21f61aa6728752a85 100644
--- a/chrome/browser/extensions/lazy_background_page_apitest.cc
+++ b/chrome/browser/extensions/lazy_background_page_apitest.cc
@@ -310,7 +310,8 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, WaitForRequest) {
// Tests that the lazy background page stays alive while a NaCl module exists in
// its DOM.
#if !defined(DISABLE_NACL) && !defined(DISABLE_NACL_BROWSERTESTS)
-IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, NaCl) {
+
+IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, NaClInBackgroundPage) {
{
base::FilePath extdir;
ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, &extdir));
@@ -341,6 +342,38 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, NaCl) {
// The Lazy Background Page has been shut down.
EXPECT_FALSE(IsBackgroundPageAlive(last_loaded_extension_id()));
}
+
+// Tests that the lazy background page shuts down when all visible views with
+// NaCl modules are closed.
+IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, NaClInView) {
+ // The extension is loaded and should've opened a new tab to an extension
+ // page, and the Lazy Background Page stays alive.
+ {
+ base::FilePath extdir;
+ ASSERT_TRUE(PathService::Get(chrome::DIR_GEN_TEST_DATA, &extdir));
+ extdir = extdir.AppendASCII("ppapi/tests/extensions/popup/newlib");
+ ResultCatcher catcher;
+ const Extension* extension = LoadExtension(extdir);
+ ASSERT_TRUE(extension);
+ EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
+ EXPECT_EQ(
+ extension->GetResourceURL("popup.html").spec(),
+ browser()->tab_strip_model()->GetActiveWebContents()->GetURL().spec());
+ EXPECT_TRUE(IsBackgroundPageAlive(last_loaded_extension_id()));
+ }
+
+ // Close the new tab.
+ {
+ LazyBackgroundObserver page_complete;
+ browser()->tab_strip_model()->CloseWebContentsAt(
+ browser()->tab_strip_model()->active_index(),
+ TabStripModel::CLOSE_NONE);
+ page_complete.WaitUntilClosed();
+ }
+
+ // The Lazy Background Page has been shut down.
+ EXPECT_FALSE(IsBackgroundPageAlive(last_loaded_extension_id()));
+}
#endif
// Tests that the lazy background page stays alive until all visible views are
« no previous file with comments | « no previous file | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698