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/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 void(Profile* profile, Profile::CreateStatus status)); | 89 void(Profile* profile, Profile::CreateStatus status)); |
90 }; | 90 }; |
91 | 91 |
92 ProfileManagerTest() | 92 ProfileManagerTest() |
93 : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)), | 93 : local_state_(static_cast<TestingBrowserProcess*>(g_browser_process)), |
94 extension_event_router_forwarder_(new extensions::EventRouterForwarder), | 94 extension_event_router_forwarder_(new extensions::EventRouterForwarder), |
95 ui_thread_(BrowserThread::UI, &message_loop_), | 95 ui_thread_(BrowserThread::UI, &message_loop_), |
96 db_thread_(BrowserThread::DB, &message_loop_), | 96 db_thread_(BrowserThread::DB, &message_loop_), |
97 file_thread_(BrowserThread::FILE, &message_loop_), | 97 file_thread_(BrowserThread::FILE, &message_loop_), |
98 io_thread_(local_state_.Get(), NULL, | 98 io_thread_(local_state_.Get(), NULL, |
99 extension_event_router_forwarder_) { | 99 extension_event_router_forwarder_.get()) { |
100 #if defined(OS_MACOSX) | 100 #if defined(OS_MACOSX) |
101 base::SystemMonitor::AllocateSystemIOPorts(); | 101 base::SystemMonitor::AllocateSystemIOPorts(); |
102 #endif | 102 #endif |
103 system_monitor_dummy_.reset(new base::SystemMonitor); | 103 system_monitor_dummy_.reset(new base::SystemMonitor); |
104 static_cast<TestingBrowserProcess*>(g_browser_process)->SetIOThread( | 104 static_cast<TestingBrowserProcess*>(g_browser_process)->SetIOThread( |
105 &io_thread_); | 105 &io_thread_); |
106 } | 106 } |
107 | 107 |
108 virtual void SetUp() { | 108 virtual void SetUp() { |
109 // Create a new temporary directory, and store the path | 109 // Create a new temporary directory, and store the path |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path1)); | 208 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path1)); |
209 ASSERT_TRUE(profile1); | 209 ASSERT_TRUE(profile1); |
210 | 210 |
211 TestingProfile* profile2 = | 211 TestingProfile* profile2 = |
212 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); | 212 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); |
213 ASSERT_TRUE(profile2); | 213 ASSERT_TRUE(profile2); |
214 | 214 |
215 // Force lazy-init of some profile services to simulate use. | 215 // Force lazy-init of some profile services to simulate use. |
216 profile1->CreateHistoryService(true, false); | 216 profile1->CreateHistoryService(true, false); |
217 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile1, | 217 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile1, |
218 Profile::EXPLICIT_ACCESS)); | 218 Profile::EXPLICIT_ACCESS). |
| 219 get()); |
219 profile1->CreateBookmarkModel(true); | 220 profile1->CreateBookmarkModel(true); |
220 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1)); | 221 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1)); |
221 profile2->CreateBookmarkModel(true); | 222 profile2->CreateBookmarkModel(true); |
222 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2)); | 223 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2)); |
223 profile2->CreateHistoryService(true, false); | 224 profile2->CreateHistoryService(true, false); |
224 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile2, | 225 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile2, |
225 Profile::EXPLICIT_ACCESS)); | 226 Profile::EXPLICIT_ACCESS). |
| 227 get()); |
226 | 228 |
227 // Make sure any pending tasks run before we destroy the profiles. | 229 // Make sure any pending tasks run before we destroy the profiles. |
228 message_loop_.RunAllPending(); | 230 message_loop_.RunAllPending(); |
229 | 231 |
230 static_cast<TestingBrowserProcess*>(g_browser_process)->SetProfileManager( | 232 static_cast<TestingBrowserProcess*>(g_browser_process)->SetProfileManager( |
231 NULL); | 233 NULL); |
232 | 234 |
233 // Make sure history cleans up correctly. | 235 // Make sure history cleans up correctly. |
234 message_loop_.RunAllPending(); | 236 message_loop_.RunAllPending(); |
235 } | 237 } |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 browser2b.reset(); | 561 browser2b.reset(); |
560 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); | 562 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); |
561 ASSERT_EQ(1U, last_opened_profiles.size()); | 563 ASSERT_EQ(1U, last_opened_profiles.size()); |
562 EXPECT_EQ(profile1, last_opened_profiles[0]); | 564 EXPECT_EQ(profile1, last_opened_profiles[0]); |
563 | 565 |
564 browser1.reset(); | 566 browser1.reset(); |
565 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); | 567 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); |
566 ASSERT_EQ(0U, last_opened_profiles.size()); | 568 ASSERT_EQ(0U, last_opened_profiles.size()); |
567 } | 569 } |
568 #endif // !defined(OS_ANDROID) | 570 #endif // !defined(OS_ANDROID) |
OLD | NEW |