OLD | NEW |
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 "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric.h" | 10 #include "chrome/browser/chromeos/login/screenshot_testing/SkDiffPixelsMetric.h" |
(...skipping 30 matching lines...) Expand all Loading... |
41 ScreenshotTester::~ScreenshotTester() { | 41 ScreenshotTester::~ScreenshotTester() { |
42 } | 42 } |
43 | 43 |
44 ScreenshotTester::Result::Result() { | 44 ScreenshotTester::Result::Result() { |
45 } | 45 } |
46 | 46 |
47 ScreenshotTester::Result::~Result() { | 47 ScreenshotTester::Result::~Result() { |
48 } | 48 } |
49 | 49 |
50 bool ScreenshotTester::TryInitialize() { | 50 bool ScreenshotTester::TryInitialize() { |
51 CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 51 base::CommandLine& command_line = *base::CommandLine::ForCurrentProcess(); |
52 if (!command_line.HasSwitch(switches::kEnableScreenshotTestingWithMode)) | 52 if (!command_line.HasSwitch(switches::kEnableScreenshotTestingWithMode)) |
53 return false; | 53 return false; |
54 | 54 |
55 std::string mode = command_line.GetSwitchValueASCII( | 55 std::string mode = command_line.GetSwitchValueASCII( |
56 switches::kEnableScreenshotTestingWithMode); | 56 switches::kEnableScreenshotTestingWithMode); |
57 CHECK(mode == kUpdateMode || mode == kTestMode || mode == kPdiffTestMode) | 57 CHECK(mode == kUpdateMode || mode == kTestMode || mode == kPdiffTestMode) |
58 << "Invalid mode for screenshot testing: " << mode; | 58 << "Invalid mode for screenshot testing: " << mode; |
59 | 59 |
60 CHECK(command_line.HasSwitch(chromeos::switches::kGoldenScreenshotsDir)) | 60 CHECK(command_line.HasSwitch(chromeos::switches::kGoldenScreenshotsDir)) |
61 << "No directory with golden screenshots specified, use " | 61 << "No directory with golden screenshots specified, use " |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 | 343 |
344 ScreenshotTester::Result testing_result; | 344 ScreenshotTester::Result testing_result; |
345 testing_result.similarity = result.result; | 345 testing_result.similarity = result.result; |
346 testing_result.screenshots_match = | 346 testing_result.screenshots_match = |
347 (result.result == SkImageDiffer::RESULT_CORRECT); | 347 (result.result == SkImageDiffer::RESULT_CORRECT); |
348 | 348 |
349 return testing_result; | 349 return testing_result; |
350 } | 350 } |
351 | 351 |
352 } // namespace chromeos | 352 } // namespace chromeos |
OLD | NEW |