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

Unified Diff: chrome/browser/plugins/plugin_power_saver_browsertest.cc

Issue 1863483004: Plugin Power Saver: Update pixel test tolerance and error behavior. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 | « 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/plugins/plugin_power_saver_browsertest.cc
diff --git a/chrome/browser/plugins/plugin_power_saver_browsertest.cc b/chrome/browser/plugins/plugin_power_saver_browsertest.cc
index 7353640ad01f9ce8846f5cd371808001d47f8b54..baa9e8633663da1ff0b1924919e47dc142a0e460 100644
--- a/chrome/browser/plugins/plugin_power_saver_browsertest.cc
+++ b/chrome/browser/plugins/plugin_power_saver_browsertest.cc
@@ -52,7 +52,7 @@ const int kComparisonHeight = 600;
// Different platforms have slightly different pixel output, due to different
// graphics implementations. Slightly different pixels (in BGR space) are still
// counted as a matching pixel by this simple manhattan distance threshold.
-const int kPixelManhattanDistanceTolerance = 20;
+const int kPixelManhattanDistanceTolerance = 25;
std::string RunTestScript(base::StringPiece test_script,
content::WebContents* contents,
@@ -190,10 +190,10 @@ bool SnapshotMatches(const base::FilePath& reference, const SkBitmap& bitmap) {
SkAutoLockPixels lock_image(bitmap);
int32_t* pixels = static_cast<int32_t*>(bitmap.getPixels());
- int stride = bitmap.rowBytes();
+ bool success = true;
for (int y = 0; y < kComparisonHeight; ++y) {
for (int x = 0; x < kComparisonWidth; ++x) {
- int32_t pixel = pixels[y * stride / sizeof(int32_t) + x];
+ int32_t pixel = pixels[y * bitmap.rowBytes() / sizeof(int32_t) + x];
int pixel_b = pixel & 0xFF;
int pixel_g = (pixel >> 8) & 0xFF;
int pixel_r = (pixel >> 16) & 0xFF;
@@ -210,12 +210,12 @@ bool SnapshotMatches(const base::FilePath& reference, const SkBitmap& bitmap) {
if (manhattan_distance > kPixelManhattanDistanceTolerance) {
ADD_FAILURE() << "Pixel test failed on (" << x << ", " << y << "). " <<
"Pixel manhattan distance: " << manhattan_distance << ".";
- return false;
+ success = false;
}
}
}
- return true;
+ return success;
}
// |snapshot_matches| is set to true if the snapshot matches the reference and
« 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