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
3 // found in the LICENSE file.
5 #include "android_webview/browser/test/rendering_test.h"
7 #include "android_webview/browser/browser_view_renderer.h"
8 #include "base/message_loop/message_loop.h"
9 #include "content/public/test/test_synchronous_compositor_android.h"
11 namespace android_webview
{
13 RenderingTest::RenderingTest() : message_loop_(new base::MessageLoop
) {
14 ui_proxy_
= base::MessageLoopProxy::current();
17 RenderingTest::~RenderingTest() {
22 void RenderingTest::SetUpTestHarness() {
23 DCHECK(!browser_view_renderer_
.get());
24 browser_view_renderer_
.reset(
25 new BrowserViewRenderer(this, base::MessageLoopProxy::current()));
26 InitializeCompositor();
30 void RenderingTest::InitializeCompositor() {
31 DCHECK(!compositor_
.get());
32 DCHECK(browser_view_renderer_
.get());
33 compositor_
.reset(new content::TestSynchronousCompositor
);
34 compositor_
->SetClient(browser_view_renderer_
.get());
37 void RenderingTest::Attach() {
39 new FakeWindow(browser_view_renderer_
.get(), this, gfx::Rect(100, 100)));
42 void RenderingTest::RunTest() {
46 FROM_HERE
, base::Bind(&RenderingTest::StartTest
, base::Unretained(this)));
50 void RenderingTest::StartTest() {
54 void RenderingTest::EndTest() {
55 ui_proxy_
->PostTask(FROM_HERE
, base::Bind(&RenderingTest::QuitMessageLoop
,
56 base::Unretained(this)));
59 void RenderingTest::QuitMessageLoop() {
60 DCHECK_EQ(base::MessageLoop::current(), message_loop_
.get());
61 message_loop_
->QuitWhenIdle();
64 bool RenderingTest::RequestDrawGL(bool wait_for_completion
) {
65 window_
->RequestDrawGL(wait_for_completion
);
69 void RenderingTest::OnNewPicture() {
72 void RenderingTest::PostInvalidate() {
73 window_
->PostInvalidate();
76 void RenderingTest::DetachFunctorFromView() {
79 gfx::Point
RenderingTest::GetLocationOnScreen() {
83 bool RenderingTest::IsFlingActive() const {
87 } // namespace android_webview