Index: cc/test/pixel_test.cc |
diff --git a/cc/test/pixel_test.cc b/cc/test/pixel_test.cc |
index 5976ae350db3ecc0af2c04beec660f975b531050..8f9489cf11b7c943d414529e263c9e0e9c4eaa8c 100644 |
--- a/cc/test/pixel_test.cc |
+++ b/cc/test/pixel_test.cc |
@@ -5,6 +5,7 @@ |
#include "cc/test/pixel_test.h" |
#include "base/path_service.h" |
+#include "base/run_loop.h" |
#include "cc/output/compositor_frame_metadata.h" |
#include "cc/output/gl_renderer.h" |
#include "cc/output/output_surface.h" |
@@ -80,19 +81,27 @@ void PixelTest::SetUp() { |
bool PixelTest::RunPixelTest(RenderPassList* pass_list, |
const base::FilePath& ref_file, |
const PixelComparator& comparator) { |
+ base::RunLoop run_loop; |
+ |
pass_list->back()->copy_callbacks.push_back( |
- base::Bind(&PixelTest::ReadbackResult, base::Unretained(this))); |
+ base::Bind(&PixelTest::ReadbackResult, |
+ base::Unretained(this), |
+ run_loop.QuitClosure())); |
renderer_->DecideRenderPassAllocationsForFrame(*pass_list); |
renderer_->DrawFrame(pass_list); |
- // TODO(danakj): When the glReadPixels is async, wait for it to finish. |
+ // Wait for the readback to complete. |
+ output_surface_->context3d()->finish(); |
+ run_loop.Run(); |
return PixelsMatchReference(ref_file, comparator); |
} |
-void PixelTest::ReadbackResult(scoped_ptr<SkBitmap> bitmap) { |
+void PixelTest::ReadbackResult(base::Closure quit_run_loop, |
+ scoped_ptr<SkBitmap> bitmap) { |
result_bitmap_ = bitmap.Pass(); |
+ quit_run_loop.Run(); |
} |
bool PixelTest::PixelsMatchReference(const base::FilePath& ref_file, |