Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / android_webview / browser / test / rendering_test.h
blobb3cdb4c6e14798a3b40d7285664351d14f375921
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/single_thread_task_runner.h"
12 #include "testing/gtest/include/gtest/gtest.h"
14 namespace base {
15 class MessageLoop;
18 namespace content {
19 class TestSynchronousCompositor;
22 namespace android_webview {
24 class BrowserViewRenderer;
25 class FakeWindow;
26 struct ParentCompositorDrawConstraints;
28 class RenderingTest : public testing::Test,
29 public BrowserViewRendererClient,
30 public WindowHooks {
31 public:
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 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,
45 gfx::Vector2dF overscroll_velocity) 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 {}
59 protected:
60 RenderingTest();
61 ~RenderingTest() override;
63 virtual void SetUpTestHarness();
64 virtual void StartTest();
66 void RunTest();
67 void InitializeCompositor();
68 void Attach();
69 void EndTest();
71 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_;
72 scoped_ptr<BrowserViewRenderer> browser_view_renderer_;
73 scoped_ptr<content::TestSynchronousCompositor> compositor_;
74 scoped_ptr<FakeWindow> window_;
76 private:
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_