| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 ExtensionService* extensions = | 196 ExtensionService* extensions = |
| 197 extensions::ExtensionSystem::Get(profile_.get())->extension_service(); | 197 extensions::ExtensionSystem::Get(profile_.get())->extension_service(); |
| 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(), make_scoped_refptr(new extensions::PermissionSet).get()); |
| 207 make_scoped_refptr(new extensions::PermissionSet)); | |
| 208 extensions->AddExtension(webstore.get()); | 207 extensions->AddExtension(webstore.get()); |
| 209 EXPECT_FALSE(GetCallbackResult( | 208 EXPECT_FALSE(GetCallbackResult( |
| 210 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); | 209 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); |
| 211 | 210 |
| 212 scoped_refptr<extensions::Extension> extension = | 211 scoped_refptr<extensions::Extension> extension = |
| 213 CreateExtension("foo", std::string()); | 212 CreateExtension("foo", std::string()); |
| 214 extensions->extension_prefs()->AddGrantedPermissions( | 213 extensions->extension_prefs()->AddGrantedPermissions( |
| 215 extension->id(), make_scoped_refptr(new extensions::PermissionSet)); | 214 extension->id(), make_scoped_refptr(new extensions::PermissionSet).get()); |
| 216 extensions->AddExtension(extension.get()); | 215 extensions->AddExtension(extension.get()); |
| 217 EXPECT_TRUE(GetCallbackResult( | 216 EXPECT_TRUE(GetCallbackResult( |
| 218 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); | 217 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); |
| 219 } | 218 } |
| 220 | 219 |
| 221 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_History) { | 220 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_History) { |
| 222 HistoryService* history = HistoryServiceFactory::GetForProfile( | 221 HistoryService* history = HistoryServiceFactory::GetForProfile( |
| 223 profile_.get(), | 222 profile_.get(), |
| 224 Profile::EXPLICIT_ACCESS); | 223 Profile::EXPLICIT_ACCESS); |
| 225 ASSERT_TRUE(history); | 224 ASSERT_TRUE(history); |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 261 | 260 |
| 262 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { | 261 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { |
| 263 // Browser has been shut down since profile was created. | 262 // Browser has been shut down since profile was created. |
| 264 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); | 263 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); |
| 265 EXPECT_TRUE( | 264 EXPECT_TRUE( |
| 266 GetCallbackResult( | 265 GetCallbackResult( |
| 267 base::Bind( | 266 base::Bind( |
| 268 &ui::CheckShouldPromptForNewProfile, | 267 &ui::CheckShouldPromptForNewProfile, |
| 269 profile_.get()))); | 268 profile_.get()))); |
| 270 } | 269 } |
| OLD | NEW |