| 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 #ifndef ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "android_webview/browser/browser_view_renderer_client.h" | 10 #include "android_webview/browser/browser_view_renderer_client.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 class CompositorFrame; | 22 class CompositorFrame; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace content { | 25 namespace content { |
| 26 class TestSynchronousCompositor; | 26 class TestSynchronousCompositor; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace android_webview { | 29 namespace android_webview { |
| 30 | 30 |
| 31 class BrowserViewRenderer; | 31 class BrowserViewRenderer; |
| 32 class CompositorFrameConsumer; |
| 33 class CompositorFrameProducer; |
| 32 class FakeWindow; | 34 class FakeWindow; |
| 33 struct ParentCompositorDrawConstraints; | 35 struct ParentCompositorDrawConstraints; |
| 34 | 36 |
| 35 class RenderingTest : public testing::Test, | 37 class RenderingTest : public testing::Test, |
| 36 public BrowserViewRendererClient, | 38 public BrowserViewRendererClient, |
| 37 public RenderThreadManagerClient, | 39 public RenderThreadManagerClient, |
| 38 public WindowHooks { | 40 public WindowHooks { |
| 39 public: | 41 public: |
| 40 // BrowserViewRendererClient overrides. | 42 // BrowserViewRendererClient overrides. |
| 41 void OnNewPicture() override; | 43 void OnNewPicture() override; |
| 42 void PostInvalidate() override; | 44 void PostInvalidate() override; |
| 43 gfx::Point GetLocationOnScreen() override; | 45 gfx::Point GetLocationOnScreen() override; |
| 44 void ScrollContainerViewTo(const gfx::Vector2d& new_value) override {} | 46 void ScrollContainerViewTo(const gfx::Vector2d& new_value) override {} |
| 45 void UpdateScrollState(const gfx::Vector2d& max_scroll_offset, | 47 void UpdateScrollState(const gfx::Vector2d& max_scroll_offset, |
| 46 const gfx::SizeF& contents_size_dip, | 48 const gfx::SizeF& contents_size_dip, |
| 47 float page_scale_factor, | 49 float page_scale_factor, |
| 48 float min_page_scale_factor, | 50 float min_page_scale_factor, |
| 49 float max_page_scale_factor) override {} | 51 float max_page_scale_factor) override {} |
| 50 void DidOverscroll(const gfx::Vector2d& overscroll_delta, | 52 void DidOverscroll(const gfx::Vector2d& overscroll_delta, |
| 51 const gfx::Vector2dF& overscroll_velocity) override {} | 53 const gfx::Vector2dF& overscroll_velocity) override {} |
| 52 | 54 |
| 53 // RenderThreadManagerClient overrides. | 55 // RenderThreadManagerClient overrides. |
| 54 void OnParentDrawConstraintsUpdated() override; | |
| 55 bool RequestInvokeGL(bool wait_for_completion) override; | 56 bool RequestInvokeGL(bool wait_for_completion) override; |
| 56 void DetachFunctorFromView() override; | 57 void DetachFunctorFromView() override; |
| 57 | 58 |
| 58 // WindowHooks overrides. | 59 // WindowHooks overrides. |
| 59 void WillOnDraw() override; | 60 void WillOnDraw() override; |
| 60 void DidOnDraw(bool success) override {} | 61 void DidOnDraw(bool success) override {} |
| 61 void WillSyncOnRT(RenderThreadManager* functor) override {} | 62 void WillSyncOnRT(RenderThreadManager* functor) override {} |
| 62 void DidSyncOnRT(RenderThreadManager* functor) override {} | 63 void DidSyncOnRT(RenderThreadManager* functor) override {} |
| 63 void WillProcessOnRT(RenderThreadManager* functor) override {} | 64 void WillProcessOnRT(RenderThreadManager* functor) override {} |
| 64 void DidProcessOnRT(RenderThreadManager* functor) override {} | 65 void DidProcessOnRT(RenderThreadManager* functor) override {} |
| 65 bool WillDrawOnRT(RenderThreadManager* functor, | 66 bool WillDrawOnRT(RenderThreadManager* functor, |
| 66 AwDrawGLInfo* draw_info) override; | 67 AwDrawGLInfo* draw_info) override; |
| 67 void DidDrawOnRT(RenderThreadManager* functor) override {} | 68 void DidDrawOnRT(RenderThreadManager* functor) override {} |
| 68 | 69 |
| 70 virtual void OnParentDrawConstraintsUpdated() {} |
| 71 |
| 69 protected: | 72 protected: |
| 70 | 73 |
| 71 RenderingTest(); | 74 RenderingTest(); |
| 72 ~RenderingTest() override; | 75 ~RenderingTest() override; |
| 73 | 76 |
| 77 CompositorFrameConsumer* GetCompositorFrameConsumer(); |
| 78 CompositorFrameProducer* GetCompositorFrameProducer(); |
| 79 |
| 74 virtual void SetUpTestHarness(); | 80 virtual void SetUpTestHarness(); |
| 75 virtual void StartTest(); | 81 virtual void StartTest(); |
| 76 | 82 |
| 77 void RunTest(); | 83 void RunTest(); |
| 78 void InitializeCompositor(); | 84 void InitializeCompositor(); |
| 79 void Attach(); | 85 void Attach(); |
| 80 void EndTest(); | 86 void EndTest(); |
| 81 std::unique_ptr<cc::CompositorFrame> ConstructEmptyFrame(); | 87 std::unique_ptr<cc::CompositorFrame> ConstructEmptyFrame(); |
| 82 | 88 |
| 83 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 89 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 94 DISALLOW_COPY_AND_ASSIGN(RenderingTest); | 100 DISALLOW_COPY_AND_ASSIGN(RenderingTest); |
| 95 }; | 101 }; |
| 96 | 102 |
| 97 #define RENDERING_TEST_F(TEST_FIXTURE_NAME) \ | 103 #define RENDERING_TEST_F(TEST_FIXTURE_NAME) \ |
| 98 TEST_F(TEST_FIXTURE_NAME, RunTest) { RunTest(); } \ | 104 TEST_F(TEST_FIXTURE_NAME, RunTest) { RunTest(); } \ |
| 99 class NeedsSemicolon##TEST_FIXTURE_NAME {} | 105 class NeedsSemicolon##TEST_FIXTURE_NAME {} |
| 100 | 106 |
| 101 } // namespace android_webview | 107 } // namespace android_webview |
| 102 | 108 |
| 103 #endif // ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ | 109 #endif // ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ |
| OLD | NEW |