| 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" |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 DCHECK(browser_view_renderer_.get()); | 87 DCHECK(browser_view_renderer_.get()); |
| 88 compositor_.reset(new content::TestSynchronousCompositor(0, 0)); | 88 compositor_.reset(new content::TestSynchronousCompositor(0, 0)); |
| 89 compositor_->SetClient(browser_view_renderer_.get()); | 89 compositor_->SetClient(browser_view_renderer_.get()); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void RenderingTest::RunTest() { | 92 void RenderingTest::RunTest() { |
| 93 SetUpTestHarness(); | 93 SetUpTestHarness(); |
| 94 | 94 |
| 95 ui_task_runner_->PostTask( | 95 ui_task_runner_->PostTask( |
| 96 FROM_HERE, base::Bind(&RenderingTest::StartTest, base::Unretained(this))); | 96 FROM_HERE, base::Bind(&RenderingTest::StartTest, base::Unretained(this))); |
| 97 message_loop_->Run(); | 97 run_loop_.Run(); |
| 98 } | 98 } |
| 99 | 99 |
| 100 void RenderingTest::StartTest() { | 100 void RenderingTest::StartTest() { |
| 101 EndTest(); | 101 EndTest(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 void RenderingTest::EndTest() { | 104 void RenderingTest::EndTest() { |
| 105 ui_task_runner_->PostTask( | 105 ui_task_runner_->PostTask(FROM_HERE, run_loop_.QuitWhenIdleClosure()); |
| 106 FROM_HERE, | |
| 107 base::Bind(&RenderingTest::QuitMessageLoop, base::Unretained(this))); | |
| 108 } | |
| 109 | |
| 110 void RenderingTest::QuitMessageLoop() { | |
| 111 DCHECK_EQ(base::MessageLoop::current(), message_loop_.get()); | |
| 112 message_loop_->QuitWhenIdle(); | |
| 113 } | 106 } |
| 114 | 107 |
| 115 content::SynchronousCompositor* RenderingTest::ActiveCompositor() const { | 108 content::SynchronousCompositor* RenderingTest::ActiveCompositor() const { |
| 116 return browser_view_renderer_->GetActiveCompositorForTesting(); | 109 return browser_view_renderer_->GetActiveCompositorForTesting(); |
| 117 } | 110 } |
| 118 | 111 |
| 119 std::unique_ptr<cc::CompositorFrame> RenderingTest::ConstructEmptyFrame() { | 112 std::unique_ptr<cc::CompositorFrame> RenderingTest::ConstructEmptyFrame() { |
| 120 std::unique_ptr<cc::CompositorFrame> compositor_frame( | 113 std::unique_ptr<cc::CompositorFrame> compositor_frame( |
| 121 new cc::CompositorFrame); | 114 new cc::CompositorFrame); |
| 122 std::unique_ptr<cc::DelegatedFrameData> frame(new cc::DelegatedFrameData); | 115 std::unique_ptr<cc::DelegatedFrameData> frame(new cc::DelegatedFrameData); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 void RenderingTest::PostInvalidate() { | 154 void RenderingTest::PostInvalidate() { |
| 162 if (window_) | 155 if (window_) |
| 163 window_->PostInvalidate(); | 156 window_->PostInvalidate(); |
| 164 } | 157 } |
| 165 | 158 |
| 166 gfx::Point RenderingTest::GetLocationOnScreen() { | 159 gfx::Point RenderingTest::GetLocationOnScreen() { |
| 167 return gfx::Point(); | 160 return gfx::Point(); |
| 168 } | 161 } |
| 169 | 162 |
| 170 } // namespace android_webview | 163 } // namespace android_webview |
| OLD | NEW |