Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1532)

Unified Diff: android_webview/browser/browser_view_renderer_unittest.cc

Issue 1002013003: Unit Test for WebView animating in and out of screen (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Test Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..c3fb219282b8e76897446ad817b72cce0aac681e 100644
--- a/android_webview/browser/browser_view_renderer_unittest.cc
+++ b/android_webview/browser/browser_view_renderer_unittest.cc
@@ -59,4 +59,36 @@ 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_++;
+
+ 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_ == 2u) {
+ EXPECT_EQ(browser_view_renderer_->parent_draw_constraints().surface_rect,
+ 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.
+ EndTest();
+ }
+ }
+
+ private:
+ size_t on_draw_count_;
+};
+
+RENDERING_TEST_F(TestForceInvalidateWithEmptyGlobalVisibleRect);
+
} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698