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

Side by Side Diff: android_webview/browser/test/rendering_test.h

Issue 2078383004: Add a BrowserViewRenderer unittest for compositor switch logic (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
OLDNEW
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 ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ 5 #ifndef ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_
6 #define ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ 6 #define ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "android_webview/browser/browser_view_renderer_client.h" 10 #include "android_webview/browser/browser_view_renderer_client.h"
11 #include "android_webview/browser/render_thread_manager_client.h" 11 #include "android_webview/browser/render_thread_manager_client.h"
12 #include "android_webview/browser/test/fake_window.h" 12 #include "android_webview/browser/test/fake_window.h"
13 #include "base/macros.h" 13 #include "base/macros.h"
14 #include "base/single_thread_task_runner.h" 14 #include "base/single_thread_task_runner.h"
15 #include "cc/resources/resource.h" 15 #include "cc/resources/resource.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 namespace base { 18 namespace base {
19 class MessageLoop; 19 class MessageLoop;
20 } 20 }
21 21
22 namespace cc { 22 namespace cc {
23 class CompositorFrame; 23 class CompositorFrame;
24 } 24 }
25 25
26 namespace content { 26 namespace content {
27 class SynchronousCompositor;
27 class TestSynchronousCompositor; 28 class TestSynchronousCompositor;
28 } 29 }
29 30
30 namespace android_webview { 31 namespace android_webview {
31 32
32 class BrowserViewRenderer; 33 class BrowserViewRenderer;
33 class CompositorFrameConsumer; 34 class CompositorFrameConsumer;
34 class CompositorFrameProducer; 35 class CompositorFrameProducer;
35 class FakeWindow; 36 class FakeWindow;
36 class RenderThreadManager; 37 class RenderThreadManager;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 74
74 CompositorFrameConsumer* GetCompositorFrameConsumer(); 75 CompositorFrameConsumer* GetCompositorFrameConsumer();
75 CompositorFrameProducer* GetCompositorFrameProducer(); 76 CompositorFrameProducer* GetCompositorFrameProducer();
76 77
77 virtual void SetUpTestHarness(); 78 virtual void SetUpTestHarness();
78 virtual void StartTest(); 79 virtual void StartTest();
79 80
80 void RunTest(); 81 void RunTest();
81 void InitializeCompositor(); 82 void InitializeCompositor();
82 void EndTest(); 83 void EndTest();
84 content::SynchronousCompositor* compositor() const;
boliu 2016/06/21 17:29:47 add "current" or "active" to the method name
hush (inactive) 2016/06/21 21:27:26 Done.
83 std::unique_ptr<cc::CompositorFrame> ConstructEmptyFrame(); 85 std::unique_ptr<cc::CompositorFrame> ConstructEmptyFrame();
84 std::unique_ptr<cc::CompositorFrame> ConstructFrame( 86 std::unique_ptr<cc::CompositorFrame> ConstructFrame(
85 cc::ResourceId resource_id); 87 cc::ResourceId resource_id);
86 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; 88 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
87 std::unique_ptr<FakeWindow> window_; 89 std::unique_ptr<FakeWindow> window_;
88 std::unique_ptr<FakeFunctor> functor_; 90 std::unique_ptr<FakeFunctor> functor_;
89 std::unique_ptr<BrowserViewRenderer> browser_view_renderer_; 91 std::unique_ptr<BrowserViewRenderer> browser_view_renderer_;
90 std::unique_ptr<content::TestSynchronousCompositor> compositor_; 92 std::unique_ptr<content::TestSynchronousCompositor> compositor_;
91 93
92 private: 94 private:
93 void QuitMessageLoop(); 95 void QuitMessageLoop();
94 96
95 void DrawGL(AwDrawGLInfo* aw_draw_gl_info); 97 void DrawGL(AwDrawGLInfo* aw_draw_gl_info);
96 98
97 const std::unique_ptr<base::MessageLoop> message_loop_; 99 const std::unique_ptr<base::MessageLoop> message_loop_;
98 100
99 DISALLOW_COPY_AND_ASSIGN(RenderingTest); 101 DISALLOW_COPY_AND_ASSIGN(RenderingTest);
100 }; 102 };
101 103
102 #define RENDERING_TEST_F(TEST_FIXTURE_NAME) \ 104 #define RENDERING_TEST_F(TEST_FIXTURE_NAME) \
103 TEST_F(TEST_FIXTURE_NAME, RunTest) { RunTest(); } \ 105 TEST_F(TEST_FIXTURE_NAME, RunTest) { RunTest(); } \
104 class NeedsSemicolon##TEST_FIXTURE_NAME {} 106 class NeedsSemicolon##TEST_FIXTURE_NAME {}
105 107
106 } // namespace android_webview 108 } // namespace android_webview
107 109
108 #endif // ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ 110 #endif // ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698