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

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

Issue 399363002: Add support for writing unit tests for Mojo-backed apps/extensions APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 6 years, 5 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/module_system_test.h" 5 #include "extensions/renderer/module_system_test.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 ModuleSystemTestEnvironment::ModuleSystemTestEnvironment(v8::Isolate* isolate) 124 ModuleSystemTestEnvironment::ModuleSystemTestEnvironment(v8::Isolate* isolate)
125 : isolate_(isolate), 125 : isolate_(isolate),
126 context_holder_(new gin::ContextHolder(isolate_)), 126 context_holder_(new gin::ContextHolder(isolate_)),
127 handle_scope_(isolate_), 127 handle_scope_(isolate_),
128 source_map_(new StringSourceMap()) { 128 source_map_(new StringSourceMap()) {
129 context_holder_->SetContext(v8::Context::New( 129 context_holder_->SetContext(v8::Context::New(
130 isolate, g_v8_extension_configurator.Get().GetConfiguration())); 130 isolate, g_v8_extension_configurator.Get().GetConfiguration()));
131 context_.reset(new ScriptContext(context_holder_->context(), 131 context_.reset(new ScriptContext(context_holder_->context(),
132 NULL, // WebFrame 132 NULL, // WebFrame
133 NULL, // Extension 133 NULL, // Extension
134 Feature::UNSPECIFIED_CONTEXT)); 134 Feature::BLESSED_EXTENSION_CONTEXT));
135 context_->v8_context()->Enter(); 135 context_->v8_context()->Enter();
136 assert_natives_ = new AssertNatives(context_.get()); 136 assert_natives_ = new AssertNatives(context_.get());
137 137
138 { 138 {
139 scoped_ptr<ModuleSystem> module_system( 139 scoped_ptr<ModuleSystem> module_system(
140 new ModuleSystem(context_.get(), source_map_.get())); 140 new ModuleSystem(context_.get(), source_map_.get()));
141 context_->set_module_system(module_system.Pass()); 141 context_->set_module_system(module_system.Pass());
142 } 142 }
143 ModuleSystem* module_system = context_->module_system(); 143 ModuleSystem* module_system = context_->module_system();
144 module_system->RegisterNativeHandler( 144 module_system->RegisterNativeHandler(
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 229
230 void ModuleSystemTest::ExpectNoAssertionsMade() { 230 void ModuleSystemTest::ExpectNoAssertionsMade() {
231 should_assertions_be_made_ = false; 231 should_assertions_be_made_ = false;
232 } 232 }
233 233
234 void ModuleSystemTest::RunResolvedPromises() { 234 void ModuleSystemTest::RunResolvedPromises() {
235 isolate_->RunMicrotasks(); 235 isolate_->RunMicrotasks();
236 } 236 }
237 237
238 } // namespace extensions 238 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698