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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
11 #include "build/build_config.h" | 12 #include "build/build_config.h" |
12 #include "chrome/browser/profiles/profile_info_cache.h" | 13 #include "chrome/browser/profiles/profile_info_cache.h" |
13 #include "chrome/browser/profiles/profile_manager.h" | 14 #include "chrome/browser/profiles/profile_manager.h" |
14 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
15 #include "chrome/test/base/testing_browser_process.h" | 16 #include "chrome/test/base/testing_browser_process.h" |
16 #include "components/syncable_prefs/pref_service_syncable.h" | 17 #include "components/syncable_prefs/pref_service_syncable.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } else { | 77 } else { |
77 profile_path = profile_path.AppendASCII(profile_name); | 78 profile_path = profile_path.AppendASCII(profile_name); |
78 } | 79 } |
79 #else | 80 #else |
80 profile_path = profile_path.AppendASCII(profile_name); | 81 profile_path = profile_path.AppendASCII(profile_name); |
81 #endif | 82 #endif |
82 | 83 |
83 // Create the profile and register it. | 84 // Create the profile and register it. |
84 TestingProfile::Builder builder; | 85 TestingProfile::Builder builder; |
85 builder.SetPath(profile_path); | 86 builder.SetPath(profile_path); |
86 builder.SetPrefService(prefs.Pass()); | 87 builder.SetPrefService(std::move(prefs)); |
87 builder.SetSupervisedUserId(supervised_user_id); | 88 builder.SetSupervisedUserId(supervised_user_id); |
88 | 89 |
89 for (TestingProfile::TestingFactories::const_iterator it = factories.begin(); | 90 for (TestingProfile::TestingFactories::const_iterator it = factories.begin(); |
90 it != factories.end(); ++it) { | 91 it != factories.end(); ++it) { |
91 builder.AddTestingFactory(it->first, it->second); | 92 builder.AddTestingFactory(it->first, it->second); |
92 } | 93 } |
93 | 94 |
94 TestingProfile* profile = builder.Build().release(); | 95 TestingProfile* profile = builder.Build().release(); |
95 profile->set_profile_name(profile_name); | 96 profile->set_profile_name(profile_name); |
96 profile_manager_->AddProfile(profile); // Takes ownership. | 97 profile_manager_->AddProfile(profile); // Takes ownership. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
241 // Set up the directory for profiles. | 242 // Set up the directory for profiles. |
242 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); | 243 ASSERT_TRUE(profiles_dir_.CreateUniqueTempDir()); |
243 | 244 |
244 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); | 245 profile_manager_ = new testing::ProfileManager(profiles_dir_.path()); |
245 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. | 246 browser_process_->SetProfileManager(profile_manager_); // Takes ownership. |
246 | 247 |
247 profile_manager_->GetProfileInfoCache(). | 248 profile_manager_->GetProfileInfoCache(). |
248 set_disable_avatar_download_for_testing(true); | 249 set_disable_avatar_download_for_testing(true); |
249 called_set_up_ = true; | 250 called_set_up_ = true; |
250 } | 251 } |
OLD | NEW |