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/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/content_settings/cookie_settings.h" | 8 #include "chrome/browser/content_settings/cookie_settings.h" |
9 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 9 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
10 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 10 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 EXPECT_CALL(*sync_service, sync_initialized()).WillRepeatedly(Return(true)); | 316 EXPECT_CALL(*sync_service, sync_initialized()).WillRepeatedly(Return(true)); |
317 return sync_service; | 317 return sync_service; |
318 } | 318 } |
319 | 319 |
320 void OneClickSigninHelperTest::SubmitGAIAPassword( | 320 void OneClickSigninHelperTest::SubmitGAIAPassword( |
321 OneClickSigninHelper* helper) { | 321 OneClickSigninHelper* helper) { |
322 content::PasswordForm password_form; | 322 content::PasswordForm password_form; |
323 password_form.origin = GURL("https://accounts.google.com"); | 323 password_form.origin = GURL("https://accounts.google.com"); |
324 password_form.signon_realm = "https://accounts.google.com"; | 324 password_form.signon_realm = "https://accounts.google.com"; |
325 password_form.password_value = UTF8ToUTF16("password"); | 325 password_form.password_value = UTF8ToUTF16("password"); |
326 helper->OnFormSubmitted(password_form); | 326 helper->PasswordSubmitted(password_form); |
327 } | 327 } |
328 | 328 |
329 class OneClickSigninHelperIOTest : public OneClickSigninHelperTest { | 329 class OneClickSigninHelperIOTest : public OneClickSigninHelperTest { |
330 public: | 330 public: |
331 OneClickSigninHelperIOTest(); | 331 OneClickSigninHelperIOTest(); |
332 | 332 |
333 virtual void SetUp() OVERRIDE; | 333 virtual void SetUp() OVERRIDE; |
334 | 334 |
335 TestProfileIOData* CreateTestProfileIOData(bool is_incognito); | 335 TestProfileIOData* CreateTestProfileIOData(bool is_incognito); |
336 | 336 |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
641 // and upon successful setup, redirect back to webstore. | 641 // and upon successful setup, redirect back to webstore. |
642 TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) { | 642 TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) { |
643 CreateSigninManager(false, std::string()); | 643 CreateSigninManager(false, std::string()); |
644 EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)) | 644 EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)) |
645 .WillRepeatedly(Return(true)); | 645 .WillRepeatedly(Return(true)); |
646 | 646 |
647 CreateProfileSyncServiceMock(); | 647 CreateProfileSyncServiceMock(); |
648 | 648 |
649 content::WebContents* contents = web_contents(); | 649 content::WebContents* contents = web_contents(); |
650 | 650 |
651 OneClickSigninHelper::CreateForWebContents(contents); | 651 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL); |
652 OneClickSigninHelper* helper = | 652 OneClickSigninHelper* helper = |
653 OneClickSigninHelper::FromWebContents(contents); | 653 OneClickSigninHelper::FromWebContents(contents); |
654 helper->SetDoNotClearPendingEmailForTesting(); | 654 helper->SetDoNotClearPendingEmailForTesting(); |
655 | 655 |
656 GURL continueUrl("https://chrome.google.com/webstore?source=5"); | 656 GURL continueUrl("https://chrome.google.com/webstore?source=5"); |
657 OneClickSigninHelper::ShowInfoBarUIThread( | 657 OneClickSigninHelper::ShowInfoBarUIThread( |
658 "session_index", "user@gmail.com", | 658 "session_index", "user@gmail.com", |
659 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, | 659 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, |
660 signin::SOURCE_WEBSTORE_INSTALL, | 660 signin::SOURCE_WEBSTORE_INSTALL, |
661 continueUrl, process()->GetID(), rvh()->GetRoutingID()); | 661 continueUrl, process()->GetID(), rvh()->GetRoutingID()); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 prefs::kSigninAllowed, base::Value::CreateBooleanValue(true)); | 819 prefs::kSigninAllowed, base::Value::CreateBooleanValue(true)); |
820 | 820 |
821 // Simulate a policy disabling sync by writing kSyncManaged directly. | 821 // Simulate a policy disabling sync by writing kSyncManaged directly. |
822 // We should still offer to sign in the browser. | 822 // We should still offer to sign in the browser. |
823 profile()->GetTestingPrefService()->SetManagedPref( | 823 profile()->GetTestingPrefService()->SetManagedPref( |
824 prefs::kSyncManaged, base::Value::CreateBooleanValue(true)); | 824 prefs::kSyncManaged, base::Value::CreateBooleanValue(true)); |
825 EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, | 825 EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, |
826 OneClickSigninHelper::CanOfferOnIOThreadImpl( | 826 OneClickSigninHelper::CanOfferOnIOThreadImpl( |
827 valid_gaia_url_, std::string(), &request_, io_data.get())); | 827 valid_gaia_url_, std::string(), &request_, io_data.get())); |
828 } | 828 } |
OLD | NEW |