| 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" |
| 11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
| 12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/message_loop/message_loop.h" | 13 #include "base/message_loop/message_loop.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/notifications/notification_ui_manager.h" | 15 #include "chrome/browser/notifications/notification_ui_manager.h" |
| 16 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
| 17 #include "chrome/test/base/testing_browser_process.h" | 17 #include "chrome/test/base/testing_browser_process.h" |
| 18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 19 #include "chrome/test/base/testing_profile_manager.h" | 19 #include "chrome/test/base/testing_profile_manager.h" |
| 20 #include "content/public/browser/browser_thread.h" | |
| 21 #include "content/public/test/test_utils.h" | 20 #include "content/public/test/test_utils.h" |
| 22 #include "ui/aura/root_window.h" | 21 #include "ui/aura/root_window.h" |
| 23 #include "ui/message_center/message_center_switches.h" | 22 #include "ui/message_center/message_center_switches.h" |
| 24 | 23 |
| 25 #if defined(OS_CHROMEOS) | 24 #if defined(OS_CHROMEOS) |
| 26 #include "chromeos/login/login_state.h" | 25 #include "chromeos/login/login_state.h" |
| 27 #endif | 26 #endif |
| 28 | 27 |
| 29 namespace ash { | 28 namespace ash { |
| 30 namespace test { | 29 namespace test { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 message_loop_runner_->Run(); | 86 message_loop_runner_->Run(); |
| 88 EXPECT_TRUE(screenshot_complete_); | 87 EXPECT_TRUE(screenshot_complete_); |
| 89 } | 88 } |
| 90 | 89 |
| 91 bool running_; | 90 bool running_; |
| 92 bool screenshot_complete_; | 91 bool screenshot_complete_; |
| 93 ScreenshotTakerObserver::Result screenshot_result_; | 92 ScreenshotTakerObserver::Result screenshot_result_; |
| 94 base::FilePath screenshot_path_; | 93 base::FilePath screenshot_path_; |
| 95 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 94 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
| 96 | 95 |
| 96 private: |
| 97 DISALLOW_COPY_AND_ASSIGN(ScreenshotTakerTest); | 97 DISALLOW_COPY_AND_ASSIGN(ScreenshotTakerTest); |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 TEST_F(ScreenshotTakerTest, TakeScreenshot) { | 100 TEST_F(ScreenshotTakerTest, TakeScreenshot) { |
| 101 #if defined(OS_CHROMEOS) | 101 #if defined(OS_CHROMEOS) |
| 102 // Note that within the test framework the LoginState object will always | 102 // Note that within the test framework the LoginState object will always |
| 103 // claim that the user did log in. | 103 // claim that the user did log in. |
| 104 ASSERT_FALSE(chromeos::LoginState::IsInitialized()); | 104 ASSERT_FALSE(chromeos::LoginState::IsInitialized()); |
| 105 chromeos::LoginState::Initialize(); | 105 chromeos::LoginState::Initialize(); |
| 106 #endif | 106 #endif |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 if (ScreenshotTakerObserver::SCREENSHOT_SUCCESS == screenshot_result_) | 138 if (ScreenshotTakerObserver::SCREENSHOT_SUCCESS == screenshot_result_) |
| 139 EXPECT_TRUE(base::PathExists(screenshot_path_)); | 139 EXPECT_TRUE(base::PathExists(screenshot_path_)); |
| 140 | 140 |
| 141 #if defined(OS_CHROMEOS) | 141 #if defined(OS_CHROMEOS) |
| 142 chromeos::LoginState::Shutdown(); | 142 chromeos::LoginState::Shutdown(); |
| 143 #endif | 143 #endif |
| 144 } | 144 } |
| 145 | 145 |
| 146 } // namespace test | 146 } // namespace test |
| 147 } // namespace ash | 147 } // namespace ash |
| OLD | NEW |