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

Side by Side Diff: extensions/renderer/api_binding_test.h

Issue 2852373004: Use ScopedTaskEnvironment instead of MessageLoop in tests that use v8. (Closed)
Patch Set: Reset-RenderViewTest Created 3 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 | « content/test/ppapi_unittest.cc ('k') | extensions/renderer/gc_callback_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 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
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_
OLDNEW
« no previous file with comments | « content/test/ppapi_unittest.cc ('k') | extensions/renderer/gc_callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698