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

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

Issue 1743763004: Use v8::MicrotasksScope internally in V8RecursionScope. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v8rs-2-endofscope
Patch Set: v8_helpers Created 4 years, 9 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
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/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 ModuleSystem::NativesEnabledScope natives_enabled(env()->module_system()); 207 ModuleSystem::NativesEnabledScope natives_enabled(env()->module_system());
208 v8::Local<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 v8::MicrotasksScope::PerformCheckpoint(env()->isolate());
218 base::MessageLoop::current()->PostTask( 218 base::MessageLoop::current()->PostTask(
219 FROM_HERE, base::Bind(&ApiTestEnvironment::RunPromisesAgain, 219 FROM_HERE, base::Bind(&ApiTestEnvironment::RunPromisesAgain,
220 base::Unretained(this))); 220 base::Unretained(this)));
221 } 221 }
222 222
223 ApiTestBase::ApiTestBase() { 223 ApiTestBase::ApiTestBase() {
224 } 224 }
225 225
226 ApiTestBase::~ApiTestBase() { 226 ApiTestBase::~ApiTestBase() {
227 } 227 }
228 228
229 void ApiTestBase::SetUp() { 229 void ApiTestBase::SetUp() {
230 ModuleSystemTest::SetUp(); 230 ModuleSystemTest::SetUp();
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
OLDNEW
« no previous file with comments | « extensions/renderer/activity_log_converter_strategy_unittest.cc ('k') | extensions/renderer/module_system_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698