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 "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/bind.h" | 8 #include "base/bind.h" |
9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 ASSERT_TRUE(extensions); | 198 ASSERT_TRUE(extensions); |
199 | 199 |
200 // Profile is new but has synced extensions. | 200 // Profile is new but has synced extensions. |
201 | 201 |
202 // (The web store doesn't count.) | 202 // (The web store doesn't count.) |
203 scoped_refptr<extensions::Extension> webstore = | 203 scoped_refptr<extensions::Extension> webstore = |
204 CreateExtension("web store", extension_misc::kWebStoreAppId); | 204 CreateExtension("web store", extension_misc::kWebStoreAppId); |
205 extensions->extension_prefs()->AddGrantedPermissions( | 205 extensions->extension_prefs()->AddGrantedPermissions( |
206 webstore->id(), | 206 webstore->id(), |
207 make_scoped_refptr(new extensions::PermissionSet)); | 207 make_scoped_refptr(new extensions::PermissionSet)); |
208 extensions->AddExtension(webstore); | 208 extensions->AddExtension(webstore.get()); |
209 EXPECT_FALSE( | 209 EXPECT_FALSE(GetCallbackResult( |
210 GetCallbackResult( | 210 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); |
211 base::Bind( | |
212 &ui::CheckShouldPromptForNewProfile, | |
213 profile_.get()))); | |
214 | 211 |
215 scoped_refptr<extensions::Extension> extension = | 212 scoped_refptr<extensions::Extension> extension = |
216 CreateExtension("foo", std::string()); | 213 CreateExtension("foo", std::string()); |
217 extensions->extension_prefs()->AddGrantedPermissions( | 214 extensions->extension_prefs()->AddGrantedPermissions( |
218 extension->id(), make_scoped_refptr(new extensions::PermissionSet)); | 215 extension->id(), make_scoped_refptr(new extensions::PermissionSet)); |
219 extensions->AddExtension(extension); | 216 extensions->AddExtension(extension.get()); |
220 EXPECT_TRUE( | 217 EXPECT_TRUE(GetCallbackResult( |
221 GetCallbackResult( | 218 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); |
222 base::Bind( | |
223 &ui::CheckShouldPromptForNewProfile, | |
224 profile_.get()))); | |
225 } | 219 } |
226 | 220 |
227 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_History) { | 221 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_History) { |
228 HistoryService* history = HistoryServiceFactory::GetForProfile( | 222 HistoryService* history = HistoryServiceFactory::GetForProfile( |
229 profile_.get(), | 223 profile_.get(), |
230 Profile::EXPLICIT_ACCESS); | 224 Profile::EXPLICIT_ACCESS); |
231 ASSERT_TRUE(history); | 225 ASSERT_TRUE(history); |
232 | 226 |
233 // Profile is new but has more than $(kHistoryEntriesBeforeNewProfilePrompt) | 227 // Profile is new but has more than $(kHistoryEntriesBeforeNewProfilePrompt) |
234 // history items. | 228 // history items. |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 | 261 |
268 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { | 262 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { |
269 // Browser has been shut down since profile was created. | 263 // Browser has been shut down since profile was created. |
270 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); | 264 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); |
271 EXPECT_TRUE( | 265 EXPECT_TRUE( |
272 GetCallbackResult( | 266 GetCallbackResult( |
273 base::Bind( | 267 base::Bind( |
274 &ui::CheckShouldPromptForNewProfile, | 268 &ui::CheckShouldPromptForNewProfile, |
275 profile_.get()))); | 269 profile_.get()))); |
276 } | 270 } |
OLD | NEW |