diff options
author | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-06 02:16:11 +0000 |
---|---|---|
committer | atwilson@chromium.org <atwilson@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-10-06 02:16:11 +0000 |
commit | 6aa25edc1e8eab316dafbf8db338aa54d3e4f4ed (patch) | |
tree | 11fc0f513cd0e6268c0bff2d64b9da17d9decffe /chrome/browser/extensions/app_background_page_apitest.cc | |
parent | 645d0ab05f4ba28a76ea5de8b362fe6fa8d6c67e (diff) | |
download | chromium_src-6aa25edc1e8eab316dafbf8db338aa54d3e4f4ed.zip chromium_src-6aa25edc1e8eab316dafbf8db338aa54d3e4f4ed.tar.gz chromium_src-6aa25edc1e8eab316dafbf8db338aa54d3e4f4ed.tar.bz2 |
Now closes existing background contents if app opens a new one.
Work around race conditions on startup where an app page creates a background
page while the BackgroundContentsService is also opening the page. We now close
the existing page instead of opening one of the pages up in a visible tab.
Also added a new browser test to verify this functionality.
BUG=98046
TEST=Added new browser_test: AppBackgroundPageApiTest.OpenTwoBackgroundPages.
Review URL: http://codereview.chromium.org/8116015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104228 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/app_background_page_apitest.cc')
-rw-r--r-- | chrome/browser/extensions/app_background_page_apitest.cc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/chrome/browser/extensions/app_background_page_apitest.cc b/chrome/browser/extensions/app_background_page_apitest.cc index 51e6313..ac1db73 100644 --- a/chrome/browser/extensions/app_background_page_apitest.cc +++ b/chrome/browser/extensions/app_background_page_apitest.cc @@ -79,7 +79,7 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, MAYBE_Basic) { ASSERT_TRUE(RunExtensionTest("app_background_page/basic")) << message_; } -// Crashy, http://crbug.com/49215. +// Crashy, http://crbug.com/69215. IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, DISABLED_LacksPermission) { host_resolver()->AddRule("a.com", "127.0.0.1"); ASSERT_TRUE(StartTestServer()); @@ -137,3 +137,29 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, ManifestBackgroundPage) { BackgroundContentsServiceFactory::GetForProfile(browser()->profile())-> GetAppBackgroundContents(ASCIIToUTF16(extension->id()))); } + +IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, OpenTwoBackgroundPages) { + host_resolver()->AddRule("a.com", "127.0.0.1"); + ASSERT_TRUE(StartTestServer()); + + std::string app_manifest = base::StringPrintf( + "{" + " \"name\": \"App\"," + " \"version\": \"0.1\"," + " \"app\": {" + " \"urls\": [" + " \"http://a.com/\"" + " ]," + " \"launch\": {" + " \"web_url\": \"http://a.com:%d/\"" + " }" + " }," + " \"permissions\": [\"background\"]" + "}", + test_server()->host_port_pair().port()); + + FilePath app_dir; + ASSERT_TRUE(CreateApp(app_manifest, &app_dir)); + ASSERT_TRUE(LoadExtension(app_dir)); + ASSERT_TRUE(RunExtensionTest("app_background_page/two_pages")) << message_; +} |