Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(15)

Side by Side Diff: chrome/browser/ui/sync/one_click_signin_helper_unittest.cc

Issue 19705013: [password autofill] Remove references to PasswordForm from RenderViewImpl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Callback Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 EXPECT_CALL(*sync_service, sync_initialized()).WillRepeatedly(Return(true)); 315 EXPECT_CALL(*sync_service, sync_initialized()).WillRepeatedly(Return(true));
316 return sync_service; 316 return sync_service;
317 } 317 }
318 318
319 void OneClickSigninHelperTest::SubmitGAIAPassword( 319 void OneClickSigninHelperTest::SubmitGAIAPassword(
320 OneClickSigninHelper* helper) { 320 OneClickSigninHelper* helper) {
321 content::PasswordForm password_form; 321 content::PasswordForm password_form;
322 password_form.origin = GURL("https://accounts.google.com"); 322 password_form.origin = GURL("https://accounts.google.com");
323 password_form.signon_realm = "https://accounts.google.com"; 323 password_form.signon_realm = "https://accounts.google.com";
324 password_form.password_value = UTF8ToUTF16("password"); 324 password_form.password_value = UTF8ToUTF16("password");
325 helper->OnFormSubmitted(password_form); 325 helper->PasswordSubmitted(password_form);
326 } 326 }
327 327
328 class OneClickSigninHelperIOTest : public OneClickSigninHelperTest { 328 class OneClickSigninHelperIOTest : public OneClickSigninHelperTest {
329 public: 329 public:
330 OneClickSigninHelperIOTest(); 330 OneClickSigninHelperIOTest();
331 331
332 virtual void SetUp() OVERRIDE; 332 virtual void SetUp() OVERRIDE;
333 333
334 TestProfileIOData* CreateTestProfileIOData(bool is_incognito); 334 TestProfileIOData* CreateTestProfileIOData(bool is_incognito);
335 335
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 // and upon successful setup, redirect back to webstore. 640 // and upon successful setup, redirect back to webstore.
641 TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) { 641 TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) {
642 CreateSigninManager(false, std::string()); 642 CreateSigninManager(false, std::string());
643 EXPECT_CALL(*signin_manager_, IsAllowedUsername(_)) 643 EXPECT_CALL(*signin_manager_, IsAllowedUsername(_))
644 .WillRepeatedly(Return(true)); 644 .WillRepeatedly(Return(true));
645 645
646 CreateProfileSyncServiceMock(); 646 CreateProfileSyncServiceMock();
647 647
648 content::WebContents* contents = web_contents(); 648 content::WebContents* contents = web_contents();
649 649
650 OneClickSigninHelper::CreateForWebContents(contents); 650 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL);
651 OneClickSigninHelper* helper = 651 OneClickSigninHelper* helper =
652 OneClickSigninHelper::FromWebContents(contents); 652 OneClickSigninHelper::FromWebContents(contents);
653 helper->SetDoNotClearPendingEmailForTesting(); 653 helper->SetDoNotClearPendingEmailForTesting();
654 654
655 GURL continueUrl("https://chrome.google.com/webstore?source=5"); 655 GURL continueUrl("https://chrome.google.com/webstore?source=5");
656 OneClickSigninHelper::ShowInfoBarUIThread( 656 OneClickSigninHelper::ShowInfoBarUIThread(
657 "session_index", "user@gmail.com", 657 "session_index", "user@gmail.com",
658 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, 658 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT,
659 SyncPromoUI::SOURCE_WEBSTORE_INSTALL, 659 SyncPromoUI::SOURCE_WEBSTORE_INSTALL,
660 continueUrl, process()->GetID(), rvh()->GetRoutingID()); 660 continueUrl, process()->GetID(), rvh()->GetRoutingID());
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 prefs::kSigninAllowed, base::Value::CreateBooleanValue(true)); 818 prefs::kSigninAllowed, base::Value::CreateBooleanValue(true));
819 819
820 // Simulate a policy disabling sync by writing kSyncManaged directly. 820 // Simulate a policy disabling sync by writing kSyncManaged directly.
821 // We should still offer to sign in the browser. 821 // We should still offer to sign in the browser.
822 profile()->GetTestingPrefService()->SetManagedPref( 822 profile()->GetTestingPrefService()->SetManagedPref(
823 prefs::kSyncManaged, base::Value::CreateBooleanValue(true)); 823 prefs::kSyncManaged, base::Value::CreateBooleanValue(true));
824 EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, 824 EXPECT_EQ(OneClickSigninHelper::CAN_OFFER,
825 OneClickSigninHelper::CanOfferOnIOThreadImpl( 825 OneClickSigninHelper::CanOfferOnIOThreadImpl(
826 valid_gaia_url_, std::string(), &request_, io_data.get())); 826 valid_gaia_url_, std::string(), &request_, io_data.get()));
827 } 827 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698