| 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 26 matching lines...) Expand all Loading... |
| 37 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | 37 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" |
| 38 #include "chrome/browser/chromeos/settings/cros_settings.h" | 38 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 39 #include "chrome/browser/chromeos/settings/device_settings_service.h" | 39 #include "chrome/browser/chromeos/settings/device_settings_service.h" |
| 40 #endif | 40 #endif |
| 41 | 41 |
| 42 #if defined(ENABLE_EXTENSIONS) | 42 #if defined(ENABLE_EXTENSIONS) |
| 43 #include "chrome/browser/extensions/extension_service.h" | 43 #include "chrome/browser/extensions/extension_service.h" |
| 44 #include "chrome/browser/extensions/test_extension_system.h" | 44 #include "chrome/browser/extensions/test_extension_system.h" |
| 45 #include "chrome/common/extensions/extension_constants.h" | 45 #include "chrome/common/extensions/extension_constants.h" |
| 46 #include "extensions/browser/extension_prefs.h" | 46 #include "extensions/browser/extension_prefs.h" |
| 47 #include "extensions/common/constants.h" |
| 47 #include "extensions/common/extension.h" | 48 #include "extensions/common/extension.h" |
| 48 #include "extensions/common/manifest_constants.h" | 49 #include "extensions/common/manifest_constants.h" |
| 49 #include "extensions/common/permissions/permission_set.h" | 50 #include "extensions/common/permissions/permission_set.h" |
| 50 #endif | 51 #endif |
| 51 | 52 |
| 52 namespace { | 53 namespace { |
| 53 | 54 |
| 54 template<typename T> | 55 template<typename T> |
| 55 void GetValueAndQuit(T* result, const base::Closure& quit, T actual) { | 56 void GetValueAndQuit(T* result, const base::Closure& quit, T actual) { |
| 56 *result = actual; | 57 *result = actual; |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 #if defined(ENABLE_EXTENSIONS) | 204 #if defined(ENABLE_EXTENSIONS) |
| 204 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Extensions) { | 205 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Extensions) { |
| 205 ExtensionService* extensions = | 206 ExtensionService* extensions = |
| 206 extensions::ExtensionSystem::Get(profile_.get())->extension_service(); | 207 extensions::ExtensionSystem::Get(profile_.get())->extension_service(); |
| 207 ASSERT_TRUE(extensions); | 208 ASSERT_TRUE(extensions); |
| 208 | 209 |
| 209 // Profile is new but has synced extensions. | 210 // Profile is new but has synced extensions. |
| 210 | 211 |
| 211 // (The web store doesn't count.) | 212 // (The web store doesn't count.) |
| 212 scoped_refptr<extensions::Extension> webstore = | 213 scoped_refptr<extensions::Extension> webstore = |
| 213 CreateExtension("web store", extension_misc::kWebStoreAppId); | 214 CreateExtension("web store", extensions::kWebStoreAppId); |
| 214 extensions::ExtensionPrefs::Get(profile_.get())->AddGrantedPermissions( | 215 extensions::ExtensionPrefs::Get(profile_.get())->AddGrantedPermissions( |
| 215 webstore->id(), make_scoped_refptr(new extensions::PermissionSet).get()); | 216 webstore->id(), make_scoped_refptr(new extensions::PermissionSet).get()); |
| 216 extensions->AddExtension(webstore.get()); | 217 extensions->AddExtension(webstore.get()); |
| 217 EXPECT_FALSE(GetCallbackResult( | 218 EXPECT_FALSE(GetCallbackResult( |
| 218 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); | 219 base::Bind(&ui::CheckShouldPromptForNewProfile, profile_.get()))); |
| 219 | 220 |
| 220 scoped_refptr<extensions::Extension> extension = | 221 scoped_refptr<extensions::Extension> extension = |
| 221 CreateExtension("foo", std::string()); | 222 CreateExtension("foo", std::string()); |
| 222 extensions::ExtensionPrefs::Get(profile_.get())->AddGrantedPermissions( | 223 extensions::ExtensionPrefs::Get(profile_.get())->AddGrantedPermissions( |
| 223 extension->id(), make_scoped_refptr(new extensions::PermissionSet).get()); | 224 extension->id(), make_scoped_refptr(new extensions::PermissionSet).get()); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 275 |
| 275 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { | 276 TEST_F(ProfileSigninConfirmationHelperTest, PromptForNewProfile_Restarted) { |
| 276 // Browser has been shut down since profile was created. | 277 // Browser has been shut down since profile was created. |
| 277 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); | 278 user_prefs_->set_read_error(PersistentPrefStore::PREF_READ_ERROR_NONE); |
| 278 EXPECT_TRUE( | 279 EXPECT_TRUE( |
| 279 GetCallbackResult( | 280 GetCallbackResult( |
| 280 base::Bind( | 281 base::Bind( |
| 281 &ui::CheckShouldPromptForNewProfile, | 282 &ui::CheckShouldPromptForNewProfile, |
| 282 profile_.get()))); | 283 profile_.get()))); |
| 283 } | 284 } |
| OLD | NEW |