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 #ifndef ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_
6 #define ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_
8 #include "android_webview/browser/browser_view_renderer_client.h"
9 #include "android_webview/browser/test/fake_window.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop_proxy.h"
12 #include "testing/gtest/include/gtest/gtest.h"
19 class TestSynchronousCompositor
;
22 namespace android_webview
{
24 class BrowserViewRenderer
;
27 class RenderingTest
: public testing::Test
,
28 public BrowserViewRendererClient
,
31 // BrowserViewRendererClient overrides.
32 bool RequestDrawGL(bool wait_for_completion
) override
;
33 void OnNewPicture() override
;
34 void PostInvalidate() override
;
35 void DetachFunctorFromView() override
;
36 gfx::Point
GetLocationOnScreen() override
;
37 void ScrollContainerViewTo(gfx::Vector2d new_value
) override
{}
38 bool IsFlingActive() const override
;
39 void UpdateScrollState(gfx::Vector2d max_scroll_offset
,
40 gfx::SizeF contents_size_dip
,
41 float page_scale_factor
,
42 float min_page_scale_factor
,
43 float max_page_scale_factor
) override
{}
44 void DidOverscroll(gfx::Vector2d overscroll_delta
) override
{}
46 // WindowHooks overrides.
47 void WillOnDraw() override
{}
48 void DidOnDraw(bool success
) override
{}
49 void WillSyncOnRT(SharedRendererState
* functor
) override
{}
50 void DidSyncOnRT(SharedRendererState
* functor
) override
{}
51 void WillProcessOnRT(SharedRendererState
* functor
) override
{}
52 void DidProcessOnRT(SharedRendererState
* functor
) override
{}
53 void WillDrawOnRT(SharedRendererState
* functor
) override
{}
54 void DidDrawOnRT(SharedRendererState
* functor
) override
{}
58 ~RenderingTest() override
;
60 virtual void SetUpTestHarness();
61 virtual void StartTest();
64 void InitializeCompositor();
68 scoped_refptr
<base::MessageLoopProxy
> ui_proxy_
;
69 scoped_ptr
<BrowserViewRenderer
> browser_view_renderer_
;
70 scoped_ptr
<content::TestSynchronousCompositor
> compositor_
;
71 scoped_ptr
<FakeWindow
> window_
;
74 void QuitMessageLoop();
76 const scoped_ptr
<base::MessageLoop
> message_loop_
;
78 DISALLOW_COPY_AND_ASSIGN(RenderingTest
);
81 #define RENDERING_TEST_F(TEST_FIXTURE_NAME) \
82 TEST_F(TEST_FIXTURE_NAME, RunTest) { RunTest(); } \
83 class NeedsSemicolon##TEST_FIXTURE_NAME {}
85 } // namespace android_webview
87 #endif // ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_