OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/prefs/pref_service.h" | 5 #include "base/prefs/pref_service.h" |
6 #include "base/prefs/scoped_user_pref_update.h" | 6 #include "base/prefs/scoped_user_pref_update.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "base/values.h" | 8 #include "base/values.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/browser/content_settings/cookie_settings.h" | 10 #include "chrome/browser/content_settings/cookie_settings.h" |
11 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 11 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
13 #include "chrome/browser/profiles/profile_info_cache.h" | 13 #include "chrome/browser/profiles/profile_info_cache.h" |
14 #include "chrome/browser/profiles/profile_io_data.h" | 14 #include "chrome/browser/profiles/profile_io_data.h" |
15 #include "chrome/browser/profiles/profile_manager.h" | 15 #include "chrome/browser/profiles/profile_manager.h" |
16 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" | 16 #include "chrome/browser/signin/fake_profile_oauth2_token_service.h" |
| 17 #include "chrome/browser/signin/fake_profile_oauth2_token_service_wrapper.h" |
17 #include "chrome/browser/signin/fake_signin_manager.h" | 18 #include "chrome/browser/signin/fake_signin_manager.h" |
18 #include "chrome/browser/signin/profile_oauth2_token_service.h" | 19 #include "chrome/browser/signin/profile_oauth2_token_service.h" |
19 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 20 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
20 #include "chrome/browser/signin/signin_manager.h" | 21 #include "chrome/browser/signin/signin_manager.h" |
21 #include "chrome/browser/signin/signin_manager_factory.h" | 22 #include "chrome/browser/signin/signin_manager_factory.h" |
22 #include "chrome/browser/signin/signin_names_io_thread.h" | 23 #include "chrome/browser/signin/signin_names_io_thread.h" |
23 #include "chrome/browser/signin/signin_promo.h" | 24 #include "chrome/browser/signin/signin_promo.h" |
24 #include "chrome/browser/sync/profile_sync_service_factory.h" | 25 #include "chrome/browser/sync/profile_sync_service_factory.h" |
25 #include "chrome/browser/sync/profile_sync_service_mock.h" | 26 #include "chrome/browser/sync/profile_sync_service_mock.h" |
26 #include "chrome/browser/sync/test_profile_sync_service.h" | 27 #include "chrome/browser/sync/test_profile_sync_service.h" |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 autofill::PasswordForm password_form; | 312 autofill::PasswordForm password_form; |
312 password_form.origin = GURL("https://accounts.google.com"); | 313 password_form.origin = GURL("https://accounts.google.com"); |
313 password_form.signon_realm = "https://accounts.google.com"; | 314 password_form.signon_realm = "https://accounts.google.com"; |
314 password_form.password_value = base::UTF8ToUTF16("password"); | 315 password_form.password_value = base::UTF8ToUTF16("password"); |
315 helper->PasswordSubmitted(password_form); | 316 helper->PasswordSubmitted(password_form); |
316 } | 317 } |
317 | 318 |
318 content::BrowserContext* OneClickSigninHelperTest::CreateBrowserContext() { | 319 content::BrowserContext* OneClickSigninHelperTest::CreateBrowserContext() { |
319 TestingProfile::Builder builder; | 320 TestingProfile::Builder builder; |
320 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), | 321 builder.AddTestingFactory(ProfileOAuth2TokenServiceFactory::GetInstance(), |
321 FakeProfileOAuth2TokenService::Build); | 322 FakeProfileOAuth2TokenServiceWrapper::Build); |
322 scoped_ptr<TestingProfile> profile = builder.Build(); | 323 scoped_ptr<TestingProfile> profile = builder.Build(); |
323 | 324 |
324 fake_oauth2_token_service_ = | 325 fake_oauth2_token_service_ = |
325 static_cast<FakeProfileOAuth2TokenService*>( | 326 static_cast<FakeProfileOAuth2TokenService*>( |
326 ProfileOAuth2TokenServiceFactory::GetForProfile(profile.get())); | 327 ProfileOAuth2TokenServiceFactory::GetForProfile(profile.get())); |
327 | 328 |
328 return profile.release(); | 329 return profile.release(); |
329 } | 330 } |
330 | 331 |
331 class OneClickSigninHelperIOTest : public OneClickSigninHelperTest { | 332 class OneClickSigninHelperIOTest : public OneClickSigninHelperTest { |
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
838 prefs::kSigninAllowed, base::Value::CreateBooleanValue(true)); | 839 prefs::kSigninAllowed, base::Value::CreateBooleanValue(true)); |
839 | 840 |
840 // Simulate a policy disabling sync by writing kSyncManaged directly. | 841 // Simulate a policy disabling sync by writing kSyncManaged directly. |
841 // We should still offer to sign in the browser. | 842 // We should still offer to sign in the browser. |
842 profile()->GetTestingPrefService()->SetManagedPref( | 843 profile()->GetTestingPrefService()->SetManagedPref( |
843 prefs::kSyncManaged, base::Value::CreateBooleanValue(true)); | 844 prefs::kSyncManaged, base::Value::CreateBooleanValue(true)); |
844 EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, | 845 EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, |
845 OneClickSigninHelper::CanOfferOnIOThreadImpl( | 846 OneClickSigninHelper::CanOfferOnIOThreadImpl( |
846 valid_gaia_url_, &request_, io_data.get())); | 847 valid_gaia_url_, &request_, io_data.get())); |
847 } | 848 } |
OLD | NEW |