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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/scoped_temp_dir.h" | 10 #include "base/scoped_temp_dir.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 #endif | 59 #endif |
60 system_monitor_dummy_.reset(new base::SystemMonitor); | 60 system_monitor_dummy_.reset(new base::SystemMonitor); |
61 static_cast<TestingBrowserProcess*>(g_browser_process)->SetIOThread( | 61 static_cast<TestingBrowserProcess*>(g_browser_process)->SetIOThread( |
62 &io_thread_); | 62 &io_thread_); |
63 } | 63 } |
64 | 64 |
65 virtual void SetUp() { | 65 virtual void SetUp() { |
66 // Create a new temporary directory, and store the path | 66 // Create a new temporary directory, and store the path |
67 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 67 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
68 profile_manager_.reset(new ProfileManagerWithoutInit(temp_dir_.path())); | 68 profile_manager_.reset(new ProfileManagerWithoutInit(temp_dir_.path())); |
| 69 #if defined(OS_WIN) |
| 70 // Force the ProfileInfoCache to be created immediately, so we can |
| 71 // remove the shortcut manager for testing. |
| 72 profile_manager_->GetProfileInfoCache(); |
| 73 profile_manager_->RemoveProfileShortcutManagerForTesting(); |
| 74 #endif |
69 } | 75 } |
70 | 76 |
71 virtual void TearDown() { | 77 virtual void TearDown() { |
72 profile_manager_.reset(); | 78 profile_manager_.reset(); |
73 message_loop_.RunAllPending(); | 79 message_loop_.RunAllPending(); |
74 } | 80 } |
75 | 81 |
76 class MockObserver : public ProfileManagerObserver { | 82 class MockObserver : public ProfileManagerObserver { |
77 public: | 83 public: |
78 MOCK_METHOD2(OnProfileCreated, void(Profile* profile, Status status)); | 84 MOCK_METHOD2(OnProfileCreated, void(Profile* profile, Status status)); |
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 cache.AddProfileToCache(cache.GetUserDataDir().AppendASCII("path_3"), | 268 cache.AddProfileToCache(cache.GetUserDataDir().AppendASCII("path_3"), |
263 ASCIIToUTF16("name_3"), string16(), 0); | 269 ASCIIToUTF16("name_3"), string16(), 0); |
264 cache.SetBackgroundStatusOfProfileAtIndex(0, true); | 270 cache.SetBackgroundStatusOfProfileAtIndex(0, true); |
265 cache.SetBackgroundStatusOfProfileAtIndex(2, true); | 271 cache.SetBackgroundStatusOfProfileAtIndex(2, true); |
266 EXPECT_EQ(3u, cache.GetNumberOfProfiles()); | 272 EXPECT_EQ(3u, cache.GetNumberOfProfiles()); |
267 | 273 |
268 profile_manager_->AutoloadProfiles(); | 274 profile_manager_->AutoloadProfiles(); |
269 | 275 |
270 EXPECT_EQ(2u, profile_manager_->GetLoadedProfiles().size()); | 276 EXPECT_EQ(2u, profile_manager_->GetLoadedProfiles().size()); |
271 } | 277 } |
OLD | NEW |