| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 extensions::ExtensionSystem::Get(profile_.get())->extension_service(); | 205 extensions::ExtensionSystem::Get(profile_.get())->extension_service(); |
| 206 ASSERT_TRUE(extensions); | 206 ASSERT_TRUE(extensions); |
| 207 | 207 |
| 208 // Profile is new but has synced extensions. | 208 // Profile is new but has synced extensions. |
| 209 | 209 |
| 210 // (The web store doesn't count.) | 210 // (The web store doesn't count.) |
| 211 scoped_refptr<extensions::Extension> webstore = | 211 scoped_refptr<extensions::Extension> webstore = |
| 212 CreateExtension("web store", | 212 CreateExtension("web store", |
| 213 extensions::kWebStoreAppId, | 213 extensions::kWebStoreAppId, |
| 214 extensions::Manifest::COMPONENT); | 214 extensions::Manifest::COMPONENT); |
| 215 extensions::ExtensionPrefs::Get(profile_.get())->AddGrantedPermissions( | 215 extensions::PermissionSet empty_permissions; |
| 216 webstore->id(), make_scoped_refptr(new extensions::PermissionSet).get()); | 216 extensions::ExtensionPrefs::Get(profile_.get()) |
| 217 ->AddGrantedPermissions(webstore->id(), &empty_permissions); |
| 217 extensions->AddExtension(webstore.get()); | 218 extensions->AddExtension(webstore.get()); |
| 218 EXPECT_FALSE(GetCallbackResult( | 219 EXPECT_FALSE(GetCallbackResult( |
| 219 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); | 220 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); |
| 220 | 221 |
| 221 scoped_refptr<extensions::Extension> extension = | 222 scoped_refptr<extensions::Extension> extension = |
| 222 CreateExtension("foo", std::string(), extensions::Manifest::INTERNAL); | 223 CreateExtension("foo", std::string(), extensions::Manifest::INTERNAL); |
| 223 extensions::ExtensionPrefs::Get(profile_.get())->AddGrantedPermissions( | 224 extensions::ExtensionPrefs::Get(profile_.get()) |
| 224 extension->id(), make_scoped_refptr(new extensions::PermissionSet).get()); | 225 ->AddGrantedPermissions(extension->id(), &empty_permissions); |
| 225 extensions->AddExtension(extension.get()); | 226 extensions->AddExtension(extension.get()); |
| 226 EXPECT_TRUE(GetCallbackResult( | 227 EXPECT_TRUE(GetCallbackResult( |
| 227 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); | 228 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); |
| 228 } | 229 } |
| 229 #endif | 230 #endif |
| 230 | 231 |
| 231 // http://crbug.com/393149 | 232 // http://crbug.com/393149 |
| 232 TEST_F(ProfileSigninConfirmationHelperTest, | 233 TEST_F(ProfileSigninConfirmationHelperTest, |
| 233 DISABLED_PromptForNewProfile_History) { | 234 DISABLED_PromptForNewProfile_History) { |
| 234 history::HistoryService* history = HistoryServiceFactory::GetForProfile( | 235 history::HistoryService* history = HistoryServiceFactory::GetForProfile( |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 273 | 274 |
| 274 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { | 275 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { |
| 275 // Browser has been shut down since profile was created. | 276 // Browser has been shut down since profile was created. |
| 276 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); | 277 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); |
| 277 EXPECT_TRUE( | 278 EXPECT_TRUE( |
| 278 GetCallbackResult( | 279 GetCallbackResult( |
| 279 base::Bind( | 280 base::Bind( |
| 280 &ui::CheckShouldPromptForNewProfile, | 281 &ui::CheckShouldPromptForNewProfile, |
| 281 profile_.get()))); | 282 profile_.get()))); |
| 282 } | 283 } |
| OLD | NEW |