Commit 5cd409f7 authored by Bo Liu's avatar Bo Liu Committed by Commit Bot

cc: Deflake LayerTreeHostTestNoDamageCausesNoInvalidate

This became flaky after
https://chromium-review.googlesource.com/c/chromium/src/+/1986934

Using frame number to track the draw progress in a test is no longer
valid since it is possible to two commits and activations to happen
without a invalidate/draw. Use a separate count to keep track of
no-damage invalidates.

Bug: 1025695
Change-Id: I511a5af56373c417ee25ccd3bdf3eca67dc92f15
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2014981Reviewed-by: default avatardanakj <danakj@chromium.org>
Commit-Queue: Bo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734118}
parent 7d78f486
...@@ -1372,30 +1372,31 @@ class LayerTreeHostTestNoDamageCausesNoInvalidate : public LayerTreeHostTest { ...@@ -1372,30 +1372,31 @@ class LayerTreeHostTestNoDamageCausesNoInvalidate : public LayerTreeHostTest {
break; break;
case 2: case 2:
EndTest(); EndTest();
break;
} }
} }
void DidInvalidateLayerTreeFrameSink(LayerTreeHostImpl* impl) override { void DidInvalidateLayerTreeFrameSink(LayerTreeHostImpl* impl) override {
switch (impl->active_tree()->source_frame_number()) { int source_frame_number = impl->active_tree()->source_frame_number();
if (source_frame_number == 0) {
// Be sure that invalidates happen before commits, so the below failure // Be sure that invalidates happen before commits, so the below failure
// works. // works.
case 0:
first_frame_invalidate_before_commit_ = true; first_frame_invalidate_before_commit_ = true;
break; } else if (source_frame_number > 0) {
// Frame 1 will invalidate, even though it has no damage. The early // The first frame (frame number 0) has damage because it's the first
// damage check that prevents frame 2 from invalidating only runs if // frame. All subsequent frames in this test are set up to have no damage.
// a previous frame did not have damage. // The early damage check will prevent further invalidates without damage
// after 2 consecutive invalidates without damage. So check there is no
// This frame should not cause an invalidate, since there is no visible // more than 2.
// damage. invalidate_without_damage_count_++;
case 2: EXPECT_LT(invalidate_without_damage_count_, 2);
ADD_FAILURE();
} }
} }
private: private:
scoped_refptr<Layer> layer_; scoped_refptr<Layer> layer_;
bool first_frame_invalidate_before_commit_ = false; bool first_frame_invalidate_before_commit_ = false;
int invalidate_without_damage_count_ = 0;
}; };
// This behavior is specific to Android WebView, which only uses // This behavior is specific to Android WebView, which only uses
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment