| 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 0e72824085ab31f68320274d98d82c9aa2079a93..20e8c2431d76293ab255247b6180a1286cf1dc9d 100644
|
| --- a/cc/trees/layer_tree_host_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_unittest.cc
|
| @@ -91,8 +91,8 @@ class LayerTreeHostTestSetNeedsCommit1 : public LayerTreeHostTest {
|
| }
|
|
|
| virtual void AfterTest() OVERRIDE {
|
| - EXPECT_GE(1, num_commits_);
|
| - EXPECT_GE(1, num_draws_);
|
| + EXPECT_LE(1, num_commits_);
|
| + EXPECT_LE(1, num_draws_);
|
| }
|
|
|
| private:
|
| @@ -694,31 +694,6 @@ class LayerTreeHostTestUndrawnLayersPushContentBoundsLater
|
| SINGLE_AND_MULTI_THREAD_TEST_F(
|
| LayerTreeHostTestUndrawnLayersPushContentBoundsLater);
|
|
|
| -class LayerTreeHostTestAbortFrameWhenInvisible : public LayerTreeHostTest {
|
| - public:
|
| - LayerTreeHostTestAbortFrameWhenInvisible() {}
|
| -
|
| - virtual void BeginTest() OVERRIDE {
|
| - // Request a commit (from the main thread), Which will trigger the commit
|
| - // flow from the impl side.
|
| - layer_tree_host()->SetNeedsCommit();
|
| - // Then mark ourselves as not visible before processing any more messages
|
| - // on the main thread.
|
| - layer_tree_host()->SetVisible(false);
|
| - // If we make it without kicking a frame, we pass!
|
| - EndTestAfterDelay(1);
|
| - }
|
| -
|
| - virtual void Layout() OVERRIDE {
|
| - ASSERT_FALSE(true);
|
| - EndTest();
|
| - }
|
| -
|
| - virtual void AfterTest() OVERRIDE {}
|
| -};
|
| -
|
| -MULTI_THREAD_TEST_F(LayerTreeHostTestAbortFrameWhenInvisible);
|
| -
|
| // This test verifies that properties on the layer tree host are commited
|
| // to the impl side.
|
| class LayerTreeHostTestCommit : public LayerTreeHostTest {
|
| @@ -4547,7 +4522,7 @@ class LayerTreeHostTestBreakSwapPromise : public LayerTreeHostTest {
|
| // TODO(miletus): Flaky test: crbug.com/393995
|
| // MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromise);
|
|
|
| -class LayerTreeHostTestBreakSwapPromiseForAbortedCommit
|
| +class LayerTreeHostTestBreakSwapPromiseForVisibilityAbortedCommit
|
| : public LayerTreeHostTest {
|
| protected:
|
| virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
| @@ -4583,7 +4558,58 @@ class LayerTreeHostTestBreakSwapPromiseForAbortedCommit
|
| TestSwapPromiseResult swap_promise_result_;
|
| };
|
|
|
| -MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromiseForAbortedCommit);
|
| +MULTI_THREAD_TEST_F(
|
| + LayerTreeHostTestBreakSwapPromiseForVisibilityAbortedCommit);
|
| +
|
| +class LayerTreeHostTestBreakSwapPromiseForContextAbortedCommit
|
| + : public LayerTreeHostTest {
|
| + protected:
|
| + virtual void BeginTest() OVERRIDE { PostSetNeedsCommitToMainThread(); }
|
| +
|
| + virtual void DidCommit() OVERRIDE {
|
| + if (TestEnded())
|
| + return;
|
| + layer_tree_host()->SetDeferCommits(true);
|
| + layer_tree_host()->SetNeedsCommit();
|
| + }
|
| +
|
| + virtual void DidDeferCommit() OVERRIDE {
|
| + layer_tree_host()->DidLoseOutputSurface();
|
| + scoped_ptr<SwapPromise> swap_promise(
|
| + new TestSwapPromise(&swap_promise_result_));
|
| + layer_tree_host()->QueueSwapPromise(swap_promise.Pass());
|
| + layer_tree_host()->SetDeferCommits(false);
|
| + }
|
| +
|
| + virtual void BeginMainFrameAbortedOnThread(LayerTreeHostImpl* host_impl,
|
| + bool did_handle) OVERRIDE {
|
| + EndTest();
|
| + // This lets the test finally commit and exit.
|
| + MainThreadTaskRunner()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(&LayerTreeHostTestBreakSwapPromiseForContextAbortedCommit::
|
| + FindOutputSurface,
|
| + base::Unretained(this)));
|
| + }
|
| +
|
| + void FindOutputSurface() {
|
| + layer_tree_host()->OnCreateAndInitializeOutputSurfaceAttempted(true);
|
| + }
|
| +
|
| + virtual void AfterTest() OVERRIDE {
|
| + {
|
| + base::AutoLock lock(swap_promise_result_.lock);
|
| + EXPECT_FALSE(swap_promise_result_.did_swap_called);
|
| + EXPECT_TRUE(swap_promise_result_.did_not_swap_called);
|
| + EXPECT_EQ(SwapPromise::COMMIT_FAILS, swap_promise_result_.reason);
|
| + EXPECT_TRUE(swap_promise_result_.dtor_called);
|
| + }
|
| + }
|
| +
|
| + TestSwapPromiseResult swap_promise_result_;
|
| +};
|
| +
|
| +MULTI_THREAD_TEST_F(LayerTreeHostTestBreakSwapPromiseForContextAbortedCommit);
|
|
|
| class SimpleSwapPromiseMonitor : public SwapPromiseMonitor {
|
| public:
|
|
|