| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 const std::string& gaia_id, | 173 const std::string& gaia_id, |
| 174 const std::string& password, | 174 const std::string& password, |
| 175 const std::string& session_index, | 175 const std::string& session_index, |
| 176 const std::string& auth_code, | 176 const std::string& auth_code, |
| 177 const std::string& signin_scoped_device_id, | 177 const std::string& signin_scoped_device_id, |
| 178 bool choose_what_to_sync, | 178 bool choose_what_to_sync, |
| 179 bool confirm_untrusted_signin) | 179 bool confirm_untrusted_signin) |
| 180 : InlineSigninHelper(handler, | 180 : InlineSigninHelper(handler, |
| 181 getter, | 181 getter, |
| 182 profile, | 182 profile, |
| 183 Profile::CreateStatus::CREATE_STATUS_INITIALIZED, |
| 183 current_url, | 184 current_url, |
| 184 email, | 185 email, |
| 185 gaia_id, | 186 gaia_id, |
| 186 password, | 187 password, |
| 187 session_index, | 188 session_index, |
| 188 auth_code, | 189 auth_code, |
| 189 signin_scoped_device_id, | 190 signin_scoped_device_id, |
| 190 choose_what_to_sync, | 191 choose_what_to_sync, |
| 191 confirm_untrusted_signin) {} | 192 confirm_untrusted_signin) {} |
| 192 | 193 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 const std::string& gaia_id, | 231 const std::string& gaia_id, |
| 231 const std::string& password, | 232 const std::string& password, |
| 232 const std::string& session_index, | 233 const std::string& session_index, |
| 233 const std::string& auth_code, | 234 const std::string& auth_code, |
| 234 const std::string& signin_scoped_device_id, | 235 const std::string& signin_scoped_device_id, |
| 235 bool choose_what_to_sync, | 236 bool choose_what_to_sync, |
| 236 bool confirm_untrusted_signin) | 237 bool confirm_untrusted_signin) |
| 237 : InlineSigninHelper(handler, | 238 : InlineSigninHelper(handler, |
| 238 getter, | 239 getter, |
| 239 profile, | 240 profile, |
| 241 Profile::CreateStatus::CREATE_STATUS_INITIALIZED, |
| 240 current_url, | 242 current_url, |
| 241 email, | 243 email, |
| 242 gaia_id, | 244 gaia_id, |
| 243 password, | 245 password, |
| 244 session_index, | 246 session_index, |
| 245 auth_code, | 247 auth_code, |
| 246 signin_scoped_device_id, | 248 signin_scoped_device_id, |
| 247 choose_what_to_sync, | 249 choose_what_to_sync, |
| 248 confirm_untrusted_signin) {} | 250 confirm_untrusted_signin) {} |
| 249 | 251 |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 709 ReauthCallsUpdateCredentials) { | 711 ReauthCallsUpdateCredentials) { |
| 710 ASSERT_EQ(0ul, token_service()->GetAccounts().size()); | 712 ASSERT_EQ(0ul, token_service()->GetAccounts().size()); |
| 711 | 713 |
| 712 // See Source enum in components/signin/core/browser/signin_metrics.h for | 714 // See Source enum in components/signin/core/browser/signin_metrics.h for |
| 713 // possible values of access_point=, reason=. | 715 // possible values of access_point=, reason=. |
| 714 GURL url("chrome://chrome-signin/?access_point=3&reason=2"); | 716 GURL url("chrome://chrome-signin/?access_point=3&reason=2"); |
| 715 base::WeakPtr<InlineLoginHandlerImpl> handler; | 717 base::WeakPtr<InlineLoginHandlerImpl> handler; |
| 716 InlineSigninHelper helper(handler, | 718 InlineSigninHelper helper(handler, |
| 717 browser()->profile()->GetRequestContext(), | 719 browser()->profile()->GetRequestContext(), |
| 718 browser()->profile(), | 720 browser()->profile(), |
| 721 Profile::CreateStatus::CREATE_STATUS_INITIALIZED, |
| 719 url, | 722 url, |
| 720 "foo@gmail.com", | 723 "foo@gmail.com", |
| 721 "gaiaid-12345", | 724 "gaiaid-12345", |
| 722 "password", | 725 "password", |
| 723 "", // session index | 726 "", // session index |
| 724 "auth_code", // auth code | 727 "auth_code", // auth code |
| 725 std::string(), | 728 std::string(), |
| 726 false, // choose what to sync | 729 false, // choose what to sync |
| 727 false); // confirm untrusted signin | 730 false); // confirm untrusted signin |
| 728 SimulateOnClientOAuthSuccess(&helper, "refresh_token"); | 731 SimulateOnClientOAuthSuccess(&helper, "refresh_token"); |
| 729 ASSERT_EQ(1ul, token_service()->GetAccounts().size()); | 732 ASSERT_EQ(1ul, token_service()->GetAccounts().size()); |
| 730 base::RunLoop().RunUntilIdle(); | 733 base::RunLoop().RunUntilIdle(); |
| 731 } | 734 } |
| 732 | 735 |
| 733 // Test signin helper does not create sync starter when adding another account | 736 // Test signin helper does not create sync starter when adding another account |
| 734 // to profile. | 737 // to profile. |
| 735 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, | 738 IN_PROC_BROWSER_TEST_F(InlineLoginHelperBrowserTest, |
| 736 AddAccountsCallsUpdateCredentials) { | 739 AddAccountsCallsUpdateCredentials) { |
| 737 ASSERT_EQ(0ul, token_service()->GetAccounts().size()); | 740 ASSERT_EQ(0ul, token_service()->GetAccounts().size()); |
| 738 | 741 |
| 739 // See Source enum in components/signin/core/browser/signin_metrics.h for | 742 // See Source enum in components/signin/core/browser/signin_metrics.h for |
| 740 // possible values of access_point=, reason=. | 743 // possible values of access_point=, reason=. |
| 741 GURL url("chrome://chrome-signin/?access_point=10&reason=1"); | 744 GURL url("chrome://chrome-signin/?access_point=10&reason=1"); |
| 742 base::WeakPtr<InlineLoginHandlerImpl> handler; | 745 base::WeakPtr<InlineLoginHandlerImpl> handler; |
| 743 InlineSigninHelper helper(handler, | 746 InlineSigninHelper helper(handler, |
| 744 browser()->profile()->GetRequestContext(), | 747 browser()->profile()->GetRequestContext(), |
| 745 browser()->profile(), | 748 browser()->profile(), |
| 749 Profile::CreateStatus::CREATE_STATUS_INITIALIZED, |
| 746 url, | 750 url, |
| 747 "foo@gmail.com", | 751 "foo@gmail.com", |
| 748 "gaiaid-12345", | 752 "gaiaid-12345", |
| 749 "password", | 753 "password", |
| 750 "", // session index | 754 "", // session index |
| 751 "auth_code", // auth code | 755 "auth_code", // auth code |
| 752 std::string(), | 756 std::string(), |
| 753 false, // choose what to sync | 757 false, // choose what to sync |
| 754 false); // confirm untrusted signin | 758 false); // confirm untrusted signin |
| 755 SimulateOnClientOAuthSuccess(&helper, "refresh_token"); | 759 SimulateOnClientOAuthSuccess(&helper, "refresh_token"); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 849 content::WebContents* contents = | 853 content::WebContents* contents = |
| 850 browser()->tab_strip_model()->GetActiveWebContents(); | 854 browser()->tab_strip_model()->GetActiveWebContents(); |
| 851 ASSERT_TRUE(content::ExecuteScript( | 855 ASSERT_TRUE(content::ExecuteScript( |
| 852 contents, "window.location.href = 'chrome://foo'")); | 856 contents, "window.location.href = 'chrome://foo'")); |
| 853 | 857 |
| 854 content::TestNavigationObserver navigation_observer(contents, 1); | 858 content::TestNavigationObserver navigation_observer(contents, 1); |
| 855 navigation_observer.Wait(); | 859 navigation_observer.Wait(); |
| 856 | 860 |
| 857 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); | 861 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); |
| 858 } | 862 } |
| OLD | NEW |