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