Chromium Code Reviews| Index: android_webview/browser/browser_view_renderer_unittest.cc |
| diff --git a/android_webview/browser/browser_view_renderer_unittest.cc b/android_webview/browser/browser_view_renderer_unittest.cc |
| index b4a9d42227241cef82d61d71a47608eb57d52001..f314b340b3c4e65b0ae327c52730225883484171 100644 |
| --- a/android_webview/browser/browser_view_renderer_unittest.cc |
| +++ b/android_webview/browser/browser_view_renderer_unittest.cc |
| @@ -59,4 +59,47 @@ class ClearViewTest : public RenderingTest { |
| RENDERING_TEST_F(ClearViewTest); |
| +class TestForceInvalidateWithEmptyGlobalVisibleRect : public RenderingTest { |
| + public: |
| + TestForceInvalidateWithEmptyGlobalVisibleRect() : on_draw_count_(0u) {} |
| + |
| + void StartTest() override { |
| + browser_view_renderer_->SetContinuousInvalidate(true); |
| + } |
| + |
| + void WillOnDraw() override { |
| + browser_view_renderer_->PrepareToDraw(gfx::Vector2d(), gfx::Rect()); |
| + browser_view_renderer_->SetContinuousInvalidate(false); |
| + } |
| + |
| + void DidOnDraw(bool success) override { |
| + on_draw_count_++; |
| + |
| + ParentCompositorDrawConstraints initialConstraint; |
| + ParentCompositorDrawConstraints newConstraint = |
| + ParentCompositorDrawConstraints(false, gfx::Transform(), |
| + gfx::Rect(100, 100)); |
|
boliu
2015/03/13 17:53:34
Can we get these from FakeWindow instead of hard c
hush (inactive)
2015/03/13 18:33:30
Yes. Sure.
boliu
2015/03/13 18:50:37
Ehh, get the other two as well? You can get FakeWi
|
| + EXPECT_TRUE(success); |
| + // The second onDraw will be the result of a forced invalidation because |
| + // an empty global visible rect was used in the first onDraw. |
| + if (on_draw_count_ == 1u) { |
| + EXPECT_TRUE( |
| + browser_view_renderer_->parent_draw_constraints_for_testing().Equals( |
| + initialConstraint)); |
|
boliu
2015/03/13 17:53:34
Shouldn't this be newConstraint? Then drop initial
hush (inactive)
2015/03/13 18:33:30
No. After the first onDraw, the new constraint fro
boliu
2015/03/13 18:50:37
Then test setup is still wrong, no? Test is suppos
hush (inactive)
2015/03/13 23:24:04
The test setup has some synchronization problems I
|
| + } |
| + |
| + if (on_draw_count_ == 2u) { |
| + EXPECT_TRUE( |
| + browser_view_renderer_->parent_draw_constraints_for_testing().Equals( |
| + newConstraint)); |
| + EndTest(); |
| + } |
| + } |
| + |
| + private: |
| + size_t on_draw_count_; |
| +}; |
| + |
| +RENDERING_TEST_F(TestForceInvalidateWithEmptyGlobalVisibleRect); |
| + |
| } // namespace android_webview |