OLD | NEW |
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/strings/string_piece.h" | 13 #include "base/strings/string_piece.h" |
14 #include "base/threading/thread_task_runner_handle.h" | 14 #include "base/threading/thread_task_runner_handle.h" |
15 #include "extensions/common/extension_urls.h" | 15 #include "extensions/common/extension_urls.h" |
16 #include "extensions/renderer/dispatcher.h" | 16 #include "extensions/renderer/dispatcher.h" |
17 #include "extensions/renderer/process_info_native_handler.h" | 17 #include "extensions/renderer/process_info_native_handler.h" |
18 #include "gin/converter.h" | 18 #include "gin/converter.h" |
19 #include "gin/dictionary.h" | 19 #include "gin/dictionary.h" |
20 #include "gin/modules/console.h" | 20 #include "gin/modules/console.h" |
| 21 #include "gin/modules/timer.h" |
21 #include "mojo/edk/js/core.h" | 22 #include "mojo/edk/js/core.h" |
22 #include "mojo/edk/js/handle.h" | 23 #include "mojo/edk/js/handle.h" |
23 #include "mojo/edk/js/support.h" | 24 #include "mojo/edk/js/support.h" |
24 #include "mojo/public/cpp/bindings/interface_request.h" | 25 #include "mojo/public/cpp/bindings/interface_request.h" |
25 #include "mojo/public/cpp/system/core.h" | 26 #include "mojo/public/cpp/system/core.h" |
26 | 27 |
27 namespace extensions { | 28 namespace extensions { |
28 namespace { | 29 namespace { |
29 | 30 |
30 // Natives for the implementation of the unit test version of chrome.test. Calls | 31 // Natives for the implementation of the unit test version of chrome.test. Calls |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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()) |
157 ->AddBuiltinModule(env()->isolate(), gin::Console::kModuleName, | 158 ->AddBuiltinModule(env()->isolate(), gin::Console::kModuleName, |
158 gin::Console::GetModule(env()->isolate())); | 159 gin::Console::GetModule(env()->isolate())); |
159 gin::ModuleRegistry::From(env()->context()->v8_context()) | 160 gin::ModuleRegistry::From(env()->context()->v8_context()) |
| 161 ->AddBuiltinModule(env()->isolate(), gin::TimerModule::kName, |
| 162 gin::TimerModule::GetModule(env()->isolate())); |
| 163 gin::ModuleRegistry::From(env()->context()->v8_context()) |
160 ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Core::kModuleName, | 164 ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Core::kModuleName, |
161 mojo::edk::js::Core::GetModule(env()->isolate())); | 165 mojo::edk::js::Core::GetModule(env()->isolate())); |
162 gin::ModuleRegistry::From(env()->context()->v8_context()) | 166 gin::ModuleRegistry::From(env()->context()->v8_context()) |
163 ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Support::kModuleName, | 167 ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Support::kModuleName, |
164 mojo::edk::js::Support::GetModule(env()->isolate())); | 168 mojo::edk::js::Support::GetModule(env()->isolate())); |
165 gin::Handle<TestInterfaceProvider> interface_provider = | 169 gin::Handle<TestInterfaceProvider> interface_provider = |
166 TestInterfaceProvider::Create(env()->isolate()); | 170 TestInterfaceProvider::Create(env()->isolate()); |
167 interface_provider_ = interface_provider.get(); | 171 interface_provider_ = interface_provider.get(); |
168 gin::ModuleRegistry::From(env()->context()->v8_context()) | 172 gin::ModuleRegistry::From(env()->context()->v8_context()) |
169 ->AddBuiltinModule(env()->isolate(), | 173 ->AddBuiltinModule(env()->isolate(), |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 test_env_.reset(new ApiTestEnvironment(env())); | 246 test_env_.reset(new ApiTestEnvironment(env())); |
243 } | 247 } |
244 | 248 |
245 void ApiTestBase::RunTest(const std::string& file_name, | 249 void ApiTestBase::RunTest(const std::string& file_name, |
246 const std::string& test_name) { | 250 const std::string& test_name) { |
247 ExpectNoAssertionsMade(); | 251 ExpectNoAssertionsMade(); |
248 test_env_->RunTest(file_name, test_name); | 252 test_env_->RunTest(file_name, test_name); |
249 } | 253 } |
250 | 254 |
251 } // namespace extensions | 255 } // namespace extensions |
OLD | NEW |