OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/time.h" | 6 #include "base/time.h" |
7 #include "chrome/browser/browser.h" | 7 #include "chrome/browser/browser.h" |
8 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" | 8 #include "chrome/browser/chromeos/cros/cros_in_process_browser_test.h" |
9 #include "chrome/browser/profile_manager.h" | 9 #include "chrome/browser/profile_manager.h" |
10 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" | 10 #include "chrome/browser/chromeos/cros/mock_cryptohome_library.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 class LoginUserTest : public LoginTestBase { | 74 class LoginUserTest : public LoginTestBase { |
75 public: | 75 public: |
76 LoginUserTest() { | 76 LoginUserTest() { |
77 EXPECT_CALL(mock_cryptohome_library_, IsMounted()) | 77 EXPECT_CALL(mock_cryptohome_library_, IsMounted()) |
78 .WillRepeatedly(Return(true)); | 78 .WillRepeatedly(Return(true)); |
79 EXPECT_CALL(mock_screen_lock_library_, AddObserver(_)) | 79 EXPECT_CALL(mock_screen_lock_library_, AddObserver(_)) |
80 .WillOnce(Return()); | 80 .WillOnce(Return()); |
81 } | 81 } |
82 | 82 |
83 virtual void SetUpCommandLine(CommandLine* command_line) { | 83 virtual void SetUpCommandLine(CommandLine* command_line) { |
84 command_line->AppendSwitchWithValue( | 84 command_line->AppendSwitchASCII(switches::kLoginUser, "TestUser@gmail.com"); |
85 switches::kLoginUser, "TestUser@gmail.com"); | 85 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
86 command_line->AppendSwitchWithValue(switches::kLoginProfile, "user"); | |
87 command_line->AppendSwitch(switches::kNoFirstRun); | 86 command_line->AppendSwitch(switches::kNoFirstRun); |
88 } | 87 } |
89 }; | 88 }; |
90 | 89 |
91 class LoginProfileTest : public LoginTestBase { | 90 class LoginProfileTest : public LoginTestBase { |
92 public: | 91 public: |
93 LoginProfileTest() { | 92 LoginProfileTest() { |
94 EXPECT_CALL(mock_cryptohome_library_, IsMounted()) | 93 EXPECT_CALL(mock_cryptohome_library_, IsMounted()) |
95 .WillRepeatedly(Return(true)); | 94 .WillRepeatedly(Return(true)); |
96 } | 95 } |
97 | 96 |
98 virtual void SetUpCommandLine(CommandLine* command_line) { | 97 virtual void SetUpCommandLine(CommandLine* command_line) { |
99 command_line->AppendSwitchWithValue(switches::kLoginProfile, "user"); | 98 command_line->AppendSwitchASCII(switches::kLoginProfile, "user"); |
100 command_line->AppendSwitch(switches::kNoFirstRun); | 99 command_line->AppendSwitch(switches::kNoFirstRun); |
101 } | 100 } |
102 }; | 101 }; |
103 | 102 |
104 // After a chrome crash, the session manager will restart chrome with | 103 // After a chrome crash, the session manager will restart chrome with |
105 // the -login-user flag indicating that the user is already logged in. | 104 // the -login-user flag indicating that the user is already logged in. |
106 // This profile should NOT be an OTR profile. | 105 // This profile should NOT be an OTR profile. |
107 IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) { | 106 IN_PROC_BROWSER_TEST_F(LoginUserTest, UserPassed) { |
108 Profile* profile = browser()->profile(); | 107 Profile* profile = browser()->profile(); |
109 EXPECT_EQ("user", profile->GetPath().BaseName().value()); | 108 EXPECT_EQ("user", profile->GetPath().BaseName().value()); |
110 EXPECT_FALSE(profile->IsOffTheRecord()); | 109 EXPECT_FALSE(profile->IsOffTheRecord()); |
111 } | 110 } |
112 | 111 |
113 // On initial launch, we should get the OTR default profile. | 112 // On initial launch, we should get the OTR default profile. |
114 IN_PROC_BROWSER_TEST_F(LoginProfileTest, UserNotPassed) { | 113 IN_PROC_BROWSER_TEST_F(LoginProfileTest, UserNotPassed) { |
115 Profile* profile = browser()->profile(); | 114 Profile* profile = browser()->profile(); |
116 EXPECT_EQ("Default", profile->GetPath().BaseName().value()); | 115 EXPECT_EQ("Default", profile->GetPath().BaseName().value()); |
117 EXPECT_TRUE(profile->IsOffTheRecord()); | 116 EXPECT_TRUE(profile->IsOffTheRecord()); |
118 // Ensure there's no extension service for this profile. | 117 // Ensure there's no extension service for this profile. |
119 EXPECT_EQ(NULL, profile->GetExtensionsService()); | 118 EXPECT_EQ(NULL, profile->GetExtensionsService()); |
120 } | 119 } |
121 | 120 |
122 } // namespace chromeos | 121 } // namespace chromeos |
OLD | NEW |