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" |
11 #include "base/scoped_temp_dir.h" | 11 #include "base/scoped_temp_dir.h" |
12 #include "base/system_monitor/system_monitor.h" | 12 #include "base/system_monitor/system_monitor.h" |
13 #include "base/utf_string_conversions.h" | 13 #include "base/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
17 #include "chrome/browser/extensions/event_router_forwarder.h" | 18 #include "chrome/browser/extensions/event_router_forwarder.h" |
18 #include "chrome/browser/history/history.h" | 19 #include "chrome/browser/history/history.h" |
19 #include "chrome/browser/history/history_service_factory.h" | 20 #include "chrome/browser/history/history_service_factory.h" |
20 #include "chrome/browser/io_thread.h" | 21 #include "chrome/browser/io_thread.h" |
21 #include "chrome/browser/prefs/browser_prefs.h" | 22 #include "chrome/browser/prefs/browser_prefs.h" |
22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
23 #include "chrome/browser/profiles/profile_info_cache.h" | 24 #include "chrome/browser/profiles/profile_info_cache.h" |
24 #include "chrome/browser/profiles/profile_manager.h" | 25 #include "chrome/browser/profiles/profile_manager.h" |
25 #include "chrome/browser/ui/browser.h" | 26 #include "chrome/browser/ui/browser.h" |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 | 216 |
216 TestingProfile* profile2 = | 217 TestingProfile* profile2 = |
217 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); | 218 static_cast<TestingProfile*>(profile_manager->GetProfile(dest_path2)); |
218 ASSERT_TRUE(profile2); | 219 ASSERT_TRUE(profile2); |
219 | 220 |
220 // Force lazy-init of some profile services to simulate use. | 221 // Force lazy-init of some profile services to simulate use. |
221 profile1->CreateHistoryService(true, false); | 222 profile1->CreateHistoryService(true, false); |
222 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile1, | 223 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile1, |
223 Profile::EXPLICIT_ACCESS)); | 224 Profile::EXPLICIT_ACCESS)); |
224 profile1->CreateBookmarkModel(true); | 225 profile1->CreateBookmarkModel(true); |
225 EXPECT_TRUE(profile1->GetBookmarkModel()); | 226 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile1)); |
226 profile2->CreateBookmarkModel(true); | 227 profile2->CreateBookmarkModel(true); |
227 EXPECT_TRUE(profile2->GetBookmarkModel()); | 228 EXPECT_TRUE(BookmarkModelFactory::GetForProfile(profile2)); |
228 profile2->CreateHistoryService(true, false); | 229 profile2->CreateHistoryService(true, false); |
229 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile2, | 230 EXPECT_TRUE(HistoryServiceFactory::GetForProfile(profile2, |
230 Profile::EXPLICIT_ACCESS)); | 231 Profile::EXPLICIT_ACCESS)); |
231 | 232 |
232 // Make sure any pending tasks run before we destroy the profiles. | 233 // Make sure any pending tasks run before we destroy the profiles. |
233 message_loop_.RunAllPending(); | 234 message_loop_.RunAllPending(); |
234 | 235 |
235 static_cast<TestingBrowserProcess*>(g_browser_process)->SetProfileManager( | 236 static_cast<TestingBrowserProcess*>(g_browser_process)->SetProfileManager( |
236 NULL); | 237 NULL); |
237 | 238 |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 browser2b.reset(); | 562 browser2b.reset(); |
562 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); | 563 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); |
563 ASSERT_EQ(1U, last_opened_profiles.size()); | 564 ASSERT_EQ(1U, last_opened_profiles.size()); |
564 EXPECT_EQ(profile1, last_opened_profiles[0]); | 565 EXPECT_EQ(profile1, last_opened_profiles[0]); |
565 | 566 |
566 browser1.reset(); | 567 browser1.reset(); |
567 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); | 568 last_opened_profiles = profile_manager->GetLastOpenedProfiles(); |
568 ASSERT_EQ(0U, last_opened_profiles.size()); | 569 ASSERT_EQ(0U, last_opened_profiles.size()); |
569 } | 570 } |
570 #endif // !defined(OS_ANDROID) | 571 #endif // !defined(OS_ANDROID) |
OLD | NEW |