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

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 732503005: cc: Unflake and re-enable the new pinch zoom unit tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/trees/layer_tree_host_unittest.cc
diff --git a/cc/trees/layer_tree_host_unittest.cc b/cc/trees/layer_tree_host_unittest.cc
index 3ef592338fa1467cc8b3e27c763f764914028b43..d1e9bbd3d7eead156e0a32b20c28422f126cd6ab 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -5391,10 +5391,6 @@ class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest {
LayerTreeHostTestCrispUpAfterPinchEnds()
: playback_allowed_event_(true, true) {}
- void InitializeSettings(LayerTreeSettings* settings) override {
- settings->impl_side_painting = true;
- }
-
void SetupTree() override {
frame_ = 1;
posted_ = false;
@@ -5461,31 +5457,38 @@ class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest {
PostNextAfterDraw(host_impl);
break;
case 2:
+ // Wait for any activations that need to occur due to starting a pinch,
+ // and drawing with a non-identity transform (for eg. LCD text being
+ // disabled).
+ if (host_impl->pending_tree())
+ break;
if (quad_scale_delta != 1.f)
break;
- // Drew at page scale 2.2 after pinching in.
- EXPECT_EQ(2.2f, host_impl->active_tree()->total_page_scale_factor());
+ // Drew at page scale 1.5 after pinching in.
+ EXPECT_EQ(1.5f, host_impl->active_tree()->total_page_scale_factor());
EXPECT_EQ(1.f, quad_scale_delta);
PostNextAfterDraw(host_impl);
break;
case 3:
- if (quad_scale_delta != 2.2f)
+ // By pinching out, we will create a new tiling and raster it. This may
+ // cause some additional draws, though we should still be drawing with
+ // the old 1.5 tiling.
+ if (frame_data->has_no_damage)
break;
- // Drew at page scale 1 with the 2.2 tiling while pinching out.
+ // Drew at page scale 1 with the 1.5 tiling while pinching out.
EXPECT_EQ(1.f, host_impl->active_tree()->total_page_scale_factor());
- EXPECT_EQ(2.2f, quad_scale_delta);
- PostNextAfterDraw(host_impl);
+ EXPECT_EQ(1.5f, quad_scale_delta);
+ // We don't PostNextAfterDraw here, instead we wait for the new tiling
+ // to finish rastering so we don't get any noise in further steps.
break;
case 4:
- // Drew at page scale 1 with the 2.2 tiling after pinching out completed
+ // Drew at page scale 1 with the 1.5 tiling after pinching out completed
// while waiting for texture uploads to complete.
EXPECT_EQ(1.f, host_impl->active_tree()->total_page_scale_factor());
- // This frame will not have any damage, since it's actually the same as
danakj 2014/11/14 21:17:32 oops this comment should stay now. fixed.
- // the last frame, and should contain no incomplete tiles. We just want
- // to make sure we drew here at least once after the pinch ended to be
- // sure that drawing after pinch doesn't leave us at the wrong scale
- // forever.
EXPECT_TRUE(frame_data->has_no_damage);
+ // We want to make sure we drew here at least once after the pinch ended
+ // to be sure that drawing after pinch doesn't leave us at the wrong
+ // scale forever.
PostNextAfterDraw(host_impl);
break;
case 5:
@@ -5510,7 +5513,7 @@ class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest {
// Use a delay to allow raster/upload to happen in between frames. This
// should cause flakiness if we fail to block raster/upload when
// desired.
- base::TimeDelta::FromMilliseconds(16 * 6));
+ base::TimeDelta::FromMilliseconds(16 * 4));
}
void Next(LayerTreeHostImpl* host_impl) {
@@ -5520,11 +5523,12 @@ class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest {
case 2:
// Pinch zoom in.
host_impl->PinchGestureBegin();
- host_impl->PinchGestureUpdate(2.2f, gfx::Point(100, 100));
+ host_impl->PinchGestureUpdate(1.5f, gfx::Point(100, 100));
host_impl->PinchGestureEnd();
break;
case 3:
- // Pinch zoom back to 1.f but don't end it.
+ // Pinch zoom back to 1.f but don't end it, keep track of the tiles that
+ // are rastered.
host_impl->PinchGestureBegin();
host_impl->PinchGestureUpdate(1.f / 2.2f, gfx::Point(100, 100));
break;
@@ -5542,11 +5546,17 @@ class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest {
void NotifyTileStateChangedOnThread(LayerTreeHostImpl* host_impl,
const Tile* tile) override {
+ if (frame_ == 3) {
+ // On frame 3, we will have a low res tile complete for the pinch-out
+ // gesture even though it's not displayed. We wait for it here to prevent
+ // flakiness.
+ PostNextAfterDraw(host_impl);
+ }
// On frame_ == 4, we are preventing texture uploads from completing,
// so this verifies they are not completing before frame_ == 5.
// Flaky failures here indicate we're failing to prevent uploads from
// completing.
- EXPECT_NE(4, frame_);
+ EXPECT_NE(4, frame_) << tile->contents_scale();
}
void AfterTest() override {}
@@ -5557,14 +5567,12 @@ class LayerTreeHostTestCrispUpAfterPinchEnds : public LayerTreeHostTest {
base::WaitableEvent playback_allowed_event_;
};
-// TODO(danakj): Disabled for flake: crbug.com/433208
-// MULTI_THREAD_TEST_F(LayerTreeHostTestCrispUpAfterPinchEnds);
+MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestCrispUpAfterPinchEnds);
class LayerTreeHostTestCrispUpAfterPinchEndsWithOneCopy
: public LayerTreeHostTestCrispUpAfterPinchEnds {
protected:
void InitializeSettings(LayerTreeSettings* settings) override {
- settings->impl_side_painting = true;
settings->use_one_copy = true;
}
@@ -5582,7 +5590,7 @@ class LayerTreeHostTestCrispUpAfterPinchEndsWithOneCopy
}
};
-MULTI_THREAD_TEST_F(LayerTreeHostTestCrispUpAfterPinchEndsWithOneCopy);
+MULTI_THREAD_IMPL_TEST_F(LayerTreeHostTestCrispUpAfterPinchEndsWithOneCopy);
class LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles
: public LayerTreeHostTest {
@@ -5597,6 +5605,7 @@ class LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles
void SetupTree() override {
step_ = 1;
continuous_draws_ = 0;
+ expect_draw_ = false;
client_.set_fill_with_nonsolid_color(true);
scoped_refptr<Layer> root = Layer::Create();
@@ -5684,10 +5693,15 @@ class LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles
++step_;
break;
case 5:
+ // We may get another draw if we activate due to the pinch (eg LCD text
+ // gets disabled).
+ if (expect_draw_)
+ break;
ADD_FAILURE()
<< "No draws should happen once we have a complete frame.";
break;
}
+ expect_draw_ = false;
return draw_result;
}
@@ -5717,6 +5731,10 @@ class LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles
}
}
+ void WillActivateTreeOnThread(LayerTreeHostImpl* host_impl) override {
+ expect_draw_ = true;
+ }
+
void NotifyTileStateChangedOnThread(LayerTreeHostImpl* host_impl,
const Tile* tile) override {
// On step_ == 2, we are preventing texture uploads from completing,
@@ -5731,6 +5749,7 @@ class LayerTreeHostTestContinuousDrawWhenCreatingVisibleTiles
FakeContentLayerClient client_;
int step_;
int continuous_draws_;
+ bool expect_draw_;
base::WaitableEvent playback_allowed_event_;
};
« no previous file with comments | « cc/trees/layer_tree_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698