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/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 | 77 |
78 TEST_F(ProfileManagerTest, DefaultProfileDir) { | 78 TEST_F(ProfileManagerTest, DefaultProfileDir) { |
79 CommandLine *cl = CommandLine::ForCurrentProcess(); | 79 CommandLine *cl = CommandLine::ForCurrentProcess(); |
80 ui::SystemMonitor dummy; | 80 ui::SystemMonitor dummy; |
81 ProfileManager profile_manager; | 81 ProfileManager profile_manager; |
82 std::string profile_dir("my_user"); | 82 std::string profile_dir("my_user"); |
83 | 83 |
84 cl->AppendSwitch(switches::kTestType); | 84 cl->AppendSwitch(switches::kTestType); |
85 | 85 |
86 FilePath expected_default = | 86 FilePath expected_default = |
87 FilePath::FromWStringHack(chrome::kNotSignedInProfile); | 87 FilePath().AppendASCII(chrome::kNotSignedInProfile); |
88 EXPECT_EQ(expected_default.value(), | 88 EXPECT_EQ(expected_default.value(), |
89 profile_manager.GetCurrentProfileDir().value()); | 89 profile_manager.GetCurrentProfileDir().value()); |
90 } | 90 } |
91 | 91 |
92 #if defined(OS_CHROMEOS) | 92 #if defined(OS_CHROMEOS) |
93 // This functionality only exists on Chrome OS. | 93 // This functionality only exists on Chrome OS. |
94 TEST_F(ProfileManagerTest, LoggedInProfileDir) { | 94 TEST_F(ProfileManagerTest, LoggedInProfileDir) { |
95 CommandLine *cl = CommandLine::ForCurrentProcess(); | 95 CommandLine *cl = CommandLine::ForCurrentProcess(); |
96 ui::SystemMonitor dummy; | 96 ui::SystemMonitor dummy; |
97 ProfileManager profile_manager; | 97 ProfileManager profile_manager; |
98 std::string profile_dir("my_user"); | 98 std::string profile_dir("my_user"); |
99 | 99 |
100 cl->AppendSwitchASCII(switches::kLoginProfile, profile_dir); | 100 cl->AppendSwitchASCII(switches::kLoginProfile, profile_dir); |
101 cl->AppendSwitch(switches::kTestType); | 101 cl->AppendSwitch(switches::kTestType); |
102 | 102 |
103 FilePath expected_default = | 103 FilePath expected_default = |
104 FilePath::FromWStringHack(chrome::kNotSignedInProfile); | 104 FilePath().AppendASCII(chrome::kNotSignedInProfile); |
105 EXPECT_EQ(expected_default.value(), | 105 EXPECT_EQ(expected_default.value(), |
106 profile_manager.GetCurrentProfileDir().value()); | 106 profile_manager.GetCurrentProfileDir().value()); |
107 | 107 |
108 profile_manager.Observe(NotificationType::LOGIN_USER_CHANGED, | 108 profile_manager.Observe(NotificationType::LOGIN_USER_CHANGED, |
109 NotificationService::AllSources(), | 109 NotificationService::AllSources(), |
110 NotificationService::NoDetails()); | 110 NotificationService::NoDetails()); |
111 FilePath expected_logged_in(profile_dir); | 111 FilePath expected_logged_in(profile_dir); |
112 EXPECT_EQ(expected_logged_in.value(), | 112 EXPECT_EQ(expected_logged_in.value(), |
113 profile_manager.GetCurrentProfileDir().value()); | 113 profile_manager.GetCurrentProfileDir().value()); |
114 VLOG(1) << test_dir_.Append(profile_manager.GetCurrentProfileDir()).value(); | 114 VLOG(1) << test_dir_.Append(profile_manager.GetCurrentProfileDir()).value(); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 // Make sure any pending tasks run before we destroy the profiles. | 147 // Make sure any pending tasks run before we destroy the profiles. |
148 message_loop_.RunAllPending(); | 148 message_loop_.RunAllPending(); |
149 | 149 |
150 profile1.reset(); | 150 profile1.reset(); |
151 profile2.reset(); | 151 profile2.reset(); |
152 | 152 |
153 // Make sure history cleans up correctly. | 153 // Make sure history cleans up correctly. |
154 message_loop_.RunAllPending(); | 154 message_loop_.RunAllPending(); |
155 } | 155 } |
OLD | NEW |