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

Unified Diff: content/common/gpu/client/gl_helper_unittest.cc

Issue 133813003: Add Async API unittests to readback format. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changes done as per review comments. Created 6 years, 11 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 | « content/common/gpu/client/gl_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/client/gl_helper_unittest.cc
diff --git a/content/common/gpu/client/gl_helper_unittest.cc b/content/common/gpu/client/gl_helper_unittest.cc
index 55d5bbddbed2acc94df910f238efc84807fec825..68484972dfc934c4b3b1fc85f7231361c6eb2819 100644
--- a/content/common/gpu/client/gl_helper_unittest.cc
+++ b/content/common/gpu/client/gl_helper_unittest.cc
@@ -908,7 +908,8 @@ class GLHelperTest : public testing::Test {
// Test basic format readback.
bool TestTextureFormatReadback(const gfx::Size& src_size,
- SkBitmap::Config bitmap_config) {
+ SkBitmap::Config bitmap_config,
+ bool readback_async) {
DCHECK((bitmap_config == SkBitmap::kRGB_565_Config) ||
(bitmap_config == SkBitmap::kARGB_8888_Config));
bool rgb565_format = (bitmap_config == SkBitmap::kRGB_565_Config);
@@ -948,10 +949,21 @@ class GLHelperTest : public testing::Test {
// When the readback is over output bitmap should have the red color.
output_pixels.eraseColor(SK_ColorGREEN);
uint8* pixels = static_cast<uint8*>(output_pixels.getPixels());
- helper_->ReadbackTextureSync(src_texture,
- gfx::Rect(src_size),
- pixels,
- bitmap_config);
+ if (readback_async) {
+ base::RunLoop run_loop;
+ helper_->ReadbackTextureAsync(src_texture,
+ src_size,
+ pixels,
+ bitmap_config,
+ base::Bind(&callcallback,
+ run_loop.QuitClosure()));
+ run_loop.Run();
+ } else {
+ helper_->ReadbackTextureSync(src_texture,
+ gfx::Rect(src_size),
+ pixels,
+ bitmap_config);
+ }
bool result = IsEqual(input_pixels, output_pixels);
if (!result) {
LOG(ERROR) << "Bitmap comparision failure";
@@ -1339,17 +1351,35 @@ class GLHelperTest : public testing::Test {
std::deque<GLHelperScaling::ScaleOp> x_ops_, y_ops_;
};
-TEST_F(GLHelperTest, RGBAReadBackTest) {
+TEST_F(GLHelperTest, ARGBSyncReadbackTest) {
+ const int kTestSize = 64;
+ bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize),
+ SkBitmap::kARGB_8888_Config,
+ false);
+ EXPECT_EQ(result, true);
+}
+
+TEST_F(GLHelperTest, RGB565SyncReadbackTest) {
+ const int kTestSize = 64;
+ bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize),
+ SkBitmap::kRGB_565_Config,
+ false);
+ EXPECT_EQ(result, true);
+}
+
+TEST_F(GLHelperTest, ARGBASyncReadbackTest) {
const int kTestSize = 64;
bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize),
- SkBitmap::kARGB_8888_Config);
+ SkBitmap::kARGB_8888_Config,
+ true);
EXPECT_EQ(result, true);
}
-TEST_F(GLHelperTest, RGB565ReadBackTest) {
+TEST_F(GLHelperTest, RGB565ASyncReadbackTest) {
const int kTestSize = 64;
bool result = TestTextureFormatReadback(gfx::Size(kTestSize,kTestSize),
- SkBitmap::kRGB_565_Config);
+ SkBitmap::kRGB_565_Config,
+ true);
EXPECT_EQ(result, true);
}
« no previous file with comments | « content/common/gpu/client/gl_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698