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

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
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
69 // should bind 42 to chrome.
70 IN_PROC_BROWSER_TEST_F(ServiceWorkerTest, ServiceWorkerChromeBinding) {
71 ASSERT_TRUE(RunExtensionTest("service_worker/bindings")) << message_;
72 content::WebContents* contents =
73 browser()->tab_strip_model()->GetActiveWebContents();
74 content::WaitForLoadStop(contents);
75
76 std::string output;
77 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
78 contents, "window.domAutomationController.send(document.body.innerText);",
79 &output));
80 EXPECT_EQ("No Fetch Event yet.", output);
81
82 // Page must reload in order for the service worker to take control.
83 contents->GetController().Reload(true);
84 content::WaitForLoadStop(contents);
85
86 ASSERT_TRUE(content::ExecuteScriptAndExtractString(
87 contents, "window.domAutomationController.send(document.body.innerText);",
88 &output));
89 EXPECT_EQ("true", output);
90 }
91
67 } // namespace extensions 92 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/renderer/chrome_content_renderer_client.h » ('j') | chrome/renderer/chrome_content_renderer_client.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698