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
;
26 struct ParentCompositorDrawConstraints
;
28 class RenderingTest
: public testing::Test
,
29 public BrowserViewRendererClient
,
32 // BrowserViewRendererClient overrides.
33 bool RequestDrawGL(bool wait_for_completion
) override
;
34 void OnNewPicture() override
;
35 void PostInvalidate() override
;
36 void DetachFunctorFromView() override
;
37 gfx::Point
GetLocationOnScreen() override
;
38 void ScrollContainerViewTo(gfx::Vector2d new_value
) override
{}
39 bool IsFlingActive() const override
;
40 void UpdateScrollState(gfx::Vector2d max_scroll_offset
,
41 gfx::SizeF contents_size_dip
,
42 float page_scale_factor
,
43 float min_page_scale_factor
,
44 float max_page_scale_factor
) override
{}
45 void DidOverscroll(gfx::Vector2d overscroll_delta
) override
{}
46 void ParentDrawConstraintsUpdated(
47 const ParentCompositorDrawConstraints
& draw_constraints
) override
{}
48 // WindowHooks overrides.
49 void WillOnDraw() override
{}
50 void DidOnDraw(bool success
) override
{}
51 void WillSyncOnRT(SharedRendererState
* functor
) override
{}
52 void DidSyncOnRT(SharedRendererState
* functor
) override
{}
53 void WillProcessOnRT(SharedRendererState
* functor
) override
{}
54 void DidProcessOnRT(SharedRendererState
* functor
) override
{}
55 bool WillDrawOnRT(SharedRendererState
* functor
,
56 AwDrawGLInfo
* draw_info
) override
;
57 void DidDrawOnRT(SharedRendererState
* functor
) override
{}
61 ~RenderingTest() override
;
63 virtual void SetUpTestHarness();
64 virtual void StartTest();
67 void InitializeCompositor();
71 scoped_refptr
<base::MessageLoopProxy
> ui_proxy_
;
72 scoped_ptr
<BrowserViewRenderer
> browser_view_renderer_
;
73 scoped_ptr
<content::TestSynchronousCompositor
> compositor_
;
74 scoped_ptr
<FakeWindow
> window_
;
77 void QuitMessageLoop();
79 const scoped_ptr
<base::MessageLoop
> message_loop_
;
81 DISALLOW_COPY_AND_ASSIGN(RenderingTest
);
84 #define RENDERING_TEST_F(TEST_FIXTURE_NAME) \
85 TEST_F(TEST_FIXTURE_NAME, RunTest) { RunTest(); } \
86 class NeedsSemicolon##TEST_FIXTURE_NAME {}
88 } // namespace android_webview
90 #endif // ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_