| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> |
| 6 |
| 7 #include "ash/common/shelf/wm_shelf.h" |
| 5 #include "ash/common/system/tray/system_tray.h" | 8 #include "ash/common/system/tray/system_tray.h" |
| 9 #include "ash/common/wm_window.h" |
| 6 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| 7 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 8 #include "base/location.h" | 12 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 13 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "chrome/browser/chrome_notification_types.h" | 16 #include "chrome/browser/chrome_notification_types.h" |
| 13 #include "chrome/browser/chromeos/login/login_manager_test.h" | 17 #include "chrome/browser/chromeos/login/login_manager_test.h" |
| 14 #include "chrome/browser/chromeos/login/login_wizard.h" | 18 #include "chrome/browser/chromeos/login/login_wizard.h" |
| 15 #include "chrome/browser/chromeos/login/startup_utils.h" | 19 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 20 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 17 #include "chrome/browser/chromeos/login/wizard_controller.h" | 21 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 18 #include "chrome/browser/chromeos/settings/cros_settings.h" | 22 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 19 #include "chrome/browser/profiles/profile_manager.h" | 23 #include "chrome/browser/profiles/profile_manager.h" |
| 20 #include "chrome/browser/profiles/profiles_state.h" | 24 #include "chrome/browser/profiles/profiles_state.h" |
| 21 #include "chrome/browser/ui/browser.h" | 25 #include "chrome/browser/ui/browser.h" |
| 22 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
| 23 #include "chrome/common/chrome_switches.h" | 27 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/test/base/in_process_browser_test.h" | 28 #include "chrome/test/base/in_process_browser_test.h" |
| 25 #include "chrome/test/base/interactive_test_utils.h" | 29 #include "chrome/test/base/interactive_test_utils.h" |
| 26 #include "chromeos/chromeos_switches.h" | 30 #include "chromeos/chromeos_switches.h" |
| 27 #include "chromeos/settings/cros_settings_names.h" | 31 #include "chromeos/settings/cros_settings_names.h" |
| 28 #include "components/signin/core/account_id/account_id.h" | 32 #include "components/signin/core/account_id/account_id.h" |
| 29 #include "components/user_manager/user_names.h" | 33 #include "components/user_manager/user_names.h" |
| 30 #include "content/public/test/browser_test_utils.h" | 34 #include "content/public/test/browser_test_utils.h" |
| 31 #include "content/public/test/test_utils.h" | 35 #include "content/public/test/test_utils.h" |
| 32 #include "extensions/browser/extension_system.h" | 36 #include "extensions/browser/extension_system.h" |
| 33 #include "testing/gmock/include/gmock/gmock.h" | 37 #include "testing/gmock/include/gmock/gmock.h" |
| 34 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
| 39 #include "ui/gfx/geometry/test/rect_test_util.h" |
| 35 | 40 |
| 41 using ::gfx::test::RectContains; |
| 36 using ::testing::_; | 42 using ::testing::_; |
| 37 using ::testing::AnyNumber; | 43 using ::testing::AnyNumber; |
| 38 using ::testing::Return; | 44 using ::testing::Return; |
| 39 | 45 |
| 40 namespace chromeos { | 46 namespace chromeos { |
| 41 namespace { | 47 namespace { |
| 42 | 48 |
| 43 const char kGaiaId[] = "12345"; | 49 const char kGaiaId[] = "12345"; |
| 44 const char kTestUser[] = "test-user@gmail.com"; | 50 const char kTestUser[] = "test-user@gmail.com"; |
| 45 const char kPassword[] = "password"; | 51 const char kPassword[] = "password"; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 user_context.SetKey(Key(kPassword)); | 177 user_context.SetKey(Key(kPassword)); |
| 172 SetExpectedCredentials(user_context); | 178 SetExpectedCredentials(user_context); |
| 173 } | 179 } |
| 174 }; | 180 }; |
| 175 | 181 |
| 176 // Used to make sure that the system tray is visible and within the screen | 182 // Used to make sure that the system tray is visible and within the screen |
| 177 // bounds after login. | 183 // bounds after login. |
| 178 void TestSystemTrayIsVisible() { | 184 void TestSystemTrayIsVisible() { |
| 179 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); | 185 ash::SystemTray* tray = ash::Shell::GetInstance()->GetPrimarySystemTray(); |
| 180 aura::Window* primary_win = ash::Shell::GetPrimaryRootWindow(); | 186 aura::Window* primary_win = ash::Shell::GetPrimaryRootWindow(); |
| 187 ash::WmWindow* wm_primary_win = ash::WmWindow::Get(primary_win); |
| 188 ash::WmShelf* wm_shelf = ash::WmShelf::ForWindow(wm_primary_win); |
| 189 SCOPED_TRACE(testing::Message() |
| 190 << "ShelfVisibilityState=" << wm_shelf->GetVisibilityState() |
| 191 << " ShelfAutoHideBehavior=" << wm_shelf->auto_hide_behavior()); |
| 181 EXPECT_TRUE(tray->visible()); | 192 EXPECT_TRUE(tray->visible()); |
| 182 EXPECT_TRUE(primary_win->bounds().Contains(tray->GetBoundsInScreen())); | 193 EXPECT_TRUE(RectContains(primary_win->bounds(), tray->GetBoundsInScreen())); |
| 183 } | 194 } |
| 184 | 195 |
| 185 } // namespace | 196 } // namespace |
| 186 | 197 |
| 187 // After a chrome crash, the session manager will restart chrome with | 198 // After a chrome crash, the session manager will restart chrome with |
| 188 // the -login-user flag indicating that the user is already logged in. | 199 // the -login-user flag indicating that the user is already logged in. |
| 189 // This profile should NOT be an OTR profile. | 200 // This profile should NOT be an OTR profile. |
| 190 IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) { | 201 IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) { |
| 191 Profile* profile = browser()->profile(); | 202 Profile* profile = browser()->profile(); |
| 192 std::string profile_base_path("hash"); | 203 std::string profile_base_path("hash"); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 content::WindowedNotificationObserver session_start_waiter( | 271 content::WindowedNotificationObserver session_start_waiter( |
| 261 chrome::NOTIFICATION_SESSION_STARTED, | 272 chrome::NOTIFICATION_SESSION_STARTED, |
| 262 content::NotificationService::AllSources()); | 273 content::NotificationService::AllSources()); |
| 263 SubmitGaiaAuthOfflineForm(kTestUser, kPassword); | 274 SubmitGaiaAuthOfflineForm(kTestUser, kPassword); |
| 264 session_start_waiter.Wait(); | 275 session_start_waiter.Wait(); |
| 265 | 276 |
| 266 TestSystemTrayIsVisible(); | 277 TestSystemTrayIsVisible(); |
| 267 } | 278 } |
| 268 | 279 |
| 269 } // namespace chromeos | 280 } // namespace chromeos |
| OLD | NEW |