| 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 command_line->AppendSwitch(switches::kUIEnableImplSidePainting); | 30 } else { |
| 31 command_line->AppendSwitch(switches::kUIDisableImplSidePainting); |
| 31 } | 32 } |
| 32 } | 33 } |
| 33 | 34 |
| 34 void ScreenshotTestingMixin::RunScreenshotTesting( | 35 void ScreenshotTestingMixin::RunScreenshotTesting( |
| 35 const std::string& test_name) { | 36 const std::string& test_name) { |
| 36 if (enable_test_screenshots_) { | 37 if (enable_test_screenshots_) { |
| 37 SynchronizeAnimationLoadWithCompositor(); | 38 SynchronizeAnimationLoadWithCompositor(); |
| 38 screenshot_tester_.Run(test_name); | 39 screenshot_tester_.Run(test_name); |
| 39 } | 40 } |
| 40 } | 41 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 58 waiter.Run(); | 59 waiter.Run(); |
| 59 } | 60 } |
| 60 | 61 |
| 61 void ScreenshotTestingMixin::HandleAnimationLoad() { | 62 void ScreenshotTestingMixin::HandleAnimationLoad() { |
| 62 timer_.Stop(); | 63 timer_.Stop(); |
| 63 content::BrowserThread::PostTask( | 64 content::BrowserThread::PostTask( |
| 64 content::BrowserThread::UI, FROM_HERE, animation_waiter_quitter_); | 65 content::BrowserThread::UI, FROM_HERE, animation_waiter_quitter_); |
| 65 } | 66 } |
| 66 | 67 |
| 67 } // namespace chromeos | 68 } // namespace chromeos |
| OLD | NEW |