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

Side by Side Diff: headless/lib/embedder_mojo_browsertest.cc

Issue 2590393002: Revert of Mojo JS bindings: switch most usage of "connection"/"router" module to "bindings". (Closed)
Patch Set: Created 4 years 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 | « extensions/test/data/api_test_base_unittest.js ('k') | headless/test/data/page_one.html » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory> 5 #include <memory>
6 #include "base/optional.h" 6 #include "base/optional.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 145
146 class MojoBindingsTest : public EmbedderMojoTest { 146 class MojoBindingsTest : public EmbedderMojoTest {
147 public: 147 public:
148 void RunMojoTest() override { 148 void RunMojoTest() override {
149 devtools_client_->GetRuntime()->Evaluate( 149 devtools_client_->GetRuntime()->Evaluate(
150 "// Note define() defines a module in the mojo module dependency \n" 150 "// Note define() defines a module in the mojo module dependency \n"
151 "// system. While we don't expose our module, the callback below only\n" 151 "// system. While we don't expose our module, the callback below only\n"
152 "// fires after the requested modules have been loaded. \n" 152 "// fires after the requested modules have been loaded. \n"
153 "define([ \n" 153 "define([ \n"
154 " 'headless/lib/embedder_test.mojom', \n" 154 " 'headless/lib/embedder_test.mojom', \n"
155 " 'mojo/public/js/core', \n"
156 " 'mojo/public/js/router', \n"
155 " 'content/public/renderer/frame_interfaces', \n" 157 " 'content/public/renderer/frame_interfaces', \n"
156 " ], function(embedderMojom, frameInterfaces) { \n" 158 " ], function(embedderMojom, mojoCore, routerModule, \n"
159 " frameInterfaces) { \n"
157 " var testEmbedderService = \n" 160 " var testEmbedderService = \n"
158 " new embedderMojom.TestEmbedderServicePtr( \n" 161 " new embedderMojom.TestEmbedderService.proxyClass( \n"
159 " frameInterfaces.getInterface( \n" 162 " new routerModule.Router( \n"
160 " embedderMojom.TestEmbedderService.name)); \n" 163 " frameInterfaces.getInterface( \n"
164 " embedderMojom.TestEmbedderService.name))); \n"
161 " \n" 165 " \n"
162 " // Send a message to the embedder! \n" 166 " // Send a message to the embedder! \n"
163 " testEmbedderService.returnTestResult('hello world'); \n" 167 " testEmbedderService.returnTestResult('hello world'); \n"
164 "});", 168 "});",
165 base::Bind(&EmbedderMojoTest::OnEvalResult, base::Unretained(this))); 169 base::Bind(&EmbedderMojoTest::OnEvalResult, base::Unretained(this)));
166 } 170 }
167 171
168 // embedder_test::TestEmbedderService: 172 // embedder_test::TestEmbedderService:
169 void ReturnTestResult(const std::string& result) override { 173 void ReturnTestResult(const std::string& result) override {
170 EXPECT_EQ("hello world", result); 174 EXPECT_EQ("hello world", result);
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 void OnLoadingFailed(const network::LoadingFailedParams& params) override { 246 void OnLoadingFailed(const network::LoadingFailedParams& params) override {
243 // The navigation should fail since HTTP requests are blackholed. 247 // The navigation should fail since HTTP requests are blackholed.
244 EXPECT_EQ(params.GetErrorText(), "net::ERR_FILE_NOT_FOUND"); 248 EXPECT_EQ(params.GetErrorText(), "net::ERR_FILE_NOT_FOUND");
245 FinishAsynchronousTest(); 249 FinishAsynchronousTest();
246 } 250 }
247 }; 251 };
248 252
249 DEVTOOLS_CLIENT_TEST_F(HttpDisabledByDefaultWhenMojoBindingsUsed); 253 DEVTOOLS_CLIENT_TEST_F(HttpDisabledByDefaultWhenMojoBindingsUsed);
250 254
251 } // namespace headless 255 } // namespace headless
OLDNEW
« no previous file with comments | « extensions/test/data/api_test_base_unittest.js ('k') | headless/test/data/page_one.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698