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/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 Loading... |
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 Loading... |
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 } |
OLD | NEW |