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

Unified Diff: cc/test/layer_tree_pixel_test.cc

Issue 14060015: cc: Async readback. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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/layer_tree_pixel_test.h ('k') | cc/test/pixel_test.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/layer_tree_pixel_test.cc
diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc
index 34a0f8d0375efbcc2a633df1ac4afc847b82ed71..1dfc551c5358361979dfc4a13fadf5b34fa4ca0e 100644
--- a/cc/test/layer_tree_pixel_test.cc
+++ b/cc/test/layer_tree_pixel_test.cc
@@ -47,35 +47,25 @@ LayerTreePixelTest::OffscreenContextProviderForCompositorThread() {
return provider;
}
-void LayerTreePixelTest::SwapBuffersOnThread(LayerTreeHostImpl* host_impl,
- bool result) {
- EXPECT_TRUE(result);
-
- gfx::Rect device_viewport_rect(
- host_impl->active_tree()->device_viewport_size());
-
- SkBitmap bitmap;
- bitmap.setConfig(SkBitmap::kARGB_8888_Config,
- device_viewport_rect.width(),
- device_viewport_rect.height());
- bitmap.allocPixels();
- unsigned char* pixels = static_cast<unsigned char*>(bitmap.getPixels());
- host_impl->Readback(pixels, device_viewport_rect);
+void LayerTreePixelTest::ReadbackResult(scoped_ptr<SkBitmap> bitmap) {
+ ASSERT_TRUE(bitmap);
base::FilePath test_data_dir;
EXPECT_TRUE(PathService::Get(cc::DIR_TEST_DATA, &test_data_dir));
// To rebaseline:
- // EXPECT_TRUE(WritePNGFile(bitmap, test_data_dir.Append(ref_file_), true));
+ // EXPECT_TRUE(WritePNGFile(*bitmap, test_data_dir.Append(ref_file_), true));
- EXPECT_TRUE(MatchesPNGFile(bitmap,
+ EXPECT_TRUE(MatchesPNGFile(*bitmap,
test_data_dir.Append(ref_file_),
*pixel_comparator_));
-
EndTest();
}
void LayerTreePixelTest::BeginTest() {
+ layer_tree_host()->root_layer()->RequestCopyAsBitmap(
+ base::Bind(&LayerTreePixelTest::ReadbackResult,
+ base::Unretained(this)));
PostSetNeedsCommitToMainThread();
}
« no previous file with comments | « cc/test/layer_tree_pixel_test.h ('k') | cc/test/pixel_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698