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

Side by Side Diff: gin/modules/module_registry_unittest.cc

Issue 1130433002: Adding task runner/ message loop to tests that use IsolateHolder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing mac build. Created 5 years, 7 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
« no previous file with comments | « gin/converter_unittest.cc ('k') | gin/modules/timer_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "gin/modules/module_registry.h" 5 #include "gin/modules/module_registry.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h"
9 #include "gin/modules/module_registry_observer.h" 8 #include "gin/modules/module_registry_observer.h"
10 #include "gin/modules/module_runner_delegate.h" 9 #include "gin/modules/module_runner_delegate.h"
11 #include "gin/public/context_holder.h" 10 #include "gin/public/context_holder.h"
12 #include "gin/public/isolate_holder.h" 11 #include "gin/public/isolate_holder.h"
13 #include "gin/shell_runner.h" 12 #include "gin/shell_runner.h"
14 #include "gin/test/v8_test.h" 13 #include "gin/test/v8_test.h"
15 #include "v8/include/v8.h" 14 #include "v8/include/v8.h"
16 15
17 namespace gin { 16 namespace gin {
18 17
19 namespace { 18 namespace {
20 19
21 struct TestHelper { 20 struct TestHelper {
22 TestHelper(v8::Isolate* isolate) 21 TestHelper(v8::Isolate* isolate)
23 : delegate(std::vector<base::FilePath>()), 22 : delegate(std::vector<base::FilePath>()),
24 runner(new ShellRunner(&delegate, isolate)), 23 runner(new ShellRunner(&delegate, isolate)),
25 scope(runner.get()) { 24 scope(runner.get()) {
26 } 25 }
27 26
28 base::MessageLoop message_loop;
29 ModuleRunnerDelegate delegate; 27 ModuleRunnerDelegate delegate;
30 scoped_ptr<ShellRunner> runner; 28 scoped_ptr<ShellRunner> runner;
31 Runner::Scope scope; 29 Runner::Scope scope;
32 }; 30 };
33 31
34 class ModuleRegistryObserverImpl : public ModuleRegistryObserver { 32 class ModuleRegistryObserverImpl : public ModuleRegistryObserver {
35 public: 33 public:
36 ModuleRegistryObserverImpl() : did_add_count_(0) {} 34 ModuleRegistryObserverImpl() : did_add_count_(0) {}
37 35
38 void OnDidAddPendingModule( 36 void OnDidAddPendingModule(
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 helper.runner->Run(source, "script"); 153 helper.runner->Run(source, "script");
156 EXPECT_EQ(no_such_module_set, registry->unsatisfied_dependencies()); 154 EXPECT_EQ(no_such_module_set, registry->unsatisfied_dependencies());
157 155
158 // Should have no effect on the unsatisfied_dependencies set. 156 // Should have no effect on the unsatisfied_dependencies set.
159 ModuleRegistry::LoadModuleCallback callback = base::Bind(OnModuleLoadedNoOp); 157 ModuleRegistry::LoadModuleCallback callback = base::Bind(OnModuleLoadedNoOp);
160 registry->LoadModule(instance_->isolate(), "one", callback); 158 registry->LoadModule(instance_->isolate(), "one", callback);
161 EXPECT_EQ(no_such_module_set, registry->unsatisfied_dependencies()); 159 EXPECT_EQ(no_such_module_set, registry->unsatisfied_dependencies());
162 } 160 }
163 161
164 } // namespace gin 162 } // namespace gin
OLDNEW
« no previous file with comments | « gin/converter_unittest.cc ('k') | gin/modules/timer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698