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

Side by Side Diff: chrome/browser/chromeos/accessibility/accessibility_highlight_manager_interactive_uitest.cc

Issue 2855503003: Replace uses of legacy SkBitmap::copyTo() API (Closed)
Patch Set: Fix paren errors Created 3 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2016 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 "chrome/browser/chromeos/accessibility/accessibility_highlight_manager. h" 5 #include "chrome/browser/chromeos/accessibility/accessibility_highlight_manager. h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/run_loop.h" 10 #include "base/run_loop.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 AccessibilityFocusRingController::GetInstance()->SetNoFadeForTesting(); 74 AccessibilityFocusRingController::GetInstance()->SetNoFadeForTesting();
75 InProcessBrowserTest::SetUp(); 75 InProcessBrowserTest::SetUp();
76 } 76 }
77 77
78 void SetUpCommandLine(base::CommandLine* command_line) override { 78 void SetUpCommandLine(base::CommandLine* command_line) override {
79 command_line->AppendSwitch(::switches::kEnablePixelOutputInTests); 79 command_line->AppendSwitch(::switches::kEnablePixelOutputInTests);
80 } 80 }
81 81
82 void CaptureBeforeImage(const gfx::Rect& bounds) { 82 void CaptureBeforeImage(const gfx::Rect& bounds) {
83 Capture(bounds); 83 Capture(bounds);
84 image_.AsBitmap().deepCopyTo(&before_bmp_); 84 image_.asLegacyBitmap(&before_bmp_, SkImage::kRW_LegacyBitmapMode);
f(malita) 2017/05/01 18:00:06 asLegacyBitmap() doesn't copy the pixels for raste
msarett1 2017/05/01 18:04:55 I think that using kRW_LegacyBitmapMode will force
f(malita) 2017/05/01 18:36:01 Ah yeah, indeed. It does feel a bit fragile/incid
msarett1 2017/05/01 19:53:50 Agreed, yeah it is. I've changed the impl to allo
85 } 85 }
86 86
87 void CaptureAfterImage(const gfx::Rect& bounds) { 87 void CaptureAfterImage(const gfx::Rect& bounds) {
88 Capture(bounds); 88 Capture(bounds);
89 image_.AsBitmap().deepCopyTo(&after_bmp_); 89 image_.asLegacyBitmap(&after_bmp_, SkImage::kRW_LegacyBitmapMode);
f(malita) 2017/05/01 18:00:06 Ditto.
90 } 90 }
91 91
92 void ComputeImageStats() { 92 void ComputeImageStats() {
93 diff_count_ = 0; 93 diff_count_ = 0;
94 double accum[4] = {0, 0, 0, 0}; 94 double accum[4] = {0, 0, 0, 0};
95 for (int x = 0; x < before_bmp_.width(); ++x) { 95 for (int x = 0; x < before_bmp_.width(); ++x) {
96 for (int y = 0; y < before_bmp_.height(); ++y) { 96 for (int y = 0; y < before_bmp_.height(); ++y) {
97 SkColor before_color = before_bmp_.getColor(x, y); 97 SkColor before_color = before_bmp_.getColor(x, y);
98 SkColor after_color = after_bmp_.getColor(x, y); 98 SkColor after_color = after_bmp_.getColor(x, y);
99 if (before_color != after_color) { 99 if (before_color != after_color) {
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 // This is a smoke test to assert that something is drawn in the right 227 // This is a smoke test to assert that something is drawn in the right
228 // part of the screen of approximately the right size and color. 228 // part of the screen of approximately the right size and color.
229 // There's deliberately some tolerance for tiny errors. 229 // There's deliberately some tolerance for tiny errors.
230 EXPECT_NEAR(1608, diff_count(), 50); 230 EXPECT_NEAR(1608, diff_count(), 50);
231 EXPECT_NEAR(255, SkColorGetR(average_diff_color()), 5); 231 EXPECT_NEAR(255, SkColorGetR(average_diff_color()), 5);
232 EXPECT_NEAR(201, SkColorGetG(average_diff_color()), 5); 232 EXPECT_NEAR(201, SkColorGetG(average_diff_color()), 5);
233 EXPECT_NEAR(152, SkColorGetB(average_diff_color()), 5); 233 EXPECT_NEAR(152, SkColorGetB(average_diff_color()), 5);
234 } 234 }
235 235
236 } // namespace chromeos 236 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698