 Chromium Code Reviews
 Chromium Code Reviews Issue 1002013003:
  Unit Test for WebView animating in and out of screen  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master
    
  
    Issue 1002013003:
  Unit Test for WebView animating in and out of screen  (Closed) 
  Base URL: https://chromium.googlesource.com/chromium/src.git@master| 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 #include "android_webview/browser/browser_view_renderer.h" | 5 #include "android_webview/browser/browser_view_renderer.h" | 
| 6 #include "android_webview/browser/test/rendering_test.h" | 6 #include "android_webview/browser/test/rendering_test.h" | 
| 7 | 7 | 
| 8 namespace android_webview { | 8 namespace android_webview { | 
| 9 | 9 | 
| 10 class SmokeTest : public RenderingTest { | 10 class SmokeTest : public RenderingTest { | 
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 52 | 52 | 
| 53 void DidDrawOnRT(SharedRendererState* functor) override { | 53 void DidDrawOnRT(SharedRendererState* functor) override { | 
| 54 EndTest(); | 54 EndTest(); | 
| 55 } | 55 } | 
| 56 private: | 56 private: | 
| 57 size_t on_draw_count_; | 57 size_t on_draw_count_; | 
| 58 }; | 58 }; | 
| 59 | 59 | 
| 60 RENDERING_TEST_F(ClearViewTest); | 60 RENDERING_TEST_F(ClearViewTest); | 
| 61 | 61 | 
| 62 class TestForceInvalidateWithEmptyGlobalVisibleRect : public RenderingTest { | |
| 63 public: | |
| 64 TestForceInvalidateWithEmptyGlobalVisibleRect() : on_draw_count_(0u) {} | |
| 65 | |
| 66 void StartTest() override { | |
| 67 browser_view_renderer_->SetContinuousInvalidate(true); | |
| 68 } | |
| 69 | |
| 70 void WillOnDraw() override { | |
| 71 browser_view_renderer_->PrepareToDraw(gfx::Vector2d(), gfx::Rect()); | |
| 72 browser_view_renderer_->SetContinuousInvalidate(false); | |
| 73 } | |
| 74 | |
| 75 void DidOnDraw(bool success) override { | |
| 76 on_draw_count_++; | |
| 77 | |
| 78 EXPECT_TRUE(success); | |
| 79 // The second onDraw will be the result of a forced invalidation because | |
| 80 // an empty global visible rect was used in the first onDraw. | |
| 81 if (on_draw_count_ == 2u) { | |
| 82 EXPECT_EQ(browser_view_renderer_->parent_draw_constraints().surface_rect, | |
| 83 gfx::Rect(100, 100)); | |
| 
boliu
2015/03/13 14:23:05
Hmm, you need to make sure that after the first On
 
hush (inactive)
2015/03/13 17:46:53
Done.
 | |
| 84 EndTest(); | |
| 85 } | |
| 86 } | |
| 87 | |
| 88 private: | |
| 89 size_t on_draw_count_; | |
| 90 }; | |
| 91 | |
| 92 RENDERING_TEST_F(TestForceInvalidateWithEmptyGlobalVisibleRect); | |
| 93 | |
| 62 } // namespace android_webview | 94 } // namespace android_webview | 
| OLD | NEW |