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

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: Restore incorrectly deleted code Created 6 years, 2 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
664 OneClickSigninHelper* helper = 664 OneClickSigninHelper* helper =
665 OneClickSigninHelper::FromWebContents(web_contents()); 665 OneClickSigninHelper::FromWebContents(web_contents());
666 EXPECT_EQ(NULL, helper); 666 EXPECT_EQ(NULL, helper);
667 667
668 OneClickSigninHelper::ShowInfoBarUIThread( 668 OneClickSigninHelper::ShowInfoBarUIThread(
669 "session_index", "email", OneClickSigninHelper::AUTO_ACCEPT_ACCEPTED, 669 "session_index", "email", OneClickSigninHelper::AUTO_ACCEPT_ACCEPTED,
670 signin::SOURCE_UNKNOWN, GURL(), process()->GetID(), 670 signin::SOURCE_UNKNOWN, GURL(), process()->GetID(),
671 rvh()->GetRoutingID()); 671 rvh()->GetRoutingID());
672 } 672 }
673 673
674 // If Chrome signin is triggered from a webstore install, and user chooses to
675 // config sync, then Chrome should redirect immediately to sync settings page,
676 // and upon successful setup, redirect back to webstore.
677 TEST_F(OneClickSigninHelperTest, SigninFromWebstoreWithConfigSyncfirst) {
678 SetUpSigninManager(std::string());
679 EXPECT_CALL(*signin_manager_, IsAllowedUsername(_))
680 .WillRepeatedly(Return(true));
681
682 OneClickTestProfileSyncService* sync_service =
683 static_cast<OneClickTestProfileSyncService*>(
684 ProfileSyncServiceFactory::GetInstance()->SetTestingFactoryAndUse(
685 profile(), OneClickTestProfileSyncService::Build));
686 sync_service->set_sync_initialized(true);
687
688 content::WebContents* contents = web_contents();
689
690 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL);
691 OneClickSigninHelper* helper =
692 OneClickSigninHelper::FromWebContents(contents);
693 helper->SetDoNotClearPendingEmailForTesting();
694 helper->set_do_not_start_sync_for_testing();
695
696 GURL continueUrl("https://chrome.google.com/webstore?source=5");
697 OneClickSigninHelper::ShowInfoBarUIThread(
698 "session_index", "user@gmail.com",
699 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT,
700 signin::SOURCE_WEBSTORE_INSTALL,
701 continueUrl, process()->GetID(), rvh()->GetRoutingID());
702
703 SubmitGAIAPassword(helper);
704
705 NavigateAndCommit(GURL("https://chrome.google.com/webstore?source=3"));
706 helper->DidStopLoading(rvh());
707 sync_service->NotifyObservers();
708 EXPECT_EQ(GURL(continueUrl), contents->GetVisibleURL());
709 }
710
711 // Checks that the state of OneClickSigninHelper is cleaned when there is a 674 // Checks that the state of OneClickSigninHelper is cleaned when there is a
712 // navigation away from the sign in flow that is not triggered by the 675 // navigation away from the sign in flow that is not triggered by the
713 // web contents. 676 // web contents.
714 TEST_F(OneClickSigninHelperTest, CleanTransientStateOnNavigate) { 677 TEST_F(OneClickSigninHelperTest, CleanTransientStateOnNavigate) {
715 content::WebContents* contents = web_contents(); 678 content::WebContents* contents = web_contents();
716 679
717 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL); 680 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL);
718 OneClickSigninHelper* helper = 681 OneClickSigninHelper* helper =
719 OneClickSigninHelper::FromWebContents(contents); 682 OneClickSigninHelper::FromWebContents(contents);
720 helper->SetDoNotClearPendingEmailForTesting(); 683 helper->SetDoNotClearPendingEmailForTesting();
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
1016 args.email = "foo@gmail.com"; 979 args.email = "foo@gmail.com";
1017 args.profile = profile(); 980 args.profile = profile();
1018 MockStarterWrapper* wrapper = new MockStarterWrapper( 981 MockStarterWrapper* wrapper = new MockStarterWrapper(
1019 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); 982 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS);
1020 SetCookie("LSID=1234; domain=google.com; secure; httponly"); 983 SetCookie("LSID=1234; domain=google.com; secure; httponly");
1021 984
1022 EXPECT_CALL(*wrapper, DisplayErrorBubble(_)); 985 EXPECT_CALL(*wrapper, DisplayErrorBubble(_));
1023 wrapper->Start(); 986 wrapper->Start();
1024 base::RunLoop().RunUntilIdle(); 987 base::RunLoop().RunUntilIdle();
1025 } 988 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/sync/one_click_signin_helper.cc ('k') | chrome/browser/ui/webui/signin/inline_login_handler_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698