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 #include "android_webview/browser/test/rendering_test.h" | 5 #include "android_webview/browser/test/rendering_test.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "android_webview/browser/browser_view_renderer.h" | 9 #include "android_webview/browser/browser_view_renderer.h" |
10 #include "android_webview/browser/child_frame.h" | 10 #include "android_webview/browser/child_frame.h" |
11 #include "android_webview/browser/render_thread_manager.h" | 11 #include "android_webview/browser/render_thread_manager.h" |
12 #include "android_webview/common/aw_switches.h" | 12 #include "android_webview/common/aw_switches.h" |
13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
14 #include "base/location.h" | 14 #include "base/location.h" |
15 #include "base/memory/ptr_util.h" | 15 #include "base/memory/ptr_util.h" |
16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
18 #include "cc/output/compositor_frame.h" | 18 #include "cc/output/compositor_frame.h" |
| 19 #include "cc/test/compositor_frame_helpers.h" |
19 #include "content/public/browser/android/synchronous_compositor.h" | 20 #include "content/public/browser/android/synchronous_compositor.h" |
20 #include "content/public/test/test_synchronous_compositor_android.h" | 21 #include "content/public/test/test_synchronous_compositor_android.h" |
21 | 22 |
22 namespace android_webview { | 23 namespace android_webview { |
23 | 24 |
24 namespace { | 25 namespace { |
25 // BrowserViewRenderer subclass used for enabling tests to observe | 26 // BrowserViewRenderer subclass used for enabling tests to observe |
26 // OnParentDrawConstraintsUpdated. | 27 // OnParentDrawConstraintsUpdated. |
27 class TestBrowserViewRenderer : public BrowserViewRenderer { | 28 class TestBrowserViewRenderer : public BrowserViewRenderer { |
28 public: | 29 public: |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 | 111 |
111 void RenderingTest::EndTest() { | 112 void RenderingTest::EndTest() { |
112 ui_task_runner_->PostTask(FROM_HERE, run_loop_.QuitWhenIdleClosure()); | 113 ui_task_runner_->PostTask(FROM_HERE, run_loop_.QuitWhenIdleClosure()); |
113 } | 114 } |
114 | 115 |
115 content::SynchronousCompositor* RenderingTest::ActiveCompositor() const { | 116 content::SynchronousCompositor* RenderingTest::ActiveCompositor() const { |
116 return browser_view_renderer_->GetActiveCompositorForTesting(); | 117 return browser_view_renderer_->GetActiveCompositorForTesting(); |
117 } | 118 } |
118 | 119 |
119 std::unique_ptr<cc::CompositorFrame> RenderingTest::ConstructEmptyFrame() { | 120 std::unique_ptr<cc::CompositorFrame> RenderingTest::ConstructEmptyFrame() { |
120 std::unique_ptr<cc::CompositorFrame> compositor_frame( | 121 auto compositor_frame = base::MakeUnique<cc::CompositorFrame>( |
121 new cc::CompositorFrame); | 122 cc::test::MakeEmptyCompositorFrame()); |
122 compositor_frame->metadata.begin_frame_ack = cc::BeginFrameAck(0, 1, 1, true); | |
123 std::unique_ptr<cc::RenderPass> root_pass(cc::RenderPass::Create()); | 123 std::unique_ptr<cc::RenderPass> root_pass(cc::RenderPass::Create()); |
124 gfx::Rect viewport(browser_view_renderer_->size()); | 124 gfx::Rect viewport(browser_view_renderer_->size()); |
125 root_pass->SetNew(1, viewport, viewport, gfx::Transform()); | 125 root_pass->SetNew(1, viewport, viewport, gfx::Transform()); |
126 compositor_frame->render_pass_list.push_back(std::move(root_pass)); | 126 compositor_frame->render_pass_list.push_back(std::move(root_pass)); |
127 return compositor_frame; | 127 return compositor_frame; |
128 } | 128 } |
129 | 129 |
130 std::unique_ptr<cc::CompositorFrame> RenderingTest::ConstructFrame( | 130 std::unique_ptr<cc::CompositorFrame> RenderingTest::ConstructFrame( |
131 cc::ResourceId resource_id) { | 131 cc::ResourceId resource_id) { |
132 std::unique_ptr<cc::CompositorFrame> compositor_frame(ConstructEmptyFrame()); | 132 std::unique_ptr<cc::CompositorFrame> compositor_frame(ConstructEmptyFrame()); |
(...skipping 26 matching lines...) Expand all Loading... |
159 void RenderingTest::PostInvalidate() { | 159 void RenderingTest::PostInvalidate() { |
160 if (window_) | 160 if (window_) |
161 window_->PostInvalidate(); | 161 window_->PostInvalidate(); |
162 } | 162 } |
163 | 163 |
164 gfx::Point RenderingTest::GetLocationOnScreen() { | 164 gfx::Point RenderingTest::GetLocationOnScreen() { |
165 return gfx::Point(); | 165 return gfx::Point(); |
166 } | 166 } |
167 | 167 |
168 } // namespace android_webview | 168 } // namespace android_webview |
OLD | NEW |