OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_API_BINDING_TEST_H_ | 5 #ifndef EXTENSIONS_RENDERER_API_BINDING_TEST_H_ |
6 #define EXTENSIONS_RENDERER_API_BINDING_TEST_H_ | 6 #define EXTENSIONS_RENDERER_API_BINDING_TEST_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "base/test/scoped_async_task_scheduler.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
14 | 15 |
15 namespace gin { | 16 namespace gin { |
16 class ContextHolder; | 17 class ContextHolder; |
17 class IsolateHolder; | 18 class IsolateHolder; |
18 } | 19 } |
19 | 20 |
20 namespace extensions { | 21 namespace extensions { |
21 | 22 |
(...skipping 14 matching lines...) Expand all Loading... |
36 | 37 |
37 v8::Local<v8::Context> ContextLocal(); | 38 v8::Local<v8::Context> ContextLocal(); |
38 void DisposeContext(); | 39 void DisposeContext(); |
39 | 40 |
40 // Returns the associated isolate. Defined out-of-line to avoid the include | 41 // Returns the associated isolate. Defined out-of-line to avoid the include |
41 // for IsolateHolder in the header. | 42 // for IsolateHolder in the header. |
42 v8::Isolate* isolate(); | 43 v8::Isolate* isolate(); |
43 | 44 |
44 private: | 45 private: |
45 base::MessageLoop message_loop_; | 46 base::MessageLoop message_loop_; |
| 47 |
| 48 // Required by gin::V8Platform::CallOnBackgroundThread(). Can't be a |
| 49 // ScopedTaskScheduler because v8 synchronously waits for tasks to run. |
| 50 base::test::ScopedAsyncTaskScheduler scoped_async_task_scheduler_; |
| 51 |
46 std::unique_ptr<gin::IsolateHolder> isolate_holder_; | 52 std::unique_ptr<gin::IsolateHolder> isolate_holder_; |
47 std::unique_ptr<gin::ContextHolder> context_holder_; | 53 std::unique_ptr<gin::ContextHolder> context_holder_; |
48 | 54 |
49 DISALLOW_COPY_AND_ASSIGN(APIBindingTest); | 55 DISALLOW_COPY_AND_ASSIGN(APIBindingTest); |
50 }; | 56 }; |
51 | 57 |
52 } // namespace extensions | 58 } // namespace extensions |
53 | 59 |
54 #endif // EXTENSIONS_RENDERER_API_BINDING_TEST_H_ | 60 #endif // EXTENSIONS_RENDERER_API_BINDING_TEST_H_ |
OLD | NEW |