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 #ifndef EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ | 5 #ifndef EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ |
6 #define EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ | 6 #define EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/test/scoped_async_task_scheduler.h" | |
10 #include "extensions/renderer/module_system.h" | 9 #include "extensions/renderer/module_system.h" |
11 #include "extensions/renderer/script_context.h" | 10 #include "extensions/renderer/script_context.h" |
12 #include "gin/public/context_holder.h" | 11 #include "gin/public/context_holder.h" |
13 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
14 #include "v8/include/v8.h" | 13 #include "v8/include/v8.h" |
15 | 14 |
16 namespace extensions { | 15 namespace extensions { |
17 class StringSourceMap; | 16 class StringSourceMap; |
18 | 17 |
19 class ModuleSystemTestEnvironment { | 18 class ModuleSystemTestEnvironment { |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 91 |
93 // Make the test fail if any asserts are called. By default a test will fail | 92 // Make the test fail if any asserts are called. By default a test will fail |
94 // if no asserts are called. | 93 // if no asserts are called. |
95 void ExpectNoAssertionsMade(); | 94 void ExpectNoAssertionsMade(); |
96 | 95 |
97 // Runs promises that have been resolved. Resolved promises will not run | 96 // Runs promises that have been resolved. Resolved promises will not run |
98 // until this is called. | 97 // until this is called. |
99 void RunResolvedPromises(); | 98 void RunResolvedPromises(); |
100 | 99 |
101 private: | 100 private: |
102 // Required by gin::V8Platform::CallOnBackgroundThread(). Can't be a | |
103 // ScopedTaskScheduler because v8 synchronously waits for tasks to run. | |
104 base::test::ScopedAsyncTaskScheduler scoped_async_task_scheduler_; | |
105 | |
106 v8::Isolate* isolate_; | 101 v8::Isolate* isolate_; |
107 std::unique_ptr<ModuleSystemTestEnvironment> env_; | 102 std::unique_ptr<ModuleSystemTestEnvironment> env_; |
108 bool should_assertions_be_made_; | 103 bool should_assertions_be_made_; |
109 | 104 |
110 private: | 105 private: |
111 DISALLOW_COPY_AND_ASSIGN(ModuleSystemTest); | 106 DISALLOW_COPY_AND_ASSIGN(ModuleSystemTest); |
112 }; | 107 }; |
113 | 108 |
114 } // namespace extensions | 109 } // namespace extensions |
115 | 110 |
116 #endif // EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ | 111 #endif // EXTENSIONS_RENDERER_MODULE_SYSTEM_TEST_H_ |
OLD | NEW |