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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 virtual void TearDown() { | 71 virtual void TearDown() { |
72 profile_manager_.reset(); | 72 profile_manager_.reset(); |
73 message_loop_.RunAllPending(); | 73 message_loop_.RunAllPending(); |
74 } | 74 } |
75 | 75 |
76 class MockObserver : public ProfileManagerObserver { | 76 class MockObserver : public ProfileManagerObserver { |
77 public: | 77 public: |
78 MOCK_METHOD2(OnProfileCreated, void(Profile* profile, Status status)); | 78 MOCK_METHOD2(OnProfileCreated, void(Profile* profile, Status status)); |
79 }; | 79 }; |
80 | 80 |
| 81 #if defined(OS_CHROMEOS) |
| 82 // Do not change order of stub_cros_enabler_, which needs to be constructed |
| 83 // before io_thread_ which requires CrosLibrary to be initialized to construct |
| 84 // its data member pref_proxy_config_tracker_ on ChromeOS. |
| 85 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; |
| 86 #endif |
| 87 |
81 // The path to temporary directory used to contain the test operations. | 88 // The path to temporary directory used to contain the test operations. |
82 ScopedTempDir temp_dir_; | 89 ScopedTempDir temp_dir_; |
83 ScopedTestingLocalState local_state_; | 90 ScopedTestingLocalState local_state_; |
84 scoped_refptr<ExtensionEventRouterForwarder> | 91 scoped_refptr<ExtensionEventRouterForwarder> |
85 extension_event_router_forwarder_; | 92 extension_event_router_forwarder_; |
86 | 93 |
87 MessageLoopForUI message_loop_; | 94 MessageLoopForUI message_loop_; |
88 content::TestBrowserThread ui_thread_; | 95 content::TestBrowserThread ui_thread_; |
89 content::TestBrowserThread db_thread_; | 96 content::TestBrowserThread db_thread_; |
90 content::TestBrowserThread file_thread_; | 97 content::TestBrowserThread file_thread_; |
91 IOThread io_thread_; | 98 IOThread io_thread_; |
92 | 99 |
93 scoped_ptr<base::SystemMonitor> system_monitor_dummy_; | 100 scoped_ptr<base::SystemMonitor> system_monitor_dummy_; |
94 | 101 |
95 #if defined(OS_CHROMEOS) | |
96 chromeos::ScopedStubCrosEnabler stub_cros_enabler_; | |
97 #endif | |
98 | |
99 // Also will test profile deletion. | 102 // Also will test profile deletion. |
100 scoped_ptr<ProfileManager> profile_manager_; | 103 scoped_ptr<ProfileManager> profile_manager_; |
101 }; | 104 }; |
102 | 105 |
103 TEST_F(ProfileManagerTest, GetProfile) { | 106 TEST_F(ProfileManagerTest, GetProfile) { |
104 FilePath dest_path = temp_dir_.path(); | 107 FilePath dest_path = temp_dir_.path(); |
105 dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile")); | 108 dest_path = dest_path.Append(FILE_PATH_LITERAL("New Profile")); |
106 | 109 |
107 Profile* profile; | 110 Profile* profile; |
108 | 111 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 cache.AddProfileToCache(cache.GetUserDataDir().AppendASCII("path_3"), | 262 cache.AddProfileToCache(cache.GetUserDataDir().AppendASCII("path_3"), |
260 ASCIIToUTF16("name_3"), string16(), 0); | 263 ASCIIToUTF16("name_3"), string16(), 0); |
261 cache.SetBackgroundStatusOfProfileAtIndex(0, true); | 264 cache.SetBackgroundStatusOfProfileAtIndex(0, true); |
262 cache.SetBackgroundStatusOfProfileAtIndex(2, true); | 265 cache.SetBackgroundStatusOfProfileAtIndex(2, true); |
263 EXPECT_EQ(3u, cache.GetNumberOfProfiles()); | 266 EXPECT_EQ(3u, cache.GetNumberOfProfiles()); |
264 | 267 |
265 profile_manager_->AutoloadProfiles(); | 268 profile_manager_->AutoloadProfiles(); |
266 | 269 |
267 EXPECT_EQ(2u, profile_manager_->GetLoadedProfiles().size()); | 270 EXPECT_EQ(2u, profile_manager_->GetLoadedProfiles().size()); |
268 } | 271 } |
OLD | NEW |