Chromium Code Reviews| 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 20 matching lines...) Expand all Loading... | |
| 31 | 31 |
| 32 class BrowserViewRenderer; | 32 class BrowserViewRenderer; |
| 33 class CompositorFrameConsumer; | 33 class CompositorFrameConsumer; |
| 34 class CompositorFrameProducer; | 34 class CompositorFrameProducer; |
| 35 class FakeWindow; | 35 class FakeWindow; |
| 36 class RenderThreadManager; | 36 class RenderThreadManager; |
| 37 struct ParentCompositorDrawConstraints; | 37 struct ParentCompositorDrawConstraints; |
| 38 | 38 |
| 39 class RenderingTest : public testing::Test, | 39 class RenderingTest : public testing::Test, |
| 40 public BrowserViewRendererClient, | 40 public BrowserViewRendererClient, |
| 41 public RenderThreadManagerClient, | |
| 42 public WindowHooks { | 41 public WindowHooks { |
| 43 public: | 42 public: |
| 44 // BrowserViewRendererClient overrides. | 43 // BrowserViewRendererClient overrides. |
| 45 void OnNewPicture() override; | 44 void OnNewPicture() override; |
| 46 void PostInvalidate() override; | 45 void PostInvalidate() override; |
| 47 gfx::Point GetLocationOnScreen() override; | 46 gfx::Point GetLocationOnScreen() override; |
| 48 void ScrollContainerViewTo(const gfx::Vector2d& new_value) override {} | 47 void ScrollContainerViewTo(const gfx::Vector2d& new_value) override {} |
| 49 void UpdateScrollState(const gfx::Vector2d& max_scroll_offset, | 48 void UpdateScrollState(const gfx::Vector2d& max_scroll_offset, |
| 50 const gfx::SizeF& contents_size_dip, | 49 const gfx::SizeF& contents_size_dip, |
| 51 float page_scale_factor, | 50 float page_scale_factor, |
| 52 float min_page_scale_factor, | 51 float min_page_scale_factor, |
| 53 float max_page_scale_factor) override {} | 52 float max_page_scale_factor) override {} |
| 54 void DidOverscroll(const gfx::Vector2d& overscroll_delta, | 53 void DidOverscroll(const gfx::Vector2d& overscroll_delta, |
| 55 const gfx::Vector2dF& overscroll_velocity) override {} | 54 const gfx::Vector2dF& overscroll_velocity) override {} |
| 56 | 55 |
| 57 // RenderThreadManagerClient overrides. | |
| 58 bool RequestInvokeGL(bool wait_for_completion) override; | |
| 59 void DetachFunctorFromView() override; | |
| 60 | |
| 61 // WindowHooks overrides. | 56 // WindowHooks overrides. |
| 62 void WillOnDraw() override; | 57 void WillOnDraw() override; |
| 63 void DidOnDraw(bool success) override {} | 58 void DidOnDraw(bool success) override {} |
| 64 void WillSyncOnRT() override {} | 59 void WillSyncOnRT() override {} |
| 65 void DidSyncOnRT() override {} | 60 void DidSyncOnRT() override {} |
| 66 void WillProcessOnRT() override {} | 61 void WillProcessOnRT() override {} |
| 67 void DidProcessOnRT() override {} | 62 void DidProcessOnRT() override {} |
| 68 bool WillDrawOnRT(AwDrawGLInfo* draw_info) override; | 63 bool WillDrawOnRT(AwDrawGLInfo* draw_info) override; |
| 69 void DidDrawOnRT() override {} | 64 void DidDrawOnRT() override {} |
| 70 | 65 |
| 71 virtual void OnParentDrawConstraintsUpdated() {} | 66 virtual void OnParentDrawConstraintsUpdated() {} |
| 72 | 67 |
| 68 virtual RenderThreadManager* CreateRenderThreadManager( | |
|
boliu
2016/05/10 15:18:20
return unique_ptr to imply passing ownership
Tobias Sargeant
2016/05/13 13:23:57
Removed; don't need the factory any more.
| |
| 69 RenderThreadManagerClient* client); | |
| 70 | |
| 73 protected: | 71 protected: |
| 74 | 72 |
| 75 RenderingTest(); | 73 RenderingTest(); |
| 76 ~RenderingTest() override; | 74 ~RenderingTest() override; |
| 77 | 75 |
| 78 CompositorFrameConsumer* GetCompositorFrameConsumer(); | 76 CompositorFrameConsumer* GetCompositorFrameConsumer(); |
| 79 CompositorFrameProducer* GetCompositorFrameProducer(); | 77 CompositorFrameProducer* GetCompositorFrameProducer(); |
| 80 | 78 |
| 81 virtual void SetUpTestHarness(); | 79 virtual void SetUpTestHarness(); |
| 82 virtual void StartTest(); | 80 virtual void StartTest(); |
| 83 | 81 |
| 84 void RunTest(); | 82 void RunTest(); |
| 85 void InitializeCompositor(); | 83 void InitializeCompositor(); |
| 86 void Attach(); | 84 void Attach(); |
| 87 void EndTest(); | 85 void EndTest(); |
| 88 std::unique_ptr<cc::CompositorFrame> ConstructEmptyFrame(); | 86 std::unique_ptr<cc::CompositorFrame> ConstructEmptyFrame(); |
| 89 std::unique_ptr<cc::CompositorFrame> ConstructFrame( | 87 std::unique_ptr<cc::CompositorFrame> ConstructFrame( |
| 90 cc::ResourceId resource_id); | 88 cc::ResourceId resource_id); |
| 91 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; | 89 scoped_refptr<base::SingleThreadTaskRunner> ui_task_runner_; |
| 92 std::unique_ptr<FakeWindow> window_; | 90 std::unique_ptr<FakeWindow> window_; |
| 93 std::unique_ptr<RenderThreadManager> render_thread_manager_; | 91 std::unique_ptr<Functor> functor_; |
| 94 std::unique_ptr<BrowserViewRenderer> browser_view_renderer_; | 92 std::unique_ptr<BrowserViewRenderer> browser_view_renderer_; |
| 95 std::unique_ptr<content::TestSynchronousCompositor> compositor_; | 93 std::unique_ptr<content::TestSynchronousCompositor> compositor_; |
| 96 | 94 |
| 97 private: | 95 private: |
| 98 void QuitMessageLoop(); | 96 void QuitMessageLoop(); |
| 99 | 97 |
| 100 void DrawGL(AwDrawGLInfo* aw_draw_gl_info); | 98 void DrawGL(AwDrawGLInfo* aw_draw_gl_info); |
| 101 | 99 |
| 102 const std::unique_ptr<base::MessageLoop> message_loop_; | 100 const std::unique_ptr<base::MessageLoop> message_loop_; |
| 103 | 101 |
| 104 DISALLOW_COPY_AND_ASSIGN(RenderingTest); | 102 DISALLOW_COPY_AND_ASSIGN(RenderingTest); |
| 105 }; | 103 }; |
| 106 | 104 |
| 107 #define RENDERING_TEST_F(TEST_FIXTURE_NAME) \ | 105 #define RENDERING_TEST_F(TEST_FIXTURE_NAME) \ |
| 108 TEST_F(TEST_FIXTURE_NAME, RunTest) { RunTest(); } \ | 106 TEST_F(TEST_FIXTURE_NAME, RunTest) { RunTest(); } \ |
| 109 class NeedsSemicolon##TEST_FIXTURE_NAME {} | 107 class NeedsSemicolon##TEST_FIXTURE_NAME {} |
| 110 | 108 |
| 111 } // namespace android_webview | 109 } // namespace android_webview |
| 112 | 110 |
| 113 #endif // ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ | 111 #endif // ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ |
| OLD | NEW |