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

Side by Side Diff: chrome/browser/ui/fullscreen/flash_fullscreen_interactive_browsertest.cc

Issue 593503003: Support error handling for Surface readbacks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Formatted code and fixed build issue in test. Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/bind_helpers.h" 6 #include "base/bind_helpers.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/time/time.h" 9 #include "base/time/time.h"
10 #include "chrome/browser/ui/browser.h" 10 #include "chrome/browser/ui/browser.h"
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 base::MessageLoop::QuitClosure()), 233 base::MessageLoop::QuitClosure()),
234 kN32_SkColorType); 234 kN32_SkColorType);
235 content::RunMessageLoop(); 235 content::RunMessageLoop();
236 236
237 return is_expected_color; 237 return is_expected_color;
238 } 238 }
239 239
240 static void CheckBitmapForFillColor(SkColor expected_color, 240 static void CheckBitmapForFillColor(SkColor expected_color,
241 bool* is_expected_color, 241 bool* is_expected_color,
242 const base::Closure& done_cb, 242 const base::Closure& done_cb,
243 bool success, 243 const SkBitmap& bitmap,
244 const SkBitmap& bitmap) { 244 content::ReadbackResponse response) {
245 if (success) { 245 if (response == content::READBACK_SUCCESS) {
246 SkAutoLockPixels lock_pixels(bitmap); 246 SkAutoLockPixels lock_pixels(bitmap);
247 if (bitmap.width() > 0 && bitmap.height() > 0) 247 if (bitmap.width() > 0 && bitmap.height() > 0)
248 *is_expected_color = (bitmap.getColor(0, 0) == expected_color); 248 *is_expected_color = (bitmap.getColor(0, 0) == expected_color);
249 } 249 }
250 done_cb.Run(); 250 done_cb.Run();
251 } 251 }
252 252
253 DISALLOW_COPY_AND_ASSIGN(FlashFullscreenInteractiveBrowserTest); 253 DISALLOW_COPY_AND_ASSIGN(FlashFullscreenInteractiveBrowserTest);
254 }; 254 };
255 255
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorRED)); 339 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorRED));
340 PressSpacebar(); 340 PressSpacebar();
341 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorBLUE)); 341 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorBLUE));
342 342
343 // Test that the Escape key is handled as an exit fullscreen command while the 343 // Test that the Escape key is handled as an exit fullscreen command while the
344 // Flash widget has the focus. 344 // Flash widget has the focus.
345 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true)); 345 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true));
346 PressEscape(); 346 PressEscape();
347 EXPECT_TRUE(ObserveTabIsInFullscreen(false)); 347 EXPECT_TRUE(ObserveTabIsInFullscreen(false));
348 } 348 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698