| 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 f32d0d8b36ed6b498c8d75eb3e1748ea61dd9dfe..7f3cf1b4f2bdd692e8e32100a271a15c07da972f 100644
|
| --- a/cc/trees/layer_tree_host_unittest.cc
|
| +++ b/cc/trees/layer_tree_host_unittest.cc
|
| @@ -2578,6 +2578,18 @@ class LayerTreeHostTestAsyncReadback : public LayerTreeHostTest {
|
| }
|
|
|
| virtual void DidCommitAndDrawFrame() {
|
| + WaitForCallback();
|
| + }
|
| +
|
| + void WaitForCallback() {
|
| + base::MessageLoop::current()->PostTask(
|
| + FROM_HERE,
|
| + base::Bind(
|
| + &LayerTreeHostTestAsyncReadback::NextStep,
|
| + base::Unretained(this)));
|
| + }
|
| +
|
| + void NextStep() {
|
| int frame = layer_tree_host()->commit_number();
|
| switch (frame) {
|
| case 1:
|
| @@ -2587,11 +2599,11 @@ class LayerTreeHostTestAsyncReadback : public LayerTreeHostTest {
|
| EXPECT_EQ(0u, callbacks_.size());
|
| break;
|
| case 2:
|
| - // Flush the message loops and make sure the callbacks run.
|
| - layer_tree_host()->SetNeedsCommit();
|
| - break;
|
| - case 3:
|
| - ASSERT_EQ(1u, callbacks_.size());
|
| + if (callbacks_.size() < 1u) {
|
| + WaitForCallback();
|
| + return;
|
| + }
|
| + EXPECT_EQ(1u, callbacks_.size());
|
| EXPECT_EQ(gfx::Size(10, 10).ToString(), callbacks_[0].ToString());
|
|
|
| child->RequestCopyAsBitmap(base::Bind(
|
| @@ -2605,12 +2617,12 @@ class LayerTreeHostTestAsyncReadback : public LayerTreeHostTest {
|
| base::Unretained(this)));
|
| EXPECT_EQ(1u, callbacks_.size());
|
| break;
|
| - case 4:
|
| - // Flush the message loops and make sure the callbacks run.
|
| - layer_tree_host()->SetNeedsCommit();
|
| - break;
|
| - case 5:
|
| - ASSERT_EQ(4u, callbacks_.size());
|
| + case 3:
|
| + if (callbacks_.size() < 4u) {
|
| + WaitForCallback();
|
| + return;
|
| + }
|
| + EXPECT_EQ(4u, callbacks_.size());
|
| // The child was copied to a bitmap and passed back twice.
|
| EXPECT_EQ(gfx::Size(10, 10).ToString(), callbacks_[1].ToString());
|
| EXPECT_EQ(gfx::Size(10, 10).ToString(), callbacks_[2].ToString());
|
| @@ -2627,7 +2639,9 @@ class LayerTreeHostTestAsyncReadback : public LayerTreeHostTest {
|
| callbacks_.push_back(gfx::Size(bitmap->width(), bitmap->height()));
|
| }
|
|
|
| - virtual void AfterTest() {}
|
| + virtual void AfterTest() {
|
| + EXPECT_EQ(4u, callbacks_.size());
|
| + }
|
|
|
| virtual scoped_ptr<OutputSurface> CreateOutputSurface() OVERRIDE {
|
| if (use_gl_renderer_)
|
|
|