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

Side by Side Diff: chrome/browser/extensions/service_worker_apitest.cc

Issue 1256323008: [Extension ServiceWorkers] Chrome: Passing v8::context to extensions dispatcher (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/renderer/chrome_content_renderer_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/extensions/extension_apitest.h" 5 #include "chrome/browser/extensions/extension_apitest.h"
6 #include "chrome/browser/ui/tabs/tab_strip_model.h" 6 #include "chrome/browser/ui/tabs/tab_strip_model.h"
7 #include "content/public/test/browser_test_utils.h" 7 #include "content/public/test/browser_test_utils.h"
8 #include "extensions/test/extension_test_message_listener.h" 8 #include "extensions/test/extension_test_message_listener.h"
9 9
10 namespace extensions { 10 namespace extensions {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 // Page must reload in order for the service worker to take control. 57 // Page must reload in order for the service worker to take control.
58 contents->GetController().Reload(true); 58 contents->GetController().Reload(true);
59 content::WaitForLoadStop(contents); 59 content::WaitForLoadStop(contents);
60 60
61 ASSERT_TRUE(content::ExecuteScriptAndExtractString( 61 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
62 contents, "window.domAutomationController.send(document.body.innerText);", 62 contents, "window.domAutomationController.send(document.body.innerText);",
63 &output)); 63 &output));
64 EXPECT_EQ("Caught a fetch!", output); 64 EXPECT_EQ("Caught a fetch!", output);
65 } 65 }
66 66
67 // Binding that was created on the v8::Context of the worker for testing
68 // purposes should bind an empty object to chrome.
69 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, ServiceWorkerChromeBinding) {
70 ASSERT_TRUE(RunExtensionTest("service_worker/bindings")) << message_;
71 content::WebContents* contents =
72 browser()->tab_strip_model()->GetActiveWebContents();
73 content::WaitForLoadStop(contents);
74
75 std::string output;
76 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
77 contents, "window.domAutomationController.send(document.body.innerText);",
78 &output));
79 EXPECT_EQ("No Fetch Event yet.", output);
80
81 // Page must reload in order for the service worker to take control.
82 contents->GetController().Reload(true);
83 content::WaitForLoadStop(contents);
84
85 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
86 contents, "window.domAutomationController.send(document.body.innerText);",
87 &output));
88 EXPECT_EQ("object", output);
89 }
90
67 } // namespace extensions 91 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/chrome_content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698