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 "android_webview/browser/browser_view_renderer_client.h" | 8 #include "android_webview/browser/browser_view_renderer_client.h" |
| 9 #include "android_webview/browser/test/fake_view_root_impl.h" | |
| 9 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/message_loop/message_loop_proxy.h" | |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 13 |
| 12 namespace base { | 14 namespace base { |
| 13 class MessageLoop; | 15 class MessageLoop; |
| 14 } | 16 } |
| 15 | 17 |
| 16 namespace content { | 18 namespace content { |
| 17 class TestSynchronousCompositor; | 19 class TestSynchronousCompositor; |
| 18 } | 20 } |
| 19 | 21 |
| 20 namespace android_webview { | 22 namespace android_webview { |
| 21 | 23 |
| 22 class BrowserViewRenderer; | 24 class BrowserViewRenderer; |
| 25 class FakeViewRootImpl; | |
| 23 | 26 |
| 24 class RenderingTest : public testing::Test, public BrowserViewRendererClient { | 27 class RenderingTest : public testing::Test, |
| 28 public BrowserViewRendererClient, | |
| 29 public ViewRootHooks { | |
| 25 public: | 30 public: |
| 26 // BrowserViewRendererClient overrides. | 31 // BrowserViewRendererClient overrides. |
| 27 bool RequestDrawGL(bool wait_for_completion) override; | 32 bool RequestDrawGL(bool wait_for_completion) override; |
| 28 void OnNewPicture() override; | 33 void OnNewPicture() override; |
| 29 void PostInvalidate() override; | 34 void PostInvalidate() override; |
| 30 void InvalidateOnFunctorDestroy() override; | 35 void InvalidateOnFunctorDestroy() override; |
| 31 gfx::Point GetLocationOnScreen() override; | 36 gfx::Point GetLocationOnScreen() override; |
| 32 void ScrollContainerViewTo(gfx::Vector2d new_value) override {} | 37 void ScrollContainerViewTo(gfx::Vector2d new_value) override {} |
| 33 bool IsFlingActive() const override; | 38 bool IsFlingActive() const override; |
| 34 void UpdateScrollState(gfx::Vector2d max_scroll_offset, | 39 void UpdateScrollState(gfx::Vector2d max_scroll_offset, |
| 35 gfx::SizeF contents_size_dip, | 40 gfx::SizeF contents_size_dip, |
| 36 float page_scale_factor, | 41 float page_scale_factor, |
| 37 float min_page_scale_factor, | 42 float min_page_scale_factor, |
| 38 float max_page_scale_factor) override {} | 43 float max_page_scale_factor) override {} |
| 39 void DidOverscroll(gfx::Vector2d overscroll_delta) override {} | 44 void DidOverscroll(gfx::Vector2d overscroll_delta) override {} |
| 40 | 45 |
| 46 // ViewRootHooks overrides. | |
| 47 void WillOnDraw() override {} | |
| 48 void DidOnDraw() 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 {} | |
| 55 | |
| 41 protected: | 56 protected: |
| 42 RenderingTest(); | 57 RenderingTest(); |
| 43 ~RenderingTest() override; | 58 ~RenderingTest() override; |
| 44 | 59 |
| 45 void SetUpTestHarness(); | 60 virtual void SetUpTestHarness(); |
| 61 virtual void StartTest(); | |
| 62 | |
| 46 void RunTest(); | 63 void RunTest(); |
| 47 | 64 void InitializeCompositor(); |
| 48 virtual void StartTest() {} | 65 void Attach(); |
| 66 void EndTest(); | |
| 49 | 67 |
| 50 private: | 68 private: |
|
hush (inactive)
2014/12/10 20:07:58
you have multiple "protected" and "private" sectio
boliu
2014/12/10 21:30:32
Style guide agrees with you: http://google-stylegu
| |
| 51 class ScopedInitializeCompositor; | 69 void QuitMessageLoop(); |
| 52 void InitializeCompositor(); | |
| 53 void TeardownCompositor(); | |
| 54 | 70 |
| 55 const scoped_ptr<base::MessageLoop> message_loop_; | 71 const scoped_ptr<base::MessageLoop> message_loop_; |
| 72 | |
| 73 protected: | |
| 74 scoped_refptr<base::MessageLoopProxy> ui_proxy_; | |
| 75 scoped_ptr<BrowserViewRenderer> browser_view_renderer_; | |
| 56 scoped_ptr<content::TestSynchronousCompositor> compositor_; | 76 scoped_ptr<content::TestSynchronousCompositor> compositor_; |
| 57 scoped_ptr<BrowserViewRenderer> browser_view_renderer_; | 77 scoped_ptr<FakeViewRootImpl> view_root_impl_; |
| 58 | 78 |
| 79 private: | |
| 59 DISALLOW_COPY_AND_ASSIGN(RenderingTest); | 80 DISALLOW_COPY_AND_ASSIGN(RenderingTest); |
| 60 }; | 81 }; |
| 61 | 82 |
| 83 #define RENDERING_TEST_F(TEST_FIXTURE_NAME) \ | |
| 84 TEST_F(TEST_FIXTURE_NAME, RunTest) { \ | |
| 85 RunTest(); \ | |
| 86 } \ | |
| 87 class NeedsSemicolon##TEST_FIXTURE_NAME {}\ | |
| 88 | |
| 62 } // namespace android_webview | 89 } // namespace android_webview |
| 63 | 90 |
| 64 #endif // ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ | 91 #endif // ANDROID_WEBVIEW_BROWSER_TEST_RENDERING_TEST_H_ |
| OLD | NEW |