| 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 "ash/shell.h" | 5 #include "ash/shell.h" |
| 6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
| 7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
| 8 #include "chrome/browser/chromeos/login/login_display_host_impl.h" | 8 #include "chrome/browser/chromeos/login/login_display_host_impl.h" |
| 9 #include "chrome/browser/chromeos/login/login_wizard.h" | 9 #include "chrome/browser/chromeos/login/login_wizard.h" |
| 10 #include "chrome/browser/chromeos/login/user_manager.h" | 10 #include "chrome/browser/chromeos/login/user_manager.h" |
| 11 #include "chrome/browser/chromeos/login/wizard_controller.h" | 11 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 12 #include "chrome/browser/profiles/profile_manager.h" | 12 #include "chrome/browser/profiles/profile_manager.h" |
| 13 #include "chrome/browser/profiles/profiles_state.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
| 15 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
| 16 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
| 17 #include "chrome/test/base/interactive_test_utils.h" | 18 #include "chrome/test/base/interactive_test_utils.h" |
| 18 #include "chrome/test/base/tracing.h" | 19 #include "chrome/test/base/tracing.h" |
| 19 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
| 20 #include "chromeos/chromeos_switches.h" | 21 #include "chromeos/chromeos_switches.h" |
| 21 #include "content/public/test/test_utils.h" | 22 #include "content/public/test/test_utils.h" |
| 22 #include "extensions/browser/extension_system.h" | 23 #include "extensions/browser/extension_system.h" |
| 23 #include "testing/gmock/include/gmock/gmock.h" | 24 #include "testing/gmock/include/gmock/gmock.h" |
| 24 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 25 | 26 |
| 26 using ::testing::_; | 27 using ::testing::_; |
| 27 using ::testing::AnyNumber; | 28 using ::testing::AnyNumber; |
| 28 using ::testing::Return; | 29 using ::testing::Return; |
| 29 | 30 |
| 30 namespace { | 31 namespace { |
| 31 | 32 |
| 32 class LoginUserTest : public InProcessBrowserTest { | 33 class LoginUserTest : public InProcessBrowserTest { |
| 33 protected: | 34 protected: |
| 34 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 35 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 35 command_line->AppendSwitchASCII( | 36 command_line->AppendSwitchASCII( |
| 36 chromeos::switches::kLoginUser, "TestUser@gmail.com"); | 37 chromeos::switches::kLoginUser, "TestUser@gmail.com"); |
| 37 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); | 38 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, |
| 39 "hash"); |
| 38 } | 40 } |
| 39 }; | 41 }; |
| 40 | 42 |
| 41 class LoginGuestTest : public InProcessBrowserTest { | 43 class LoginGuestTest : public InProcessBrowserTest { |
| 42 protected: | 44 protected: |
| 43 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 45 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 44 command_line->AppendSwitch(chromeos::switches::kGuestSession); | 46 command_line->AppendSwitch(chromeos::switches::kGuestSession); |
| 45 command_line->AppendSwitch(::switches::kIncognito); | 47 command_line->AppendSwitch(::switches::kIncognito); |
| 46 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, "user"); | 48 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, |
| 49 "hash"); |
| 47 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, | 50 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, |
| 48 chromeos::UserManager::kGuestUserName); | 51 chromeos::UserManager::kGuestUserName); |
| 49 } | 52 } |
| 50 }; | 53 }; |
| 51 | 54 |
| 52 class LoginCursorTest : public InProcessBrowserTest { | 55 class LoginCursorTest : public InProcessBrowserTest { |
| 53 protected: | 56 protected: |
| 54 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 57 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 55 command_line->AppendSwitch(chromeos::switches::kLoginManager); | 58 command_line->AppendSwitch(chromeos::switches::kLoginManager); |
| 56 } | 59 } |
| 57 }; | 60 }; |
| 58 | 61 |
| 59 class LoginSigninTest : public InProcessBrowserTest { | 62 class LoginSigninTest : public InProcessBrowserTest { |
| 60 protected: | 63 protected: |
| 61 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 64 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 62 command_line->AppendSwitch(chromeos::switches::kLoginManager); | 65 command_line->AppendSwitch(chromeos::switches::kLoginManager); |
| 63 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); | 66 command_line->AppendSwitch(chromeos::switches::kForceLoginManagerInTests); |
| 64 } | 67 } |
| 65 | 68 |
| 66 virtual void SetUpOnMainThread() OVERRIDE { | 69 virtual void SetUpOnMainThread() OVERRIDE { |
| 67 ASSERT_TRUE(tracing::BeginTracingWithWatch("ui", "ui", "ShowLoginWebUI", 1))
; | 70 ASSERT_TRUE(tracing::BeginTracingWithWatch( |
| 71 "ui", "ui", "ShowLoginWebUI", 1)); |
| 68 } | 72 } |
| 69 }; | 73 }; |
| 70 | 74 |
| 71 // After a chrome crash, the session manager will restart chrome with | 75 // After a chrome crash, the session manager will restart chrome with |
| 72 // the -login-user flag indicating that the user is already logged in. | 76 // the -login-user flag indicating that the user is already logged in. |
| 73 // This profile should NOT be an OTR profile. | 77 // This profile should NOT be an OTR profile. |
| 74 IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) { | 78 IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) { |
| 75 Profile* profile = browser()->profile(); | 79 Profile* profile = browser()->profile(); |
| 76 EXPECT_EQ("user", profile->GetPath().BaseName().value()); | 80 std::string profile_base_path("hash"); |
| 81 profile_base_path.insert(0, chrome::kProfileDirPrefix); |
| 82 EXPECT_EQ(profile_base_path, profile->GetPath().BaseName().value()); |
| 77 EXPECT_FALSE(profile->IsOffTheRecord()); | 83 EXPECT_FALSE(profile->IsOffTheRecord()); |
| 78 } | 84 } |
| 79 | 85 |
| 80 // Verifies the cursor is not hidden at startup when user is logged in. | 86 // Verifies the cursor is not hidden at startup when user is logged in. |
| 81 IN_PROC_BROWSER_TEST_F(LoginUserTest, CursorShown) { | 87 IN_PROC_BROWSER_TEST_F(LoginUserTest, CursorShown) { |
| 82 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); | 88 EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible()); |
| 83 } | 89 } |
| 84 | 90 |
| 85 // After a guest login, we should get the OTR default profile. | 91 // After a guest login, we should get the OTR default profile. |
| 86 IN_PROC_BROWSER_TEST_F(LoginGuestTest, GuestIsOTR) { | 92 IN_PROC_BROWSER_TEST_F(LoginGuestTest, GuestIsOTR) { |
| (...skipping 26 matching lines...) Expand all Loading... |
| 113 | 119 |
| 114 // Verifies that the webui for login comes up successfully. | 120 // Verifies that the webui for login comes up successfully. |
| 115 IN_PROC_BROWSER_TEST_F(LoginSigninTest, WebUIVisible) { | 121 IN_PROC_BROWSER_TEST_F(LoginSigninTest, WebUIVisible) { |
| 116 base::TimeDelta no_timeout; | 122 base::TimeDelta no_timeout; |
| 117 EXPECT_TRUE(tracing::WaitForWatchEvent(no_timeout)); | 123 EXPECT_TRUE(tracing::WaitForWatchEvent(no_timeout)); |
| 118 std::string json_events; | 124 std::string json_events; |
| 119 ASSERT_TRUE(tracing::EndTracing(&json_events)); | 125 ASSERT_TRUE(tracing::EndTracing(&json_events)); |
| 120 } | 126 } |
| 121 | 127 |
| 122 } // namespace | 128 } // namespace |
| OLD | NEW |