| 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 705 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 | 716 |
| 717 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL); | 717 OneClickSigninHelper::CreateForWebContentsWithPasswordManager(contents, NULL); |
| 718 OneClickSigninHelper* helper = | 718 OneClickSigninHelper* helper = |
| 719 OneClickSigninHelper::FromWebContents(contents); | 719 OneClickSigninHelper::FromWebContents(contents); |
| 720 helper->SetDoNotClearPendingEmailForTesting(); | 720 helper->SetDoNotClearPendingEmailForTesting(); |
| 721 helper->auto_accept_ = OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT; | 721 helper->auto_accept_ = OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT; |
| 722 | 722 |
| 723 content::LoadCommittedDetails details; | 723 content::LoadCommittedDetails details; |
| 724 content::FrameNavigateParams params; | 724 content::FrameNavigateParams params; |
| 725 params.url = GURL("http://crbug.com"); | 725 params.url = GURL("http://crbug.com"); |
| 726 params.transition = content::PAGE_TRANSITION_TYPED; | 726 params.transition = ui::PAGE_TRANSITION_TYPED; |
| 727 helper->DidNavigateMainFrame(details, params); | 727 helper->DidNavigateMainFrame(details, params); |
| 728 | 728 |
| 729 EXPECT_EQ(OneClickSigninHelper::AUTO_ACCEPT_NONE, helper->auto_accept_); | 729 EXPECT_EQ(OneClickSigninHelper::AUTO_ACCEPT_NONE, helper->auto_accept_); |
| 730 } | 730 } |
| 731 | 731 |
| 732 TEST_F(OneClickSigninHelperTest, NoRedirectToNTPWithPendingEntry) { | 732 TEST_F(OneClickSigninHelperTest, NoRedirectToNTPWithPendingEntry) { |
| 733 content::NavigationController& controller = web_contents()->GetController(); | 733 content::NavigationController& controller = web_contents()->GetController(); |
| 734 EXPECT_FALSE(controller.GetPendingEntry()); | 734 EXPECT_FALSE(controller.GetPendingEntry()); |
| 735 | 735 |
| 736 const GURL fooWebUIURL("chrome://foo"); | 736 const GURL fooWebUIURL("chrome://foo"); |
| 737 controller.LoadURL(fooWebUIURL, content::Referrer(), | 737 controller.LoadURL(fooWebUIURL, content::Referrer(), |
| 738 content::PAGE_TRANSITION_TYPED, std::string()); | 738 ui::PAGE_TRANSITION_TYPED, std::string()); |
| 739 EXPECT_EQ(fooWebUIURL, controller.GetPendingEntry()->GetURL()); | 739 EXPECT_EQ(fooWebUIURL, controller.GetPendingEntry()->GetURL()); |
| 740 | 740 |
| 741 MockWebContentsDelegate delegate; | 741 MockWebContentsDelegate delegate; |
| 742 EXPECT_CALL(delegate, OpenURLFromTab(_, _)).Times(0); | 742 EXPECT_CALL(delegate, OpenURLFromTab(_, _)).Times(0); |
| 743 web_contents()->SetDelegate(&delegate); | 743 web_contents()->SetDelegate(&delegate); |
| 744 OneClickSigninHelper::RedirectToNtpOrAppsPage( | 744 OneClickSigninHelper::RedirectToNtpOrAppsPage( |
| 745 web_contents(), signin::SOURCE_UNKNOWN); | 745 web_contents(), signin::SOURCE_UNKNOWN); |
| 746 | 746 |
| 747 EXPECT_EQ(fooWebUIURL, controller.GetPendingEntry()->GetURL()); | 747 EXPECT_EQ(fooWebUIURL, controller.GetPendingEntry()->GetURL()); |
| 748 } | 748 } |
| (...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1016 args.email = "foo@gmail.com"; | 1016 args.email = "foo@gmail.com"; |
| 1017 args.profile = profile(); | 1017 args.profile = profile(); |
| 1018 MockStarterWrapper* wrapper = new MockStarterWrapper( | 1018 MockStarterWrapper* wrapper = new MockStarterWrapper( |
| 1019 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); | 1019 args, OneClickSigninSyncStarter::SYNC_WITH_DEFAULT_SETTINGS); |
| 1020 SetCookie("LSID=1234; domain=google.com; secure; httponly"); | 1020 SetCookie("LSID=1234; domain=google.com; secure; httponly"); |
| 1021 | 1021 |
| 1022 EXPECT_CALL(*wrapper, DisplayErrorBubble(_)); | 1022 EXPECT_CALL(*wrapper, DisplayErrorBubble(_)); |
| 1023 wrapper->Start(); | 1023 wrapper->Start(); |
| 1024 base::RunLoop().RunUntilIdle(); | 1024 base::RunLoop().RunUntilIdle(); |
| 1025 } | 1025 } |
| OLD | NEW |