| 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 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/macros.h" | 11 #include "base/macros.h" |
| 12 #include "base/message_loop/message_loop.h" | 12 #include "base/test/scoped_task_environment.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "v8/include/v8.h" | 14 #include "v8/include/v8.h" |
| 15 | 15 |
| 16 namespace gin { | 16 namespace gin { |
| 17 class ContextHolder; | 17 class ContextHolder; |
| 18 class IsolateHolder; | 18 class IsolateHolder; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace extensions { | 21 namespace extensions { |
| 22 | 22 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 51 // Allows subclasses to perform context disposal cleanup. | 51 // Allows subclasses to perform context disposal cleanup. |
| 52 virtual void OnWillDisposeContext(v8::Local<v8::Context> context) {} | 52 virtual void OnWillDisposeContext(v8::Local<v8::Context> context) {} |
| 53 | 53 |
| 54 // Returns the associated isolate. Defined out-of-line to avoid the include | 54 // Returns the associated isolate. Defined out-of-line to avoid the include |
| 55 // for IsolateHolder in the header. | 55 // for IsolateHolder in the header. |
| 56 v8::Isolate* isolate(); | 56 v8::Isolate* isolate(); |
| 57 | 57 |
| 58 private: | 58 private: |
| 59 void RunGarbageCollection(); | 59 void RunGarbageCollection(); |
| 60 | 60 |
| 61 base::MessageLoop message_loop_; | 61 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 62 |
| 62 std::unique_ptr<gin::IsolateHolder> isolate_holder_; | 63 std::unique_ptr<gin::IsolateHolder> isolate_holder_; |
| 63 std::unique_ptr<gin::ContextHolder> main_context_holder_; | 64 std::unique_ptr<gin::ContextHolder> main_context_holder_; |
| 64 std::vector<std::unique_ptr<gin::ContextHolder>> additional_context_holders_; | 65 std::vector<std::unique_ptr<gin::ContextHolder>> additional_context_holders_; |
| 65 | 66 |
| 66 DISALLOW_COPY_AND_ASSIGN(APIBindingTest); | 67 DISALLOW_COPY_AND_ASSIGN(APIBindingTest); |
| 67 }; | 68 }; |
| 68 | 69 |
| 69 } // namespace extensions | 70 } // namespace extensions |
| 70 | 71 |
| 71 #endif // EXTENSIONS_RENDERER_API_BINDING_TEST_H_ | 72 #endif // EXTENSIONS_RENDERER_API_BINDING_TEST_H_ |
| OLD | NEW |