Skip to content

Commit

Permalink
Wait for animation in OcclusionTest
Browse files Browse the repository at this point in the history
Bug: None
Test: It's more stable.
Change-Id: I1eff3f46b36bc1336512d81af4c4a7e2a900f929
Reviewed-on: https://chromium-review.googlesource.com/c/1398309
Commit-Queue: Mitsuru Oshima <oshima@chromium.org>
Reviewed-by: Sammie Quon <sammiequon@chromium.org>
Cr-Commit-Position: refs/heads/master@{#620436}
  • Loading branch information
mitoshima authored and Commit Bot committed Jan 7, 2019
1 parent 632a026 commit 22fb1b3
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ash/wm/overview/window_selector_controller_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ void WaitForOcclusionStateChange(aura::Window* window) {
base::RunLoop().RunUntilIdle();
}

void WaitForShowAnimation(aura::Window* window) {
while (window->layer()->opacity() != 1.f)
base::RunLoop().RunUntilIdle();
}

} // namespace

using WindowSelectorControllerTest = AshTestBase;
Expand Down Expand Up @@ -263,6 +268,11 @@ TEST_F(WindowSelectorControllerTest, OcclusionTest) {
CreateTestWindowInShellWithBounds(bounds));
std::unique_ptr<aura::Window> window2(
CreateTestWindowInShellWithBounds(bounds));
// Wait for show/hide animation because occlusion tracker because
// the test depends on opacity.
WaitForShowAnimation(window1.get());
WaitForShowAnimation(window2.get());

window1->TrackOcclusionState();
window2->TrackOcclusionState();
EXPECT_EQ(OcclusionState::OCCLUDED, window1->occlusion_state());
Expand Down

0 comments on commit 22fb1b3

Please sign in to comment.