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> | 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/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "chrome/test/base/test_browser_window.h" | 32 #include "chrome/test/base/test_browser_window.h" |
33 #include "chrome/test/base/testing_browser_process.h" | 33 #include "chrome/test/base/testing_browser_process.h" |
34 #include "chrome/test/base/testing_profile.h" | 34 #include "chrome/test/base/testing_profile.h" |
35 #include "content/public/browser/notification_service.h" | 35 #include "content/public/browser/notification_service.h" |
36 #include "content/public/test/test_browser_thread.h" | 36 #include "content/public/test/test_browser_thread.h" |
37 #include "testing/gmock/include/gmock/gmock.h" | 37 #include "testing/gmock/include/gmock/gmock.h" |
38 #include "testing/gtest/include/gtest/gtest.h" | 38 #include "testing/gtest/include/gtest/gtest.h" |
39 | 39 |
40 #if defined(OS_CHROMEOS) | 40 #if defined(OS_CHROMEOS) |
41 #include "chrome/browser/chromeos/cros/cros_library.h" | 41 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 42 #include "chromeos/chromeos_switches.h" |
42 #endif | 43 #endif |
43 | 44 |
44 using content::BrowserThread; | 45 using content::BrowserThread; |
45 | 46 |
46 namespace { | 47 namespace { |
47 | 48 |
48 // This global variable is used to check that value returned to different | 49 // This global variable is used to check that value returned to different |
49 // observers is the same. | 50 // observers is the same. |
50 Profile* g_created_profile; | 51 Profile* g_created_profile; |
51 | 52 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 expected_default.value(), | 160 expected_default.value(), |
160 g_browser_process->profile_manager()->GetInitialProfileDir().value()); | 161 g_browser_process->profile_manager()->GetInitialProfileDir().value()); |
161 } | 162 } |
162 | 163 |
163 #if defined(OS_CHROMEOS) | 164 #if defined(OS_CHROMEOS) |
164 // This functionality only exists on Chrome OS. | 165 // This functionality only exists on Chrome OS. |
165 TEST_F(ProfileManagerTest, LoggedInProfileDir) { | 166 TEST_F(ProfileManagerTest, LoggedInProfileDir) { |
166 CommandLine *cl = CommandLine::ForCurrentProcess(); | 167 CommandLine *cl = CommandLine::ForCurrentProcess(); |
167 std::string profile_dir("my_user"); | 168 std::string profile_dir("my_user"); |
168 | 169 |
169 cl->AppendSwitchASCII(switches::kLoginProfile, profile_dir); | 170 cl->AppendSwitchASCII(chromeos::switches::kLoginProfile, profile_dir); |
170 | 171 |
171 base::FilePath expected_default = | 172 base::FilePath expected_default = |
172 base::FilePath().AppendASCII(chrome::kInitialProfile); | 173 base::FilePath().AppendASCII(chrome::kInitialProfile); |
173 ProfileManager* profile_manager = g_browser_process->profile_manager(); | 174 ProfileManager* profile_manager = g_browser_process->profile_manager(); |
174 EXPECT_EQ(expected_default.value(), | 175 EXPECT_EQ(expected_default.value(), |
175 profile_manager->GetInitialProfileDir().value()); | 176 profile_manager->GetInitialProfileDir().value()); |
176 | 177 |
177 profile_manager->Observe(chrome::NOTIFICATION_LOGIN_USER_CHANGED, | 178 profile_manager->Observe(chrome::NOTIFICATION_LOGIN_USER_CHANGED, |
178 content::NotificationService::AllSources(), | 179 content::NotificationService::AllSources(), |
179 content::NotificationService::NoDetails()); | 180 content::NotificationService::NoDetails()); |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 browser2b.reset(); | 596 browser2b.reset(); |
596 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); | 597 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); |
597 ASSERT_EQ(1U, last_opened_profiles.size()); | 598 ASSERT_EQ(1U, last_opened_profiles.size()); |
598 EXPECT_EQ(profile1, last_opened_profiles[0]); | 599 EXPECT_EQ(profile1, last_opened_profiles[0]); |
599 | 600 |
600 browser1.reset(); | 601 browser1.reset(); |
601 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); | 602 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); |
602 ASSERT_EQ(0U, last_opened_profiles.size()); | 603 ASSERT_EQ(0U, last_opened_profiles.size()); |
603 } | 604 } |
604 #endif // !defined(OS_ANDROID) | 605 #endif // !defined(OS_ANDROID) |
OLD | NEW |