OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/ui/sync/profile_signin_confirmation_helper.h" | 5 #include "chrome/browser/ui/sync/profile_signin_confirmation_helper.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "chrome/browser/history/history_service_factory.h" | 23 #include "chrome/browser/history/history_service_factory.h" |
24 #include "chrome/browser/prefs/browser_prefs.h" | 24 #include "chrome/browser/prefs/browser_prefs.h" |
25 #include "chrome/test/base/testing_profile.h" | 25 #include "chrome/test/base/testing_profile.h" |
26 #include "components/bookmarks/browser/bookmark_model.h" | 26 #include "components/bookmarks/browser/bookmark_model.h" |
27 #include "components/bookmarks/test/bookmark_test_helpers.h" | 27 #include "components/bookmarks/test/bookmark_test_helpers.h" |
28 #include "components/history/core/browser/history_service.h" | 28 #include "components/history/core/browser/history_service.h" |
29 #include "components/pref_registry/pref_registry_syncable.h" | 29 #include "components/pref_registry/pref_registry_syncable.h" |
30 #include "components/prefs/pref_notifier_impl.h" | 30 #include "components/prefs/pref_notifier_impl.h" |
31 #include "components/prefs/pref_service.h" | 31 #include "components/prefs/pref_service.h" |
32 #include "components/prefs/testing_pref_service.h" | 32 #include "components/prefs/testing_pref_service.h" |
33 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 33 #include "components/sync_preferences/testing_pref_service_syncable.h" |
34 #include "content/public/test/test_browser_thread_bundle.h" | 34 #include "content/public/test/test_browser_thread_bundle.h" |
35 #include "content/public/test/test_utils.h" | 35 #include "content/public/test/test_utils.h" |
36 #include "testing/gmock/include/gmock/gmock.h" | 36 #include "testing/gmock/include/gmock/gmock.h" |
37 #include "testing/gtest/include/gtest/gtest.h" | 37 #include "testing/gtest/include/gtest/gtest.h" |
38 | 38 |
39 #if defined(OS_CHROMEOS) | 39 #if defined(OS_CHROMEOS) |
40 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 40 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
41 #include "chrome/browser/chromeos/settings/cros_settings.h" | 41 #include "chrome/browser/chromeos/settings/cros_settings.h" |
42 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 42 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
43 #endif | 43 #endif |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 public: | 126 public: |
127 ProfileSigninConfirmationHelperTest() | 127 ProfileSigninConfirmationHelperTest() |
128 : user_prefs_(NULL), | 128 : user_prefs_(NULL), |
129 model_(NULL) { | 129 model_(NULL) { |
130 } | 130 } |
131 | 131 |
132 void SetUp() override { | 132 void SetUp() override { |
133 // Create the profile. | 133 // Create the profile. |
134 TestingProfile::Builder builder; | 134 TestingProfile::Builder builder; |
135 user_prefs_ = new TestingPrefStoreWithCustomReadError; | 135 user_prefs_ = new TestingPrefStoreWithCustomReadError; |
136 syncable_prefs::TestingPrefServiceSyncable* pref_service = | 136 sync_preferences::TestingPrefServiceSyncable* pref_service = |
137 new syncable_prefs::TestingPrefServiceSyncable( | 137 new sync_preferences::TestingPrefServiceSyncable( |
138 new TestingPrefStore(), user_prefs_, new TestingPrefStore(), | 138 new TestingPrefStore(), user_prefs_, new TestingPrefStore(), |
139 new user_prefs::PrefRegistrySyncable(), new PrefNotifierImpl()); | 139 new user_prefs::PrefRegistrySyncable(), new PrefNotifierImpl()); |
140 chrome::RegisterUserProfilePrefs(pref_service->registry()); | 140 chrome::RegisterUserProfilePrefs(pref_service->registry()); |
141 builder.SetPrefService( | 141 builder.SetPrefService( |
142 base::WrapUnique<syncable_prefs::PrefServiceSyncable>(pref_service)); | 142 base::WrapUnique<sync_preferences::PrefServiceSyncable>(pref_service)); |
143 profile_ = builder.Build(); | 143 profile_ = builder.Build(); |
144 | 144 |
145 // Initialize the services we check. | 145 // Initialize the services we check. |
146 profile_->CreateBookmarkModel(true); | 146 profile_->CreateBookmarkModel(true); |
147 model_ = BookmarkModelFactory::GetForBrowserContext(profile_.get()); | 147 model_ = BookmarkModelFactory::GetForBrowserContext(profile_.get()); |
148 bookmarks::test::WaitForBookmarkModelToLoad(model_); | 148 bookmarks::test::WaitForBookmarkModelToLoad(model_); |
149 ASSERT_TRUE(profile_->CreateHistoryService(true, false)); | 149 ASSERT_TRUE(profile_->CreateHistoryService(true, false)); |
150 #if defined(ENABLE_EXTENSIONS) | 150 #if defined(ENABLE_EXTENSIONS) |
151 extensions::TestExtensionSystem* system = | 151 extensions::TestExtensionSystem* system = |
152 static_cast<extensions::TestExtensionSystem*>( | 152 static_cast<extensions::TestExtensionSystem*>( |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 | 276 |
277 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { | 277 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { |
278 // Browser has been shut down since profile was created. | 278 // Browser has been shut down since profile was created. |
279 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); | 279 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); |
280 EXPECT_TRUE( | 280 EXPECT_TRUE( |
281 GetCallbackResult( | 281 GetCallbackResult( |
282 base::Bind( | 282 base::Bind( |
283 &ui::CheckShouldPromptForNewProfile, | 283 &ui::CheckShouldPromptForNewProfile, |
284 profile_.get()))); | 284 profile_.get()))); |
285 } | 285 } |
OLD | NEW |