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

Unified Diff: chrome/browser/chromeos/accessibility/accessibility_highlight_manager_interactive_uitest.cc

Issue 2088903002: Fix flakiness in AccessibilityHighlightManagerTest and re-enable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: AsBitmap Created 4 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/accessibility/accessibility_highlight_manager_interactive_uitest.cc
diff --git a/chrome/browser/chromeos/accessibility/accessibility_highlight_manager_interactive_uitest.cc b/chrome/browser/chromeos/accessibility/accessibility_highlight_manager_interactive_uitest.cc
index a3c16be1eb0d92e4a5e2b3b49248883cf235be57..a6f49b97f105ea3205ea5b21d66d1c8dd6e1f4e4 100644
--- a/chrome/browser/chromeos/accessibility/accessibility_highlight_manager_interactive_uitest.cc
+++ b/chrome/browser/chromeos/accessibility/accessibility_highlight_manager_interactive_uitest.cc
@@ -124,14 +124,30 @@ class AccessibilityHighlightManagerTest : public InProcessBrowserTest {
}
void Capture(const gfx::Rect& bounds) {
- aura::Window* window = ash::Shell::GetPrimaryRootWindow();
- ui::GrabWindowSnapshotAndScaleAsync(
- window, bounds, bounds.size(),
- content::BrowserThread::GetBlockingPool(),
- base::Bind(&AccessibilityHighlightManagerTest::GotSnapshot, this));
- base::RunLoop run_loop;
- run_loop_quitter_ = run_loop.QuitClosure();
- run_loop.Run();
+ // Occasionally we don't get any pixels the first try.
+ // Keep trying until we get the correct size bitmap and
+ // the first pixel is not transparent.
+ while (true) {
+ aura::Window* window = ash::Shell::GetPrimaryRootWindow();
+ ui::GrabWindowSnapshotAndScaleAsync(
+ window, bounds, bounds.size(),
+ content::BrowserThread::GetBlockingPool(),
+ base::Bind(&AccessibilityHighlightManagerTest::GotSnapshot, this));
+ base::RunLoop run_loop;
+ run_loop_quitter_ = run_loop.QuitClosure();
+ run_loop.Run();
+ SkBitmap bitmap = image_.AsBitmap();
+ SkAutoLockPixels lock(bitmap);
+ if (bitmap.width() != bounds.width() ||
+ bitmap.height() != bounds.height()) {
+ LOG(INFO) << "Bitmap not correct size, trying to capture again";
+ continue;
+ }
+ if (255 == SkColorGetA(bitmap.getColor(0, 0))) {
+ LOG(INFO) << "Bitmap is transparent, trying to capture again";
+ break;
+ }
+ }
}
base::Closure run_loop_quitter_;
@@ -144,9 +160,8 @@ class AccessibilityHighlightManagerTest : public InProcessBrowserTest {
DISALLOW_COPY_AND_ASSIGN(AccessibilityHighlightManagerTest);
};
-// Flaky. http://crbug.com/621306
IN_PROC_BROWSER_TEST_F(AccessibilityHighlightManagerTest,
- DISABLED_TestCaretRingDrawsBluePixels) {
+ TestCaretRingDrawsBluePixels) {
gfx::Rect capture_bounds(200, 300, 100, 100);
gfx::Rect caret_bounds(230, 330, 1, 25);
@@ -170,9 +185,8 @@ IN_PROC_BROWSER_TEST_F(AccessibilityHighlightManagerTest,
EXPECT_NEAR(255, SkColorGetB(average_diff_color()), 5);
}
-// Flaky. http://crbug.com/621306
IN_PROC_BROWSER_TEST_F(AccessibilityHighlightManagerTest,
- DISABLED_TestCursorRingDrawsRedPixels) {
+ TestCursorRingDrawsRedPixels) {
gfx::Rect capture_bounds(200, 300, 100, 100);
gfx::Point cursor_point(250, 350);
@@ -195,9 +209,8 @@ IN_PROC_BROWSER_TEST_F(AccessibilityHighlightManagerTest,
EXPECT_NEAR(176, SkColorGetB(average_diff_color()), 5);
}
-// Flaky. http://crbug.com/621306
IN_PROC_BROWSER_TEST_F(AccessibilityHighlightManagerTest,
- DISABLED_TestFocusRingDrawsOrangePixels) {
+ TestFocusRingDrawsOrangePixels) {
gfx::Rect capture_bounds(200, 300, 100, 100);
gfx::Rect focus_bounds(230, 330, 40, 40);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698