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