| 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" | |
| 22 #include "mojo/edk/js/core.h" | 21 #include "mojo/edk/js/core.h" |
| 23 #include "mojo/edk/js/handle.h" | 22 #include "mojo/edk/js/handle.h" |
| 24 #include "mojo/edk/js/support.h" | 23 #include "mojo/edk/js/support.h" |
| 25 #include "mojo/public/cpp/bindings/interface_request.h" | 24 #include "mojo/public/cpp/bindings/interface_request.h" |
| 26 #include "mojo/public/cpp/system/core.h" | 25 #include "mojo/public/cpp/system/core.h" |
| 27 | 26 |
| 28 namespace extensions { | 27 namespace extensions { |
| 29 namespace { | 28 namespace { |
| 30 | 29 |
| 31 // Natives for the implementation of the unit test version of chrome.test. Calls | 30 // 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... |
| 151 "exports.$set('AttachEvent', function() {});" | 150 "exports.$set('AttachEvent', function() {});" |
| 152 "exports.$set('DetachEvent', function() {});" | 151 "exports.$set('DetachEvent', function() {});" |
| 153 "exports.$set('AttachFilteredEvent', function() {});" | 152 "exports.$set('AttachFilteredEvent', function() {});" |
| 154 "exports.$set('AttachFilteredEvent', function() {});" | 153 "exports.$set('AttachFilteredEvent', function() {});" |
| 155 "exports.$set('MatchAgainstEventFilter', function() { return [] });"); | 154 "exports.$set('MatchAgainstEventFilter', function() { return [] });"); |
| 156 | 155 |
| 157 gin::ModuleRegistry::From(env()->context()->v8_context()) | 156 gin::ModuleRegistry::From(env()->context()->v8_context()) |
| 158 ->AddBuiltinModule(env()->isolate(), gin::Console::kModuleName, | 157 ->AddBuiltinModule(env()->isolate(), gin::Console::kModuleName, |
| 159 gin::Console::GetModule(env()->isolate())); | 158 gin::Console::GetModule(env()->isolate())); |
| 160 gin::ModuleRegistry::From(env()->context()->v8_context()) | 159 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()) | |
| 164 ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Core::kModuleName, | 160 ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Core::kModuleName, |
| 165 mojo::edk::js::Core::GetModule(env()->isolate())); | 161 mojo::edk::js::Core::GetModule(env()->isolate())); |
| 166 gin::ModuleRegistry::From(env()->context()->v8_context()) | 162 gin::ModuleRegistry::From(env()->context()->v8_context()) |
| 167 ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Support::kModuleName, | 163 ->AddBuiltinModule(env()->isolate(), mojo::edk::js::Support::kModuleName, |
| 168 mojo::edk::js::Support::GetModule(env()->isolate())); | 164 mojo::edk::js::Support::GetModule(env()->isolate())); |
| 169 gin::Handle<TestInterfaceProvider> interface_provider = | 165 gin::Handle<TestInterfaceProvider> interface_provider = |
| 170 TestInterfaceProvider::Create(env()->isolate()); | 166 TestInterfaceProvider::Create(env()->isolate()); |
| 171 interface_provider_ = interface_provider.get(); | 167 interface_provider_ = interface_provider.get(); |
| 172 gin::ModuleRegistry::From(env()->context()->v8_context()) | 168 gin::ModuleRegistry::From(env()->context()->v8_context()) |
| 173 ->AddBuiltinModule(env()->isolate(), | 169 ->AddBuiltinModule(env()->isolate(), |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 test_env_.reset(new ApiTestEnvironment(env())); | 242 test_env_.reset(new ApiTestEnvironment(env())); |
| 247 } | 243 } |
| 248 | 244 |
| 249 void ApiTestBase::RunTest(const std::string& file_name, | 245 void ApiTestBase::RunTest(const std::string& file_name, |
| 250 const std::string& test_name) { | 246 const std::string& test_name) { |
| 251 ExpectNoAssertionsMade(); | 247 ExpectNoAssertionsMade(); |
| 252 test_env_->RunTest(file_name, test_name); | 248 test_env_->RunTest(file_name, test_name); |
| 253 } | 249 } |
| 254 | 250 |
| 255 } // namespace extensions | 251 } // namespace extensions |
| OLD | NEW |