| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ui/ash/screenshot_taker.h" | 5 #include "chrome/browser/ui/ash/screenshot_taker.h" |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 class ScreenshotTakerTest : public AshTestBase, | 30 class ScreenshotTakerTest : public AshTestBase, |
| 31 public ScreenshotTakerObserver { | 31 public ScreenshotTakerObserver { |
| 32 public: | 32 public: |
| 33 ScreenshotTakerTest() | 33 ScreenshotTakerTest() |
| 34 : running_(false), | 34 : running_(false), |
| 35 screenshot_complete_(false), | 35 screenshot_complete_(false), |
| 36 screenshot_result_(ScreenshotTakerObserver::SCREENSHOT_SUCCESS) { | 36 screenshot_result_(ScreenshotTakerObserver::SCREENSHOT_SUCCESS) { |
| 37 } | 37 } |
| 38 | 38 |
| 39 virtual void SetUp() { | 39 void SetUp() override { AshTestBase::SetUp(); } |
| 40 AshTestBase::SetUp(); | |
| 41 } | |
| 42 | 40 |
| 43 virtual void TearDown() { | 41 void TearDown() override { |
| 44 RunAllPendingInMessageLoop(); | 42 RunAllPendingInMessageLoop(); |
| 45 AshTestBase::TearDown(); | 43 AshTestBase::TearDown(); |
| 46 } | 44 } |
| 47 | 45 |
| 48 // Overridden from ScreenshotTakerObserver | 46 // Overridden from ScreenshotTakerObserver |
| 49 virtual void OnScreenshotCompleted( | 47 void OnScreenshotCompleted(ScreenshotTakerObserver::Result screenshot_result, |
| 50 ScreenshotTakerObserver::Result screenshot_result, | 48 const base::FilePath& screenshot_path) override { |
| 51 const base::FilePath& screenshot_path) override { | |
| 52 screenshot_complete_ = true; | 49 screenshot_complete_ = true; |
| 53 screenshot_result_ = screenshot_result; | 50 screenshot_result_ = screenshot_result; |
| 54 screenshot_path_ = screenshot_path; | 51 screenshot_path_ = screenshot_path; |
| 55 if (!running_) | 52 if (!running_) |
| 56 return; | 53 return; |
| 57 message_loop_runner_->Quit(); | 54 message_loop_runner_->Quit(); |
| 58 running_ = false; | 55 running_ = false; |
| 59 } | 56 } |
| 60 | 57 |
| 61 protected: | 58 protected: |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if (ScreenshotTakerObserver::SCREENSHOT_SUCCESS == screenshot_result_) | 135 if (ScreenshotTakerObserver::SCREENSHOT_SUCCESS == screenshot_result_) |
| 139 EXPECT_TRUE(base::PathExists(screenshot_path_)); | 136 EXPECT_TRUE(base::PathExists(screenshot_path_)); |
| 140 | 137 |
| 141 #if defined(OS_CHROMEOS) | 138 #if defined(OS_CHROMEOS) |
| 142 chromeos::LoginState::Shutdown(); | 139 chromeos::LoginState::Shutdown(); |
| 143 #endif | 140 #endif |
| 144 } | 141 } |
| 145 | 142 |
| 146 } // namespace test | 143 } // namespace test |
| 147 } // namespace ash | 144 } // namespace ash |
| OLD | NEW |