OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 EXPECT_EQ(profile, profile_manager_->GetProfile(dest_path)); | 98 EXPECT_EQ(profile, profile_manager_->GetProfile(dest_path)); |
99 } | 99 } |
100 | 100 |
101 TEST_F(ProfileManagerTest, DefaultProfileDir) { | 101 TEST_F(ProfileManagerTest, DefaultProfileDir) { |
102 CommandLine *cl = CommandLine::ForCurrentProcess(); | 102 CommandLine *cl = CommandLine::ForCurrentProcess(); |
103 std::string profile_dir("my_user"); | 103 std::string profile_dir("my_user"); |
104 | 104 |
105 cl->AppendSwitch(switches::kTestType); | 105 cl->AppendSwitch(switches::kTestType); |
106 | 106 |
107 FilePath expected_default = | 107 FilePath expected_default = |
108 FilePath().AppendASCII(chrome::kNotSignedInProfile); | 108 FilePath().AppendASCII(chrome::kInitialProfile); |
109 EXPECT_EQ(expected_default.value(), | 109 EXPECT_EQ(expected_default.value(), |
110 profile_manager_->GetCurrentProfileDir().value()); | 110 profile_manager_->GetInitialProfileDir().value()); |
111 } | 111 } |
112 | 112 |
113 #if defined(OS_CHROMEOS) | 113 #if defined(OS_CHROMEOS) |
114 // This functionality only exists on Chrome OS. | 114 // This functionality only exists on Chrome OS. |
115 TEST_F(ProfileManagerTest, LoggedInProfileDir) { | 115 TEST_F(ProfileManagerTest, LoggedInProfileDir) { |
116 CommandLine *cl = CommandLine::ForCurrentProcess(); | 116 CommandLine *cl = CommandLine::ForCurrentProcess(); |
117 std::string profile_dir("my_user"); | 117 std::string profile_dir("my_user"); |
118 | 118 |
119 cl->AppendSwitchASCII(switches::kLoginProfile, profile_dir); | 119 cl->AppendSwitchASCII(switches::kLoginProfile, profile_dir); |
120 cl->AppendSwitch(switches::kTestType); | 120 cl->AppendSwitch(switches::kTestType); |
121 | 121 |
122 FilePath expected_default = | 122 FilePath expected_default = |
123 FilePath().AppendASCII(chrome::kNotSignedInProfile); | 123 FilePath().AppendASCII(chrome::kInitialProfile); |
124 EXPECT_EQ(expected_default.value(), | 124 EXPECT_EQ(expected_default.value(), |
125 profile_manager_->GetCurrentProfileDir().value()); | 125 profile_manager_->GetInitialProfileDir().value()); |
126 | 126 |
127 profile_manager_->Observe(chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 127 profile_manager_->Observe(chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
128 NotificationService::AllSources(), | 128 NotificationService::AllSources(), |
129 NotificationService::NoDetails()); | 129 NotificationService::NoDetails()); |
130 FilePath expected_logged_in(profile_dir); | 130 FilePath expected_logged_in(profile_dir); |
131 EXPECT_EQ(expected_logged_in.value(), | 131 EXPECT_EQ(expected_logged_in.value(), |
132 profile_manager_->GetCurrentProfileDir().value()); | 132 profile_manager_->GetInitialProfileDir().value()); |
133 VLOG(1) << temp_dir_.path().Append( | 133 VLOG(1) << temp_dir_.path().Append( |
134 profile_manager_->GetCurrentProfileDir()).value(); | 134 profile_manager_->GetInitialProfileDir()).value(); |
135 } | 135 } |
136 | 136 |
137 #endif | 137 #endif |
138 | 138 |
139 TEST_F(ProfileManagerTest, RegisterProfileName) { | 139 TEST_F(ProfileManagerTest, RegisterProfileName) { |
140 // Create a test profile. | 140 // Create a test profile. |
141 FilePath dest_path1 = temp_dir_.path(); | 141 FilePath dest_path1 = temp_dir_.path(); |
142 std::string dir_base("New Profile 1"); | 142 std::string dir_base("New Profile 1"); |
143 dest_path1 = dest_path1.Append(FILE_PATH_LITERAL("New Profile 1")); | 143 dest_path1 = dest_path1.Append(FILE_PATH_LITERAL("New Profile 1")); |
144 Profile* profile1; | 144 Profile* profile1; |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 | 247 |
248 MockObserver mock_observer; | 248 MockObserver mock_observer; |
249 EXPECT_CALL(mock_observer, OnProfileCreated( | 249 EXPECT_CALL(mock_observer, OnProfileCreated( |
250 testing::NotNull(), NotFail())).Times(testing::AtLeast(3)); | 250 testing::NotNull(), NotFail())).Times(testing::AtLeast(3)); |
251 | 251 |
252 profile_manager_->CreateProfileAsync(dest_path1, &mock_observer); | 252 profile_manager_->CreateProfileAsync(dest_path1, &mock_observer); |
253 profile_manager_->CreateProfileAsync(dest_path2, &mock_observer); | 253 profile_manager_->CreateProfileAsync(dest_path2, &mock_observer); |
254 | 254 |
255 message_loop_.RunAllPending(); | 255 message_loop_.RunAllPending(); |
256 } | 256 } |
OLD | NEW |