| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 base::MessageLoop::current()->PostTask( | 198 base::MessageLoop::current()->PostTask( |
| 199 FROM_HERE, base::Bind(&ApiTestEnvironment::RunPromisesAgain, | 199 FROM_HERE, base::Bind(&ApiTestEnvironment::RunPromisesAgain, |
| 200 base::Unretained(this))); | 200 base::Unretained(this))); |
| 201 run_loop.Run(); | 201 run_loop.Run(); |
| 202 } | 202 } |
| 203 | 203 |
| 204 void ApiTestEnvironment::RunTestInner(const std::string& test_name, | 204 void ApiTestEnvironment::RunTestInner(const std::string& test_name, |
| 205 const base::Closure& quit_closure) { | 205 const base::Closure& quit_closure) { |
| 206 v8::HandleScope scope(env()->isolate()); | 206 v8::HandleScope scope(env()->isolate()); |
| 207 ModuleSystem::NativesEnabledScope natives_enabled(env()->module_system()); | 207 ModuleSystem::NativesEnabledScope natives_enabled(env()->module_system()); |
| 208 v8::Handle<v8::Value> result = | 208 v8::Local<v8::Value> result = |
| 209 env()->module_system()->CallModuleMethod("testBody", test_name); | 209 env()->module_system()->CallModuleMethod("testBody", test_name); |
| 210 if (!result->IsTrue()) { | 210 if (!result->IsTrue()) { |
| 211 base::MessageLoop::current()->PostTask(FROM_HERE, quit_closure); | 211 base::MessageLoop::current()->PostTask(FROM_HERE, quit_closure); |
| 212 FAIL() << "Failed to run test \"" << test_name << "\""; | 212 FAIL() << "Failed to run test \"" << test_name << "\""; |
| 213 } | 213 } |
| 214 } | 214 } |
| 215 | 215 |
| 216 void ApiTestEnvironment::RunPromisesAgain() { | 216 void ApiTestEnvironment::RunPromisesAgain() { |
| 217 env()->isolate()->RunMicrotasks(); | 217 env()->isolate()->RunMicrotasks(); |
| 218 base::MessageLoop::current()->PostTask( | 218 base::MessageLoop::current()->PostTask( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 231 test_env_.reset(new ApiTestEnvironment(env())); | 231 test_env_.reset(new ApiTestEnvironment(env())); |
| 232 } | 232 } |
| 233 | 233 |
| 234 void ApiTestBase::RunTest(const std::string& file_name, | 234 void ApiTestBase::RunTest(const std::string& file_name, |
| 235 const std::string& test_name) { | 235 const std::string& test_name) { |
| 236 ExpectNoAssertionsMade(); | 236 ExpectNoAssertionsMade(); |
| 237 test_env_->RunTest(file_name, test_name); | 237 test_env_->RunTest(file_name, test_name); |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace extensions | 240 } // namespace extensions |
| OLD | NEW |