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

Side by Side Diff: chrome/browser/plugins/plugin_power_saver_browsertest.cc

Issue 1856043002: Plugin Power Saver: Rebaseline pixel tests. (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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/test/data/plugin_power_saver/large_cross_origin_obscured_expected.png » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 #include <string> 6 #include <string>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 void CompareSnapshotToReference(const base::FilePath& reference, 223 void CompareSnapshotToReference(const base::FilePath& reference,
224 bool* snapshot_matches, 224 bool* snapshot_matches,
225 const base::Closure& done_cb, 225 const base::Closure& done_cb,
226 const SkBitmap& bitmap, 226 const SkBitmap& bitmap,
227 content::ReadbackResponse response) { 227 content::ReadbackResponse response) {
228 DCHECK(snapshot_matches); 228 DCHECK(snapshot_matches);
229 ASSERT_EQ(content::READBACK_SUCCESS, response); 229 ASSERT_EQ(content::READBACK_SUCCESS, response);
230 230
231 *snapshot_matches = SnapshotMatches(reference, bitmap); 231 *snapshot_matches = SnapshotMatches(reference, bitmap);
232 232
233 // When rebaselining the pixel test, the test will fail, and we will 233 // When rebaselining the pixel test, the test may fail. However, the
234 // overwrite the reference file. On the next try through, the test will then 234 // reference file will still be overwritten.
235 // pass, since we just overwrote the reference file. A bit wonky. 235 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
236 if (!(*snapshot_matches) &&
237 base::CommandLine::ForCurrentProcess()->HasSwitch(
238 switches::kRebaselinePixelTests)) { 236 switches::kRebaselinePixelTests)) {
239 SkBitmap clipped_bitmap; 237 SkBitmap clipped_bitmap;
240 bitmap.extractSubset(&clipped_bitmap, 238 bitmap.extractSubset(&clipped_bitmap,
241 SkIRect::MakeWH(kComparisonWidth, kComparisonHeight)); 239 SkIRect::MakeWH(kComparisonWidth, kComparisonHeight));
242 std::vector<unsigned char> png_data; 240 std::vector<unsigned char> png_data;
243 ASSERT_TRUE( 241 ASSERT_TRUE(
244 gfx::PNGCodec::EncodeBGRASkBitmap(clipped_bitmap, false, &png_data)); 242 gfx::PNGCodec::EncodeBGRASkBitmap(clipped_bitmap, false, &png_data));
245 ASSERT_EQ(static_cast<int>(png_data.size()), 243 ASSERT_EQ(static_cast<int>(png_data.size()),
246 base::WriteFile(reference, 244 base::WriteFile(reference,
247 reinterpret_cast<const char*>(png_data.data()), 245 reinterpret_cast<const char*>(png_data.data()),
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 633
636 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, ZoomIndependent) { 634 IN_PROC_BROWSER_TEST_F(PluginPowerSaverBrowserTest, ZoomIndependent) {
637 ui_zoom::ZoomController::FromWebContents(GetActiveWebContents()) 635 ui_zoom::ZoomController::FromWebContents(GetActiveWebContents())
638 ->SetZoomLevel(4.0); 636 ->SetZoomLevel(4.0);
639 LoadHTML( 637 LoadHTML(
640 "<object id='plugin' data='http://otherorigin.com/fake.swf' " 638 "<object id='plugin' data='http://otherorigin.com/fake.swf' "
641 " type='application/x-ppapi-tests' width='400' height='200'>" 639 " type='application/x-ppapi-tests' width='400' height='200'>"
642 "</object>"); 640 "</object>");
643 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin"); 641 VerifyPluginIsThrottled(GetActiveWebContents(), "plugin");
644 } 642 }
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/plugin_power_saver/large_cross_origin_obscured_expected.png » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698