| 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "extensions/common/extension_urls.h" | 10 #include "extensions/common/extension_urls.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 env()->context()->GetExtensionID(), | 133 env()->context()->GetExtensionID(), |
| 134 env()->context()->GetContextTypeDescription(), | 134 env()->context()->GetContextTypeDescription(), |
| 135 false, | 135 false, |
| 136 false, | 136 false, |
| 137 2, | 137 2, |
| 138 false))); | 138 false))); |
| 139 env()->RegisterTestFile("test_environment_specific_bindings", | 139 env()->RegisterTestFile("test_environment_specific_bindings", |
| 140 "unit_test_environment_specific_bindings.js"); | 140 "unit_test_environment_specific_bindings.js"); |
| 141 | 141 |
| 142 env()->OverrideNativeHandler("activityLogger", | 142 env()->OverrideNativeHandler("activityLogger", |
| 143 "exports.LogAPICall = function() {};"); | 143 "exports.$set('LogAPICall', function() {});"); |
| 144 env()->OverrideNativeHandler( | 144 env()->OverrideNativeHandler( |
| 145 "apiDefinitions", | 145 "apiDefinitions", |
| 146 "exports.GetExtensionAPIDefinitionsForTest = function() { return [] };"); | 146 "exports.$set('GetExtensionAPIDefinitionsForTest'," |
| 147 "function() { return [] });"); |
| 147 env()->OverrideNativeHandler( | 148 env()->OverrideNativeHandler( |
| 148 "event_natives", | 149 "event_natives", |
| 149 "exports.AttachEvent = function() {};" | 150 "exports.$set('AttachEvent', function() {});" |
| 150 "exports.DetachEvent = function() {};" | 151 "exports.$set('DetachEvent', function() {});" |
| 151 "exports.AttachFilteredEvent = function() {};" | 152 "exports.$set('AttachFilteredEvent', function() {});" |
| 152 "exports.AttachFilteredEvent = function() {};" | 153 "exports.$set('AttachFilteredEvent', function() {});" |
| 153 "exports.MatchAgainstEventFilter = function() { return [] };"); | 154 "exports.$set('MatchAgainstEventFilter', function() { return [] });"); |
| 154 | 155 |
| 155 gin::ModuleRegistry::From(env()->context()->v8_context()) | 156 gin::ModuleRegistry::From(env()->context()->v8_context()) |
| 156 ->AddBuiltinModule(env()->isolate(), | 157 ->AddBuiltinModule(env()->isolate(), |
| 157 mojo::js::Core::kModuleName, | 158 mojo::js::Core::kModuleName, |
| 158 mojo::js::Core::GetModule(env()->isolate())); | 159 mojo::js::Core::GetModule(env()->isolate())); |
| 159 gin::ModuleRegistry::From(env()->context()->v8_context()) | 160 gin::ModuleRegistry::From(env()->context()->v8_context()) |
| 160 ->AddBuiltinModule(env()->isolate(), | 161 ->AddBuiltinModule(env()->isolate(), |
| 161 mojo::js::Support::kModuleName, | 162 mojo::js::Support::kModuleName, |
| 162 mojo::js::Support::GetModule(env()->isolate())); | 163 mojo::js::Support::GetModule(env()->isolate())); |
| 163 gin::Handle<TestServiceProvider> service_provider = | 164 gin::Handle<TestServiceProvider> service_provider = |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 test_env_.reset(new ApiTestEnvironment(env())); | 232 test_env_.reset(new ApiTestEnvironment(env())); |
| 232 } | 233 } |
| 233 | 234 |
| 234 void ApiTestBase::RunTest(const std::string& file_name, | 235 void ApiTestBase::RunTest(const std::string& file_name, |
| 235 const std::string& test_name) { | 236 const std::string& test_name) { |
| 236 ExpectNoAssertionsMade(); | 237 ExpectNoAssertionsMade(); |
| 237 test_env_->RunTest(file_name, test_name); | 238 test_env_->RunTest(file_name, test_name); |
| 238 } | 239 } |
| 239 | 240 |
| 240 } // namespace extensions | 241 } // namespace extensions |
| OLD | NEW |