diff options
author | DHNishi@gmail.com <DHNishi@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-28 03:29:14 +0000 |
---|---|---|
committer | DHNishi@gmail.com <DHNishi@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-28 03:29:14 +0000 |
commit | ddfb4fdb3e85ed6864f1ca2a973a08df1cee4b3d (patch) | |
tree | 8713de321115fdabade521d4eac37a4ac08ec90e /chrome/browser/extensions/lazy_background_page_apitest.cc | |
parent | 890670d732ec48286ab45ac85703e06989af7148 (diff) | |
download | chromium_src-ddfb4fdb3e85ed6864f1ca2a973a08df1cee4b3d.zip chromium_src-ddfb4fdb3e85ed6864f1ca2a973a08df1cee4b3d.tar.gz chromium_src-ddfb4fdb3e85ed6864f1ca2a973a08df1cee4b3d.tar.bz2 |
Fix a bug where lazy background pages were not updating the extensions page.
BUG=260212
Review URL: https://chromiumcodereview.appspot.com/23186006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219891 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/lazy_background_page_apitest.cc')
-rw-r--r-- | chrome/browser/extensions/lazy_background_page_apitest.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/chrome/browser/extensions/lazy_background_page_apitest.cc b/chrome/browser/extensions/lazy_background_page_apitest.cc index e428704..db903db 100644 --- a/chrome/browser/extensions/lazy_background_page_apitest.cc +++ b/chrome/browser/extensions/lazy_background_page_apitest.cc @@ -458,5 +458,50 @@ IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, EventDispatchToTab) { EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); } +// Tests that the lazy background page updates the chrome://extensions page +// when it is destroyed. +IN_PROC_BROWSER_TEST_F(LazyBackgroundPageApiTest, UpdateExtensionsPage) { + ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUIExtensionsURL)); + + ResultCatcher catcher; + base::FilePath extdir = test_data_dir_.AppendASCII("lazy_background_page"). + AppendASCII("wait_for_view"); + const Extension* extension = LoadExtension(extdir); + ASSERT_TRUE(extension); + EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); + + // The extension should've opened a new tab to an extension page. + EXPECT_EQ(extension->GetResourceURL("extension_page.html").spec(), + browser()->tab_strip_model()->GetActiveWebContents()-> + GetURL().spec()); + + // Lazy Background Page still exists, because the extension created a new tab + // to an extension page. + ExtensionProcessManager* pm = + extensions::ExtensionSystem::Get(browser()->profile())->process_manager(); + EXPECT_TRUE(pm->GetBackgroundHostForExtension(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(); + + // Lazy Background Page has been shut down. + EXPECT_FALSE(pm->GetBackgroundHostForExtension(last_loaded_extension_id_)); + + // Verify that extensions page shows that the lazy background page is + // inactive. + bool is_inactive; + EXPECT_TRUE(content::ExecuteScriptInFrameAndExtractBool( + browser()->tab_strip_model()->GetActiveWebContents(), + "//iframe[starts-with(@src, 'chrome://extension')]", + "var ele = document.querySelectorAll('div.active-views');" + "window.domAutomationController.send(" + " ele[0].innerHTML.search('(Inactive)') > 0);", + &is_inactive)); + EXPECT_TRUE(is_inactive); +} + // TODO: background page with timer. // TODO: background page that interacts with popup. |