| 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 "android_webview/browser/browser_view_renderer.h" | 7 #include "android_webview/browser/browser_view_renderer.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "content/public/test/test_synchronous_compositor_android.h" | 9 #include "content/public/test/test_synchronous_compositor_android.h" |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 } | 28 } |
| 29 | 29 |
| 30 void RenderingTest::InitializeCompositor() { | 30 void RenderingTest::InitializeCompositor() { |
| 31 DCHECK(!compositor_.get()); | 31 DCHECK(!compositor_.get()); |
| 32 DCHECK(browser_view_renderer_.get()); | 32 DCHECK(browser_view_renderer_.get()); |
| 33 compositor_.reset(new content::TestSynchronousCompositor); | 33 compositor_.reset(new content::TestSynchronousCompositor); |
| 34 compositor_->SetClient(browser_view_renderer_.get()); | 34 compositor_->SetClient(browser_view_renderer_.get()); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void RenderingTest::Attach() { | 37 void RenderingTest::Attach() { |
| 38 window_.reset( | 38 window_.reset(new FakeWindow(browser_view_renderer_.get(), this, |
| 39 new FakeWindow(browser_view_renderer_.get(), this, gfx::Rect(100, 100))); | 39 gfx::Rect(100, 100), false)); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void RenderingTest::RunTest() { | 42 void RenderingTest::RunTest() { |
| 43 SetUpTestHarness(); | 43 SetUpTestHarness(); |
| 44 | 44 |
| 45 ui_proxy_->PostTask( | 45 ui_proxy_->PostTask( |
| 46 FROM_HERE, base::Bind(&RenderingTest::StartTest, base::Unretained(this))); | 46 FROM_HERE, base::Bind(&RenderingTest::StartTest, base::Unretained(this))); |
| 47 message_loop_->Run(); | 47 message_loop_->Run(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void RenderingTest::StartTest() { | 50 void RenderingTest::StartTest() { |
| 51 EndTest(); | 51 EndTest(); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void RenderingTest::EndTest() { | 54 void RenderingTest::EndTest() { |
| 55 ui_proxy_->PostTask(FROM_HERE, base::Bind(&RenderingTest::QuitMessageLoop, | 55 ui_proxy_->PostTask(FROM_HERE, base::Bind(&RenderingTest::QuitMessageLoop, |
| 56 base::Unretained(this))); | 56 base::Unretained(this))); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void RenderingTest::QuitMessageLoop() { | 59 void RenderingTest::QuitMessageLoop() { |
| 60 DCHECK_EQ(base::MessageLoop::current(), message_loop_.get()); | 60 DCHECK_EQ(base::MessageLoop::current(), message_loop_.get()); |
| 61 message_loop_->QuitWhenIdle(); | 61 message_loop_->QuitWhenIdle(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 bool RenderingTest::RequestDrawGL(bool wait_for_completion) { | 64 bool RenderingTest::RequestDrawGL(bool wait_for_completion) { |
| 65 window_->RequestDrawGL(wait_for_completion); | 65 window_->RequestDrawGL(wait_for_completion); |
| 66 return true; | 66 return true; |
| 67 } | 67 } |
| 68 | 68 |
| 69 void RenderingTest::SetParentDrawConstraints(AwDrawGLInfo& draw_info) { |
| 70 draw_info.width = window_->surface_size().width(); |
| 71 draw_info.height = window_->surface_size().height(); |
| 72 draw_info.is_layer = false; |
| 73 gfx::Transform transform; |
| 74 transform.matrix().asColMajorf(draw_info.transform); |
| 75 } |
| 76 |
| 77 bool RenderingTest::WillWaitForModeDrawToFinish() { |
| 78 return false; |
| 79 } |
| 80 bool RenderingTest::WillDrawOnRT(SharedRendererState* functor) { |
| 81 return true; |
| 82 } |
| 83 |
| 69 void RenderingTest::OnNewPicture() { | 84 void RenderingTest::OnNewPicture() { |
| 70 } | 85 } |
| 71 | 86 |
| 72 void RenderingTest::PostInvalidate() { | 87 void RenderingTest::PostInvalidate() { |
| 73 window_->PostInvalidate(); | 88 window_->PostInvalidate(); |
| 74 } | 89 } |
| 75 | 90 |
| 76 void RenderingTest::DetachFunctorFromView() { | 91 void RenderingTest::DetachFunctorFromView() { |
| 77 } | 92 } |
| 78 | 93 |
| 79 gfx::Point RenderingTest::GetLocationOnScreen() { | 94 gfx::Point RenderingTest::GetLocationOnScreen() { |
| 80 return gfx::Point(); | 95 return gfx::Point(); |
| 81 } | 96 } |
| 82 | 97 |
| 83 bool RenderingTest::IsFlingActive() const { | 98 bool RenderingTest::IsFlingActive() const { |
| 84 return false; | 99 return false; |
| 85 } | 100 } |
| 86 | 101 |
| 87 } // namespace android_webview | 102 } // namespace android_webview |
| OLD | NEW |