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

Side by Side Diff: extensions/renderer/api_test_base.cc

Issue 2618693004: Mojo JS bindings: make sure that console.log() could be used in the bindings. (Closed)
Patch Set: merge & resolve Created 3 years, 11 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 | « content/renderer/render_frame_impl.cc ('k') | ios/web/ios_web_resources.grd » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "extensions/renderer/api_test_base.h" 5 #include "extensions/renderer/api_test_base.h"
6 6
7 #include <utility> 7 #include <utility>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/run_loop.h" 11 #include "base/run_loop.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "extensions/common/extension_urls.h" 14 #include "extensions/common/extension_urls.h"
15 #include "extensions/renderer/dispatcher.h" 15 #include "extensions/renderer/dispatcher.h"
16 #include "extensions/renderer/process_info_native_handler.h" 16 #include "extensions/renderer/process_info_native_handler.h"
17 #include "gin/converter.h" 17 #include "gin/converter.h"
18 #include "gin/dictionary.h" 18 #include "gin/dictionary.h"
19 #include "gin/modules/console.h"
19 #include "mojo/edk/js/core.h" 20 #include "mojo/edk/js/core.h"
20 #include "mojo/edk/js/handle.h" 21 #include "mojo/edk/js/handle.h"
21 #include "mojo/edk/js/support.h" 22 #include "mojo/edk/js/support.h"
22 #include "mojo/public/cpp/bindings/interface_request.h" 23 #include "mojo/public/cpp/bindings/interface_request.h"
23 #include "mojo/public/cpp/system/core.h" 24 #include "mojo/public/cpp/system/core.h"
24 25
25 namespace extensions { 26 namespace extensions {
26 namespace { 27 namespace {
27 28
28 // Natives for the implementation of the unit test version of chrome.test. Calls 29 // Natives for the implementation of the unit test version of chrome.test. Calls
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 "function() { return [] });"); 148 "function() { return [] });");
148 env()->OverrideNativeHandler( 149 env()->OverrideNativeHandler(
149 "event_natives", 150 "event_natives",
150 "exports.$set('AttachEvent', function() {});" 151 "exports.$set('AttachEvent', function() {});"
151 "exports.$set('DetachEvent', function() {});" 152 "exports.$set('DetachEvent', function() {});"
152 "exports.$set('AttachFilteredEvent', function() {});" 153 "exports.$set('AttachFilteredEvent', function() {});"
153 "exports.$set('AttachFilteredEvent', function() {});" 154 "exports.$set('AttachFilteredEvent', function() {});"
154 "exports.$set('MatchAgainstEventFilter', function() { return [] });"); 155 "exports.$set('MatchAgainstEventFilter', function() { return [] });");
155 156
156 gin::ModuleRegistry::From(env()->context()->v8_context()) 157 gin::ModuleRegistry::From(env()->context()->v8_context())
158 ->AddBuiltinModule(env()->isolate(), gin::Console::kModuleName,
159 gin::Console::GetModule(env()->isolate()));
160 gin::ModuleRegistry::From(env()->context()->v8_context())
157 ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Core::kModuleName, 161 ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Core::kModuleName,
158 mojo::edk::js::Core::GetModule(env()->isolate())); 162 mojo::edk::js::Core::GetModule(env()->isolate()));
159 gin::ModuleRegistry::From(env()->context()->v8_context()) 163 gin::ModuleRegistry::From(env()->context()->v8_context())
160 ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Support::kModuleName, 164 ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Support::kModuleName,
161 mojo::edk::js::Support::GetModule(env()->isolate())); 165 mojo::edk::js::Support::GetModule(env()->isolate()));
162 gin::Handle<TestInterfaceProvider> interface_provider = 166 gin::Handle<TestInterfaceProvider> interface_provider =
163 TestInterfaceProvider::Create(env()->isolate()); 167 TestInterfaceProvider::Create(env()->isolate());
164 interface_provider_ = interface_provider.get(); 168 interface_provider_ = interface_provider.get();
165 gin::ModuleRegistry::From(env()->context()->v8_context()) 169 gin::ModuleRegistry::From(env()->context()->v8_context())
166 ->AddBuiltinModule(env()->isolate(), 170 ->AddBuiltinModule(env()->isolate(),
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 test_env_.reset(new ApiTestEnvironment(env())); 243 test_env_.reset(new ApiTestEnvironment(env()));
240 } 244 }
241 245
242 void ApiTestBase::RunTest(const std::string& file_name, 246 void ApiTestBase::RunTest(const std::string& file_name,
243 const std::string& test_name) { 247 const std::string& test_name) {
244 ExpectNoAssertionsMade(); 248 ExpectNoAssertionsMade();
245 test_env_->RunTest(file_name, test_name); 249 test_env_->RunTest(file_name, test_name);
246 } 250 }
247 251
248 } // namespace extensions 252 } // namespace extensions
OLDNEW
« no previous file with comments | « content/renderer/render_frame_impl.cc ('k') | ios/web/ios_web_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698