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 647 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
658 // Should not crash if a helper instance is not associated with an incognito | 658 // Should not crash if a helper instance is not associated with an incognito |
659 // web contents. | 659 // web contents. |
660 TEST_F(OneClickSigninHelperIncognitoTest, ShowInfoBarUIThreadIncognito) { | 660 TEST_F(OneClickSigninHelperIncognitoTest, ShowInfoBarUIThreadIncognito) { |
661 SetUpSigninManager(std::string()); | 661 SetUpSigninManager(std::string()); |
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_metrics::SOURCE_UNKNOWN, GURL(), process()->GetID(), |
669 rvh()->GetRoutingID()); | 669 rvh()->GetRoutingID()); |
670 } | 670 } |
671 | 671 |
672 // 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 |
673 // 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 |
674 // web contents. | 674 // web contents. |
675 TEST_F(OneClickSigninHelperTest, CleanTransientStateOnNavigate) { | 675 TEST_F(OneClickSigninHelperTest, CleanTransientStateOnNavigate) { |
676 content::WebContents* contents = web_contents(); | 676 content::WebContents* contents = web_contents(); |
677 | 677 |
678 OneClickSigninHelper::CreateForWebContents(contents); | 678 OneClickSigninHelper::CreateForWebContents(contents); |
(...skipping 17 matching lines...) Expand all Loading... |
696 | 696 |
697 const GURL fooWebUIURL("chrome://foo"); | 697 const GURL fooWebUIURL("chrome://foo"); |
698 controller.LoadURL(fooWebUIURL, content::Referrer(), | 698 controller.LoadURL(fooWebUIURL, content::Referrer(), |
699 ui::PAGE_TRANSITION_TYPED, std::string()); | 699 ui::PAGE_TRANSITION_TYPED, std::string()); |
700 EXPECT_EQ(fooWebUIURL, controller.GetPendingEntry()->GetURL()); | 700 EXPECT_EQ(fooWebUIURL, controller.GetPendingEntry()->GetURL()); |
701 | 701 |
702 MockWebContentsDelegate delegate; | 702 MockWebContentsDelegate delegate; |
703 EXPECT_CALL(delegate, OpenURLFromTab(_, _)).Times(0); | 703 EXPECT_CALL(delegate, OpenURLFromTab(_, _)).Times(0); |
704 web_contents()->SetDelegate(&delegate); | 704 web_contents()->SetDelegate(&delegate); |
705 OneClickSigninHelper::RedirectToNtpOrAppsPage( | 705 OneClickSigninHelper::RedirectToNtpOrAppsPage( |
706 web_contents(), signin::SOURCE_UNKNOWN); | 706 web_contents(), signin_metrics::SOURCE_UNKNOWN); |
707 | 707 |
708 EXPECT_EQ(fooWebUIURL, controller.GetPendingEntry()->GetURL()); | 708 EXPECT_EQ(fooWebUIURL, controller.GetPendingEntry()->GetURL()); |
709 } | 709 } |
710 | 710 |
711 // I/O thread tests | 711 // I/O thread tests |
712 | 712 |
713 TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThread) { | 713 TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThread) { |
714 scoped_ptr<TestProfileIOData> io_data( | 714 scoped_ptr<TestProfileIOData> io_data( |
715 CreateTestProfileIOData(Profile::REGULAR_PROFILE)); | 715 CreateTestProfileIOData(Profile::REGULAR_PROFILE)); |
716 EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, | 716 EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
977 args.email = "foo@gmail.com"; | 977 args.email = "foo@gmail.com"; |
978 args.profile = profile(); | 978 args.profile = profile(); |
979 MockStarterWrapper* wrapper = new MockStarterWrapper( | 979 MockStarterWrapper* wrapper = new MockStarterWrapper( |
980 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); | 980 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); |
981 SetCookie("LSID=1234; domain=google.com; secure; httponly"); | 981 SetCookie("LSID=1234; domain=google.com; secure; httponly"); |
982 | 982 |
983 EXPECT_CALL(*wrapper, DisplayErrorBubble(_)); | 983 EXPECT_CALL(*wrapper, DisplayErrorBubble(_)); |
984 wrapper->Start(); | 984 wrapper->Start(); |
985 base::RunLoop().RunUntilIdle(); | 985 base::RunLoop().RunUntilIdle(); |
986 } | 986 } |
OLD | NEW |