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 "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; | |
Sami
2015/05/05 13:55:54
Why did we need to remove this?
ssid
2015/05/05 16:00:06
This is removed from here because we already initi
| |
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 Loading... | |
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 |
OLD | NEW |