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_testing_mi
xin.h" | 5 #include "chrome/browser/chromeos/login/screenshot_testing/screenshot_testing_mi
xin.h" |
6 | 6 |
7 #include "chrome/browser/browser_process.h" | 7 #include "chrome/browser/browser_process.h" |
8 #include "chrome/browser/chrome_notification_types.h" | 8 #include "chrome/browser/chrome_notification_types.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/browser/notification_service.h" | 10 #include "content/public/browser/notification_service.h" |
11 #include "content/public/browser/notification_types.h" | 11 #include "content/public/browser/notification_types.h" |
12 #include "ui/compositor/compositor_switches.h" | 12 #include "ui/compositor/compositor_switches.h" |
13 | 13 |
14 namespace chromeos { | 14 namespace chromeos { |
15 | 15 |
16 ScreenshotTestingMixin::ScreenshotTestingMixin() | 16 ScreenshotTestingMixin::ScreenshotTestingMixin() |
17 : enable_test_screenshots_(false) { | 17 : enable_test_screenshots_(false) { |
18 } | 18 } |
19 | 19 |
20 ScreenshotTestingMixin::~ScreenshotTestingMixin() { | 20 ScreenshotTestingMixin::~ScreenshotTestingMixin() { |
21 } | 21 } |
22 | 22 |
23 void ScreenshotTestingMixin::SetUpInProcessBrowserTestFixture() { | 23 void ScreenshotTestingMixin::SetUpInProcessBrowserTestFixture() { |
24 enable_test_screenshots_ = screenshot_tester_.TryInitialize(); | 24 enable_test_screenshots_ = screenshot_tester_.TryInitialize(); |
25 } | 25 } |
26 | 26 |
27 void ScreenshotTestingMixin::SetUpCommandLine(base::CommandLine* command_line) { | 27 void ScreenshotTestingMixin::SetUpCommandLine(base::CommandLine* command_line) { |
28 if (enable_test_screenshots_) { | 28 if (enable_test_screenshots_) { |
29 command_line->AppendSwitch(switches::kEnablePixelOutputInTests); | 29 command_line->AppendSwitch(switches::kEnablePixelOutputInTests); |
30 } else { | 30 command_line->AppendSwitch(switches::kUIEnableImplSidePainting); |
31 command_line->AppendSwitch(switches::kUIDisableImplSidePainting); | |
32 } | 31 } |
33 } | 32 } |
34 | 33 |
35 void ScreenshotTestingMixin::RunScreenshotTesting( | 34 void ScreenshotTestingMixin::RunScreenshotTesting( |
36 const std::string& test_name) { | 35 const std::string& test_name) { |
37 if (enable_test_screenshots_) { | 36 if (enable_test_screenshots_) { |
38 SynchronizeAnimationLoadWithCompositor(); | 37 SynchronizeAnimationLoadWithCompositor(); |
39 screenshot_tester_.Run(test_name); | 38 screenshot_tester_.Run(test_name); |
40 } | 39 } |
41 } | 40 } |
(...skipping 17 matching lines...) Expand all Loading... |
59 waiter.Run(); | 58 waiter.Run(); |
60 } | 59 } |
61 | 60 |
62 void ScreenshotTestingMixin::HandleAnimationLoad() { | 61 void ScreenshotTestingMixin::HandleAnimationLoad() { |
63 timer_.Stop(); | 62 timer_.Stop(); |
64 content::BrowserThread::PostTask( | 63 content::BrowserThread::PostTask( |
65 content::BrowserThread::UI, FROM_HERE, animation_waiter_quitter_); | 64 content::BrowserThread::UI, FROM_HERE, animation_waiter_quitter_); |
66 } | 65 } |
67 | 66 |
68 } // namespace chromeos | 67 } // namespace chromeos |
OLD | NEW |