Commit a3a61ad3 authored by enne@chromium.org's avatar enne@chromium.org

cc: Add separate test for context-related commit aborting

This small patch is just some layer tree host test changes from
https://codereview.chromium.org/134623005/ split out.  These are
useful even without those changes, so can land separately.

R=danakj@chromium.org
BUG=none

Review URL: https://codereview.chromium.org/475533004

Cr-Commit-Position: refs/heads/master@{#289507}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289507 0039d316-1c4b-4281-b951-d872f2087c98
parent 1f328c46
......@@ -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:
......
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