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

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

Issue 9508008: Allow apps with background pages to request process-per-app-instance. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Prevent script access to background page. Created 8 years, 10 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
Index: chrome/browser/extensions/app_background_page_apitest.cc
diff --git a/chrome/browser/extensions/app_background_page_apitest.cc b/chrome/browser/extensions/app_background_page_apitest.cc
index 9c9585ba2a2c1580a42af58927ca9cfe84a567f2..b06cb70bcb582ce464309c315773b74149ba222c 100644
--- a/chrome/browser/extensions/app_background_page_apitest.cc
+++ b/chrome/browser/extensions/app_background_page_apitest.cc
@@ -143,6 +143,45 @@ IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, ManifestBackgroundPage) {
GetAppBackgroundContents(ASCIIToUTF16(extension->id())));
}
+IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, NoJsManifestBackgroundPage) {
+ host_resolver()->AddRule("a.com", "127.0.0.1");
+ ASSERT_TRUE(StartTestServer());
+
+ std::string app_manifest = base::StringPrintf(
+ "{"
+ " \"name\": \"App\","
+ " \"version\": \"0.1\","
+ " \"manifest_version\": 2,"
+ " \"app\": {"
+ " \"urls\": ["
+ " \"http://a.com/\""
+ " ],"
+ " \"launch\": {"
+ " \"web_url\": \"http://a.com:%d/\""
+ " }"
+ " },"
+ " \"permissions\": [\"background\"],"
+ " \"background\": {"
+ " \"page\": \"http://a.com:%d/test.html\","
+ " \"allow_js_access\": false"
+ " }"
+ "}",
+ test_server()->host_port_pair().port(),
+ test_server()->host_port_pair().port());
+
+ FilePath app_dir;
+ ASSERT_TRUE(CreateApp(app_manifest, &app_dir));
+ ASSERT_TRUE(LoadExtension(app_dir));
+
+ // The background page should load, but window.open should return null.
+ const Extension* extension = GetSingleLoadedExtension();
+ ASSERT_TRUE(
+ BackgroundContentsServiceFactory::GetForProfile(browser()->profile())->
+ GetAppBackgroundContents(ASCIIToUTF16(extension->id())));
+ // TODO(creis): Add this test directory.
+ ASSERT_TRUE(RunExtensionTest("app_background_page/no_js")) << message_;
Charlie Reis 2012/03/01 00:38:22 I spent most of the afternoon trying to understand
Charlie Reis 2012/03/01 02:45:22 Thanks for the explanation, Drew! It would have t
+}
+
IN_PROC_BROWSER_TEST_F(AppBackgroundPageApiTest, OpenTwoBackgroundPages) {
host_resolver()->AddRule("a.com", "127.0.0.1");
ASSERT_TRUE(StartTestServer());

Powered by Google App Engine
This is Rietveld 408576698