Index: chrome/browser/extensions/service_worker_apitest.cc |
diff --git a/chrome/browser/extensions/service_worker_apitest.cc b/chrome/browser/extensions/service_worker_apitest.cc |
index 3dd54521a95d4a5eb90781c951e71333d5a3b97a..065f6e202631dd94dfd10abb18cb61724c1f9b88 100644 |
--- a/chrome/browser/extensions/service_worker_apitest.cc |
+++ b/chrome/browser/extensions/service_worker_apitest.cc |
@@ -64,4 +64,29 @@ IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, ServiceWorkerFetchEvent) { |
EXPECT_EQ("Caught a fetch!", output); |
} |
+// Binding that was created on the v8::Context of the worker for testing |
+// purposes |
+// should bind 42 to chrome. |
+IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, ServiceWorkerChromeBinding) { |
+ ASSERT_TRUE(RunExtensionTest("service_worker/bindings")) << message_; |
+ content::WebContents* contents = |
+ browser()->tab_strip_model()->GetActiveWebContents(); |
+ content::WaitForLoadStop(contents); |
+ |
+ std::string output; |
+ ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
+ contents, "window.domAutomationController.send(document.body.innerText);", |
+ &output)); |
+ EXPECT_EQ("No Fetch Event yet.", output); |
+ |
+ // Page must reload in order for the service worker to take control. |
+ contents->GetController().Reload(true); |
+ content::WaitForLoadStop(contents); |
+ |
+ ASSERT_TRUE(content::ExecuteScriptAndExtractString( |
+ contents, "window.domAutomationController.send(document.body.innerText);", |
+ &output)); |
+ EXPECT_EQ("true", output); |
+} |
+ |
} // namespace extensions |