Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Unified Diff: cc/trees/layer_tree_host_unittest.cc

Issue 14273026: cc: Make async readback path use async glRreadPixels. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: forlanding Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/test_web_graphics_context_3d.cc ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 08c2228824e15426031c95e3a11fbe6c95ea2551..172f003f7ca147fdfd4e22a7949bf289ed9fdf7c 100644
--- a/cc/trees/layer_tree_host_unittest.cc
+++ b/cc/trees/layer_tree_host_unittest.cc
@@ -2583,6 +2583,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:
@@ -2592,11 +2604,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(
@@ -2610,12 +2622,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());
@@ -2632,7 +2644,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_)
« no previous file with comments | « cc/test/test_web_graphics_context_3d.cc ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698