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

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

Issue 579033002: [Clean-up] Remove some dead code for handling Webstore sign-in. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
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/prefs/scoped_user_pref_update.h" 6 #include "base/prefs/scoped_user_pref_update.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 OneClickSigninHelper* helper = 662 OneClickSigninHelper* helper =
663 OneClickSigninHelper::FromWebContents(web_contents()); 663 OneClickSigninHelper::FromWebContents(web_contents());
664 EXPECT_EQ(NULL, helper); 664 EXPECT_EQ(NULL, helper);
665 665
666 OneClickSigninHelper::ShowInfoBarUIThread( 666 OneClickSigninHelper::ShowInfoBarUIThread(
667 "session_index", "email", OneClickSigninHelper::AUTO_ACCEPT_ACCEPTED, 667 "session_index", "email", OneClickSigninHelper::AUTO_ACCEPT_ACCEPTED,
668 signin::SOURCE_UNKNOWN, GURL(), process()->GetID(), 668 signin::SOURCE_UNKNOWN, GURL(), process()->GetID(),
669 rvh()->GetRoutingID()); 669 rvh()->GetRoutingID());
670 } 670 }
671 671
672 // If Chrome signin is triggered from a webstore install, and user chooses to
673 // config sync, then Chrome should redirect immediately to sync settings page,
674 // and upon successful setup, redirect back to webstore.
675 TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) {
676 SetUpSigninManager(std::string());
677 EXPECT_CALL(*signin_manager_, IsAllowedUsername(_))
678 .WillRepeatedly(Return(true));
679
680 OneClickTestProfileSyncService* sync_service =
681 static_cast<OneClickTestProfileSyncService*>(
682 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
683 profile(), OneClickTestProfileSyncService::Build));
684 sync_service->set_sync_initialized(true);
685
686 content::WebContents* contents = web_contents();
687
688 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL);
689 OneClickSigninHelper* helper =
690 OneClickSigninHelper::FromWebContents(contents);
691 helper->SetDoNotClearPendingEmailForTesting();
692 helper->set_do_not_start_sync_for_testing();
693
694 GURL continueUrl("https://chrome.google.com/webstore?source=5");
695 OneClickSigninHelper::ShowInfoBarUIThread(
696 "session_index", "user@gmail.com",
697 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT,
698 signin::SOURCE_WEBSTORE_INSTALL,
699 continueUrl, process()->GetID(), rvh()->GetRoutingID());
700
701 SubmitGAIAPassword(helper);
702
703 NavigateAndCommit(GURL("https://chrome.google.com/webstore?source=3"));
704 helper->DidStopLoading(rvh());
705 sync_service->NotifyObservers();
706 EXPECT_EQ(GURL(continueUrl), contents->GetVisibleURL());
707 }
708
709 // Checks that the state of OneClickSigninHelper is cleaned when there is a 672 // Checks that the state of OneClickSigninHelper is cleaned when there is a
710 // navigation away from the sign in flow that is not triggered by the 673 // navigation away from the sign in flow that is not triggered by the
711 // web contents. 674 // web contents.
712 TEST_F(OneClickSigninHelperTest, CleanTransientStateOnNavigate) { 675 TEST_F(OneClickSigninHelperTest, CleanTransientStateOnNavigate) {
713 content::WebContents* contents = web_contents(); 676 content::WebContents* contents = web_contents();
714 677
715 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL); 678 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL);
716 OneClickSigninHelper* helper = 679 OneClickSigninHelper* helper =
717 OneClickSigninHelper::FromWebContents(contents); 680 OneClickSigninHelper::FromWebContents(contents);
718 helper->SetDoNotClearPendingEmailForTesting(); 681 helper->SetDoNotClearPendingEmailForTesting();
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 args.email = "foo@gmail.com"; 977 args.email = "foo@gmail.com";
1015 args.profile = profile(); 978 args.profile = profile();
1016 MockStarterWrapper* wrapper = new MockStarterWrapper( 979 MockStarterWrapper* wrapper = new MockStarterWrapper(
1017 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); 980 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS);
1018 SetCookie("LSID=1234; domain=google.com; secure; httponly"); 981 SetCookie("LSID=1234; domain=google.com; secure; httponly");
1019 982
1020 EXPECT_CALL(*wrapper, DisplayErrorBubble(_)); 983 EXPECT_CALL(*wrapper, DisplayErrorBubble(_));
1021 wrapper->Start(); 984 wrapper->Start();
1022 base::RunLoop().RunUntilIdle(); 985 base::RunLoop().RunUntilIdle();
1023 } 986 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698