| 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 "chrome/test/base/testing_profile_manager.h" | 5 #include "chrome/test/base/testing_profile_manager.h" |
| 6 | 6 |
| 7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/profiles/profile_info_cache.h" | 10 #include "chrome/browser/profiles/profile_info_cache.h" |
| 11 #include "chrome/browser/profiles/profile_manager.h" | 11 #include "chrome/browser/profiles/profile_manager.h" |
| 12 #include "chrome/test/base/testing_browser_process.h" | 12 #include "chrome/test/base/testing_browser_process.h" |
| 13 #include "chrome/test/base/testing_profile.h" | 13 #include "chrome/test/base/testing_profile.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 namespace testing { | 16 namespace testing { |
| 17 | 17 |
| 18 class ProfileManager : public ::ProfileManager { | 18 class ProfileManager : public ::ProfileManager { |
| 19 public: | 19 public: |
| 20 explicit ProfileManager(const FilePath& user_data_dir) | 20 explicit ProfileManager(const FilePath& user_data_dir) |
| 21 : ::ProfileManager(user_data_dir) {} | 21 : ::ProfileManager(user_data_dir) {} |
| 22 | 22 |
| 23 protected: | 23 protected: |
| 24 virtual Profile* CreateProfileHelper(const FilePath& file_path) OVERRIDE { | 24 virtual Profile* CreateProfileHelper(const FilePath& file_path) OVERRIDE { |
| 25 return new TestingProfile(file_path); | 25 return new TestingProfile(file_path); |
| 26 } | 26 } |
| 27 | |
| 28 #if defined(OS_WIN) | |
| 29 virtual ProfileShortcutManagerWin* CreateShortcutManager() OVERRIDE { | |
| 30 // We should avoid creating shortcuts in these tests. | |
| 31 return NULL; | |
| 32 } | |
| 33 #endif | |
| 34 }; | 27 }; |
| 35 | 28 |
| 36 } // namespace testing | 29 } // namespace testing |
| 37 | 30 |
| 38 TestingProfileManager::TestingProfileManager(TestingBrowserProcess* process) | 31 TestingProfileManager::TestingProfileManager(TestingBrowserProcess* process) |
| 39 : called_set_up_(false), | 32 : called_set_up_(false), |
| 40 browser_process_(process), | 33 browser_process_(process), |
| 41 local_state_(process) { | 34 local_state_(process) { |
| 42 } | 35 } |
| 43 | 36 |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 << "ProfileManager already exists"; | 110 << "ProfileManager already exists"; |
| 118 | 111 |
| 119 // Set up the directory for profiles. | 112 // Set up the directory for profiles. |
| 120 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); | 113 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); |
| 121 | 114 |
| 122 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); | 115 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); |
| 123 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. | 116 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. |
| 124 | 117 |
| 125 called_set_up_ = true; | 118 called_set_up_ = true; |
| 126 } | 119 } |
| OLD | NEW |