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

Side by Side Diff: chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.cc

Issue 1547093002: Switch to standard integer types in chrome/browser/chromeos/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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 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 "chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h" 5 #include "chrome/browser/chromeos/login/screenshot_testing/screenshot_tester.h"
6 6
7 #include <stddef.h>
8 #include <stdint.h>
9
7 #include "ash/shell.h" 10 #include "ash/shell.h"
8 #include "base/command_line.h" 11 #include "base/command_line.h"
9 #include "base/files/file_util.h" 12 #include "base/files/file_util.h"
10 #include "chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric.h" 13 #include "chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric.h"
11 #include "chrome/browser/chromeos/login/screenshot_testing/SkImageDiffer.h" 14 #include "chrome/browser/chromeos/login/screenshot_testing/SkImageDiffer.h"
12 #include "chrome/browser/chromeos/login/screenshot_testing/SkPMetric.h" 15 #include "chrome/browser/chromeos/login/screenshot_testing/SkPMetric.h"
13 #include "chromeos/chromeos_switches.h" 16 #include "chromeos/chromeos_switches.h"
14 #include "content/public/browser/browser_thread.h" 17 #include "content/public/browser/browser_thread.h"
15 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
16 #include "third_party/skia/include/core/SkCanvas.h" 19 #include "third_party/skia/include/core/SkCanvas.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 224
222 ScreenshotTester::PNGFile ScreenshotTester::LoadGoldenScreenshot( 225 ScreenshotTester::PNGFile ScreenshotTester::LoadGoldenScreenshot(
223 base::FilePath image_path) { 226 base::FilePath image_path) {
224 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 227 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
225 228
226 if (!base::PathExists(image_path)) { 229 if (!base::PathExists(image_path)) {
227 LOG(WARNING) << "Can't find a golden screenshot for this test"; 230 LOG(WARNING) << "Can't find a golden screenshot for this test";
228 return 0; 231 return 0;
229 } 232 }
230 233
231 int64 golden_screenshot_size; 234 int64_t golden_screenshot_size;
232 base::GetFileSize(image_path, &golden_screenshot_size); 235 base::GetFileSize(image_path, &golden_screenshot_size);
233 236
234 if (golden_screenshot_size == -1) { 237 if (golden_screenshot_size == -1) {
235 CHECK(false) << "Can't get golden screenshot size"; 238 CHECK(false) << "Can't get golden screenshot size";
236 } 239 }
237 PNGFile png_data = new base::RefCountedBytes; 240 PNGFile png_data = new base::RefCountedBytes;
238 png_data->data().resize(golden_screenshot_size); 241 png_data->data().resize(golden_screenshot_size);
239 base::ReadFile(image_path, 242 base::ReadFile(image_path,
240 reinterpret_cast<char*>(&(png_data->data()[0])), 243 reinterpret_cast<char*>(&(png_data->data()[0])),
241 golden_screenshot_size); 244 golden_screenshot_size);
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 346
344 ScreenshotTester::Result testing_result; 347 ScreenshotTester::Result testing_result;
345 testing_result.similarity = result.result; 348 testing_result.similarity = result.result;
346 testing_result.screenshots_match = 349 testing_result.screenshots_match =
347 (result.result == SkImageDiffer::RESULT_CORRECT); 350 (result.result == SkImageDiffer::RESULT_CORRECT);
348 351
349 return testing_result; 352 return testing_result;
350 } 353 }
351 354
352 } // namespace chromeos 355 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698