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/chrome_screenshot_grabber.h" | 5 #include "chrome/browser/ui/ash/chrome_screenshot_grabber.h" |
6 | 6 |
7 #include "ash/common/accelerators/accelerator_controller.h" | 7 #include "ash/common/accelerators/accelerator_controller.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 ASSERT_FALSE(chromeos::LoginState::IsInitialized()); | 109 ASSERT_FALSE(chromeos::LoginState::IsInitialized()); |
110 chromeos::LoginState::Initialize(); | 110 chromeos::LoginState::Initialize(); |
111 chromeos::ScopedUserManagerEnabler scoped_enabler( | 111 chromeos::ScopedUserManagerEnabler scoped_enabler( |
112 new chromeos::MockUserManager()); | 112 new chromeos::MockUserManager()); |
113 base::ScopedTempDir directory; | 113 base::ScopedTempDir directory; |
114 ASSERT_TRUE(directory.CreateUniqueTempDir()); | 114 ASSERT_TRUE(directory.CreateUniqueTempDir()); |
115 EXPECT_TRUE(chrome_screenshot_grabber()->CanTakeScreenshot()); | 115 EXPECT_TRUE(chrome_screenshot_grabber()->CanTakeScreenshot()); |
116 | 116 |
117 screenshot_grabber()->TakeScreenshot( | 117 screenshot_grabber()->TakeScreenshot( |
118 Shell::GetPrimaryRootWindow(), gfx::Rect(0, 0, 100, 100), | 118 Shell::GetPrimaryRootWindow(), gfx::Rect(0, 0, 100, 100), |
119 directory.path().AppendASCII("Screenshot.png")); | 119 directory.GetPath().AppendASCII("Screenshot.png")); |
120 | 120 |
121 EXPECT_FALSE(screenshot_grabber()->CanTakeScreenshot()); | 121 EXPECT_FALSE(screenshot_grabber()->CanTakeScreenshot()); |
122 | 122 |
123 Wait(); | 123 Wait(); |
124 | 124 |
125 // Screenshot notifications on Windows not yet turned on. | 125 // Screenshot notifications on Windows not yet turned on. |
126 EXPECT_TRUE(g_browser_process->notification_ui_manager()->FindById( | 126 EXPECT_TRUE(g_browser_process->notification_ui_manager()->FindById( |
127 std::string("screenshot"), | 127 std::string("screenshot"), |
128 NotificationUIManager::GetProfileID(profile_)) != NULL); | 128 NotificationUIManager::GetProfileID(profile_)) != NULL); |
129 g_browser_process->notification_ui_manager()->CancelAll(); | 129 g_browser_process->notification_ui_manager()->CancelAll(); |
130 | 130 |
131 EXPECT_EQ(ScreenshotGrabberObserver::SCREENSHOT_SUCCESS, screenshot_result_); | 131 EXPECT_EQ(ScreenshotGrabberObserver::SCREENSHOT_SUCCESS, screenshot_result_); |
132 | 132 |
133 if (ScreenshotGrabberObserver::SCREENSHOT_SUCCESS == screenshot_result_) | 133 if (ScreenshotGrabberObserver::SCREENSHOT_SUCCESS == screenshot_result_) |
134 EXPECT_TRUE(base::PathExists(screenshot_path_)); | 134 EXPECT_TRUE(base::PathExists(screenshot_path_)); |
135 | 135 |
136 chromeos::LoginState::Shutdown(); | 136 chromeos::LoginState::Shutdown(); |
137 } | 137 } |
138 | 138 |
139 } // namespace test | 139 } // namespace test |
140 } // namespace ash | 140 } // namespace ash |
OLD | NEW |