diff options
17 files changed, 148 insertions, 509 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index 10766af..3f1a699 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -15060,14 +15060,6 @@ To configure restrictions for this limited user, please sign into your account a Dark Theme </message> - <message name="IDS_FLAGS_USE_CLIENT_LOGIN_SIGNIN_FLOW_NAME" desc="Name of about:flag option to turn on ClientLogin sign in"> - Enable ClientLogin signin - </message> - <message name="IDS_FLAGS_USE_CLIENT_LOGIN_SIGNIN_FLOW_DESCRIPTION" desc="Description of about:flag option to turn on ClientLogin sign in"> - When enabled, will use a ClientLogin sign in flow to connect a profile to a Google account. Otherwise use a web-based flow. - The web-based flow permits using verification codes instead of ASPs during authentication. - </message> - <message name="IDS_FLAGS_DESKTOP_GUEST_MODE_NAME" desc="Name of about:flags option to turn on desktop guest mode"> Enable desktop guest mode </message> diff --git a/chrome/browser/about_flags.cc b/chrome/browser/about_flags.cc index 22296d0..0ad69f6 100644 --- a/chrome/browser/about_flags.cc +++ b/chrome/browser/about_flags.cc @@ -981,13 +981,6 @@ const Experiment kExperiments[] = { }, #endif { - "use-client-login-signin-flow", - IDS_FLAGS_USE_CLIENT_LOGIN_SIGNIN_FLOW_NAME, - IDS_FLAGS_USE_CLIENT_LOGIN_SIGNIN_FLOW_DESCRIPTION, - kOsMac | kOsWin | kOsLinux, - SINGLE_VALUE_TYPE(switches::kUseClientLoginSigninFlow) - }, - { "enable-desktop-guest-mode", IDS_FLAGS_DESKTOP_GUEST_MODE_NAME, IDS_FLAGS_DESKTOP_GUEST_MODE_DESCRIPTION, diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index f5c40b3..5a0ea0d 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -585,11 +585,10 @@ void FirstRunBubbleLauncher::Observe( // Suppress the first run bubble if a Gaia sign in page or the continue // URL for the sign in page is showing. - if (SyncPromoUI::UseWebBasedSigninFlow()) { - if (gaia::IsGaiaSignonRealm(contents->GetURL().GetOrigin()) || - SyncPromoUI::IsContinueUrlForWebBasedSigninFlow(contents->GetURL())) { - return; - } + if (contents && + (gaia::IsGaiaSignonRealm(contents->GetURL().GetOrigin()) || + SyncPromoUI::IsContinueUrlForWebBasedSigninFlow(contents->GetURL()))) { + return; } if (contents && contents->GetURL().SchemeIs(chrome::kChromeUIScheme)) { diff --git a/chrome/browser/signin/signin_browsertest.cc b/chrome/browser/signin/signin_browsertest.cc index 3b2644a..f352937 100644 --- a/chrome/browser/signin/signin_browsertest.cc +++ b/chrome/browser/signin/signin_browsertest.cc @@ -64,14 +64,18 @@ class SigninBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(SigninBrowserTest, ProcessIsolation) { // If the one-click-signin feature is not enabled (e.g Chrome OS), we // never grant signin privileges to any renderer processes. - const bool kOneClickSigninEnabled = SyncPromoUI::UseWebBasedSigninFlow(); +#if defined(ENABLE_ONE_CLICK_SIGNIN) + const bool kOneClickSigninEnabled = true; +#else + const bool kOneClickSigninEnabled = false; +#endif SigninManager* signin = SigninManagerFactory::GetForProfile( browser()->profile()); EXPECT_FALSE(signin->HasSigninProcess()); ui_test_utils::NavigateToURL(browser(), SyncPromoUI::GetSyncPromoURL( - GURL(), SyncPromoUI::SOURCE_NTP_LINK, true)); + SyncPromoUI::SOURCE_NTP_LINK, true)); EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); // Navigating away should change the process. @@ -79,7 +83,7 @@ IN_PROC_BROWSER_TEST_F(SigninBrowserTest, ProcessIsolation) { EXPECT_FALSE(signin->HasSigninProcess()); ui_test_utils::NavigateToURL(browser(), SyncPromoUI::GetSyncPromoURL( - GURL(), SyncPromoUI::SOURCE_NTP_LINK, true)); + SyncPromoUI::SOURCE_NTP_LINK, true)); EXPECT_EQ(kOneClickSigninEnabled, signin->HasSigninProcess()); content::WebContents* active_tab = @@ -94,8 +98,7 @@ IN_PROC_BROWSER_TEST_F(SigninBrowserTest, ProcessIsolation) { // shouldn't change anything. chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( browser(), - GURL(SyncPromoUI::GetSyncPromoURL(GURL(), - SyncPromoUI::SOURCE_NTP_LINK, + GURL(SyncPromoUI::GetSyncPromoURL(SyncPromoUI::SOURCE_NTP_LINK, false)))); params.path_behavior = chrome::NavigateParams::IGNORE_AND_NAVIGATE; ShowSingletonTabOverwritingNTP(browser(), params); diff --git a/chrome/browser/ui/chrome_pages.cc b/chrome/browser/ui/chrome_pages.cc index fc68e6b..9e3500b 100644 --- a/chrome/browser/ui/chrome_pages.cc +++ b/chrome/browser/ui/chrome_pages.cc @@ -233,8 +233,7 @@ void ShowBrowserSignin(Browser* browser, SyncPromoUI::Source source) { original_profile); if (use_web_flow || (show_promo && login->current_login_ui() == NULL)) { NavigateToSingletonTab(browser, - GURL(SyncPromoUI::GetSyncPromoURL(GURL(), - source, + GURL(SyncPromoUI::GetSyncPromoURL(source, false))); } else { if (login->current_login_ui()) { diff --git a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm index 84222c2..db6aaa8 100644 --- a/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm +++ b/chrome/browser/ui/cocoa/extensions/extension_installed_bubble_controller.mm @@ -200,11 +200,11 @@ class ExtensionLoadedNotificationObserver clickedOnLink:(id)link atIndex:(NSUInteger)charIndex { DCHECK_EQ(promo_.get(), aTextView); - std::string promo_url = + GURL promo_url = SyncPromoUI::GetSyncPromoURL( - GURL(), SyncPromoUI::SOURCE_EXTENSION_INSTALL_BUBBLE, false).spec(); - chrome::NavigateParams params(chrome::GetSingletonTabNavigateParams( - browser_, GURL(promo_url))); + SyncPromoUI::SOURCE_EXTENSION_INSTALL_BUBBLE, false); + chrome::NavigateParams params( + chrome::GetSingletonTabNavigateParams(browser_, promo_url)); chrome::Navigate(¶ms); return YES; } diff --git a/chrome/browser/ui/startup/startup_browser_creator_impl.cc b/chrome/browser/ui/startup/startup_browser_creator_impl.cc index 594b4a1..2985e38 100644 --- a/chrome/browser/ui/startup/startup_browser_creator_impl.cc +++ b/chrome/browser/ui/startup/startup_browser_creator_impl.cc @@ -276,11 +276,8 @@ void AddSyncPromoTab(Profile* profile, StartupTabs* tabs) { SyncPromoUI::DidShowSyncPromoAtStartup(profile); StartupTab sync_promo_tab; - GURL continue_url; - if (!SyncPromoUI::UseWebBasedSigninFlow()) - continue_url = GURL(chrome::kChromeUINewTabURL); sync_promo_tab.url = SyncPromoUI::GetSyncPromoURL( - continue_url, SyncPromoUI::SOURCE_START_PAGE, false); + SyncPromoUI::SOURCE_START_PAGE, false); sync_promo_tab.is_pinned = false; // No need to add if the sync promo is already in the startup list. diff --git a/chrome/browser/ui/sync/one_click_signin_helper.cc b/chrome/browser/ui/sync/one_click_signin_helper.cc index c4c4eb2..7f3dae3 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper.cc @@ -607,23 +607,6 @@ bool OneClickSigninHelper::CanOffer(content::WebContents* web_contents, return false; } } - - if (!SyncPromoUI::UseWebBasedSigninFlow()) { - // If we're about to show a one-click infobar but the user has started - // a concurrent signin flow (perhaps via the promo), we may not have yet - // established an authenticated username but we still shouldn't move - // forward with two simultaneous signin processes. This is a bit - // contentious as the one-click flow is a much smoother flow from the user - // perspective, but it's much more difficult to hijack the other flow from - // here as it is to bail. - ProfileSyncService* service = - ProfileSyncServiceFactory::GetForProfile(profile); - if (!service) - return false; - - if (service->FirstSetupInProgress()) - return false; - } } VLOG(1) << "OneClickSigninHelper::CanOffer: yes we can"; @@ -650,9 +633,6 @@ OneClickSigninHelper::Offer OneClickSigninHelper::CanOfferOnIOThreadImpl( if (!io_data) return DONT_OFFER; - if (!SyncPromoUI::UseWebBasedSigninFlow()) - return DONT_OFFER; - // Check for incognito before other parts of the io_data, since those // members may not be initalized. if (io_data->is_incognito()) @@ -720,11 +700,6 @@ void OneClickSigninHelper::ShowInfoBarIfPossible(net::URLRequest* request, << " g-c-s='" << google_chrome_signin_value << "'"; } - if (!SyncPromoUI::UseWebBasedSigninFlow() && - google_accounts_signin_value.empty()) { - return; - } - if (!gaia::IsGaiaSignonRealm(request->original_url().GetOrigin())) return; @@ -748,7 +723,7 @@ void OneClickSigninHelper::ShowInfoBarIfPossible(net::URLRequest* request, // Later in the chain of this request, we'll need to check the email address // in the IO thread (see CanOfferOnIOThread). So save the email address as // user data on the request (only for web-based flow). - if (SyncPromoUI::UseWebBasedSigninFlow() && !email.empty()) + if (!email.empty()) io_data->set_reverse_autologin_pending_email(email); if (!email.empty() || !session_index.empty()) { @@ -761,27 +736,25 @@ void OneClickSigninHelper::ShowInfoBarIfPossible(net::URLRequest* request, AutoAccept auto_accept = AUTO_ACCEPT_NONE; SyncPromoUI::Source source = SyncPromoUI::SOURCE_UNKNOWN; GURL continue_url; - if (SyncPromoUI::UseWebBasedSigninFlow()) { - std::vector<std::string> tokens; - base::SplitString(google_chrome_signin_value, ',', &tokens); - for (size_t i = 0; i < tokens.size(); ++i) { - const std::string& token = tokens[i]; - if (token == "accepted") { - auto_accept = AUTO_ACCEPT_ACCEPTED; - } else if (token == "configure") { - auto_accept = AUTO_ACCEPT_CONFIGURE; - } else if (token == "rejected-for-profile") { - auto_accept = AUTO_ACCEPT_REJECTED_FOR_PROFILE; - } + std::vector<std::string> tokens; + base::SplitString(google_chrome_signin_value, ',', &tokens); + for (size_t i = 0; i < tokens.size(); ++i) { + const std::string& token = tokens[i]; + if (token == "accepted") { + auto_accept = AUTO_ACCEPT_ACCEPTED; + } else if (token == "configure") { + auto_accept = AUTO_ACCEPT_CONFIGURE; + } else if (token == "rejected-for-profile") { + auto_accept = AUTO_ACCEPT_REJECTED_FOR_PROFILE; } - - // If this is an explicit sign in (i.e., first run, NTP, Apps page, menu, - // settings) then force the auto accept type to explicit. - source = GetSigninSource(request->url(), &continue_url); - if (source != SyncPromoUI::SOURCE_UNKNOWN) - auto_accept = AUTO_ACCEPT_EXPLICIT; } + // If this is an explicit sign in (i.e., first run, NTP, Apps page, menu, + // settings) then force the auto accept type to explicit. + source = GetSigninSource(request->url(), &continue_url); + if (source != SyncPromoUI::SOURCE_UNKNOWN) + auto_accept = AUTO_ACCEPT_EXPLICIT; + if (auto_accept != AUTO_ACCEPT_NONE) { VLOG(1) << "OneClickSigninHelper::ShowInfoBarIfPossible:" << " auto_accept=" << auto_accept; @@ -925,7 +898,7 @@ void OneClickSigninHelper::RedirectToSignin() { SyncPromoUI::GetSourceForSyncPromoURL(continue_url_); if (source == SyncPromoUI::SOURCE_UNKNOWN) source = SyncPromoUI::SOURCE_MENU; - GURL page = SyncPromoUI::GetSyncPromoURL(GURL(), source, false); + GURL page = SyncPromoUI::GetSyncPromoURL(source, false); content::WebContents* contents = web_contents(); contents->GetController().LoadURL(page, @@ -999,8 +972,7 @@ void OneClickSigninHelper::NavigateToPendingEntry( // process (see crbug.com/181163 for details). const GURL continue_url = SyncPromoUI::GetNextPageURLForSyncPromoURL( - SyncPromoUI::GetSyncPromoURL(GURL(), - SyncPromoUI::SOURCE_START_PAGE, + SyncPromoUI::GetSyncPromoURL(SyncPromoUI::SOURCE_START_PAGE, false)); GURL::Replacements replacements; replacements.ClearQuery(); @@ -1097,46 +1069,44 @@ void OneClickSigninHelper::DidStopLoading( // further below for when this variable is set to true. bool force_same_tab_navigation = false; - if (SyncPromoUI::UseWebBasedSigninFlow()) { - if (!continue_url_match && IsValidGaiaSigninRedirectOrResponseURL(url)) + if (!continue_url_match && IsValidGaiaSigninRedirectOrResponseURL(url)) + return; + + // During an explicit sign in, if the user has not yet reached the final + // continue URL, wait for it to arrive. Note that Gaia will add some extra + // query parameters to the continue URL. Ignore them when checking to + // see if the user has continued. + // + // If this is not an explicit sign in, we don't need to check if we landed + // on the right continue URL. This is important because the continue URL + // may itself lead to a redirect, which means this function will never see + // the continue URL go by. + if (auto_accept_ == AUTO_ACCEPT_EXPLICIT) { + DCHECK(source_ != SyncPromoUI::SOURCE_UNKNOWN); + if (!continue_url_match) { + VLOG(1) << "OneClickSigninHelper::DidStopLoading: invalid url='" + << url.spec() + << "' expected continue url=" << continue_url_; + CleanTransientState(); return; + } - // During an explicit sign in, if the user has not yet reached the final - // continue URL, wait for it to arrive. Note that Gaia will add some extra - // query parameters to the continue URL. Ignore them when checking to - // see if the user has continued. + // In explicit sign ins, the user may have changed the box + // "Let me choose what to sync". This is reflected as a change in the + // source of the continue URL. Make one last check of the current URL + // to see if there is a valid source. If so, it overrides the + // current source. // - // If this is not an explicit sign in, we don't need to check if we landed - // on the right continue URL. This is important because the continue URL - // may itself lead to a redirect, which means this function will never see - // the continue URL go by. - if (auto_accept_ == AUTO_ACCEPT_EXPLICIT) { - DCHECK(source_ != SyncPromoUI::SOURCE_UNKNOWN); - if (!continue_url_match) { - VLOG(1) << "OneClickSigninHelper::DidStopLoading: invalid url='" - << url.spec() - << "' expected continue url=" << continue_url_; - CleanTransientState(); - return; - } - - // In explicit sign ins, the user may have changed the box - // "Let me choose what to sync". This is reflected as a change in the - // source of the continue URL. Make one last check of the current URL - // to see if there is a valid source. If so, it overrides the - // current source. - // - // If the source was changed to SOURCE_SETTINGS, we want - // OneClickSigninSyncStarter to reuse the current tab to display the - // advanced configuration. - SyncPromoUI::Source source = - SyncPromoUI::GetSourceForSyncPromoURL(url); - if (source != source_) { - original_source_ = source_; - source_ = source; - force_same_tab_navigation = source == SyncPromoUI::SOURCE_SETTINGS; - switched_to_advanced_ = source == SyncPromoUI::SOURCE_SETTINGS; - } + // If the source was changed to SOURCE_SETTINGS, we want + // OneClickSigninSyncStarter to reuse the current tab to display the + // advanced configuration. + SyncPromoUI::Source source = + SyncPromoUI::GetSourceForSyncPromoURL(url); + if (source != source_) { + original_source_ = source_; + source_ = source; + force_same_tab_navigation = source == SyncPromoUI::SOURCE_SETTINGS; + switched_to_advanced_ = source == SyncPromoUI::SOURCE_SETTINGS; } } @@ -1148,8 +1118,8 @@ void OneClickSigninHelper::DidStopLoading( switch (auto_accept_) { case AUTO_ACCEPT_NONE: - if (SyncPromoUI::UseWebBasedSigninFlow() && showing_signin_) - LogOneClickHistogramValue(one_click_signin::HISTOGRAM_DISMISSED); + if (showing_signin_) + LogOneClickHistogramValue(one_click_signin::HISTOGRAM_DISMISSED); break; case AUTO_ACCEPT_ACCEPTED: LogOneClickHistogramValue(one_click_signin::HISTOGRAM_ACCEPTED); diff --git a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc index 8088bc3..108189d 100644 --- a/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc +++ b/chrome/browser/ui/sync/one_click_signin_helper_unittest.cc @@ -709,7 +709,7 @@ TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadBadURL) { TEST_F(OneClickSigninHelperIOTest, CanOfferOnIOThreadReferrer) { scoped_ptr<TestProfileIOData> io_data(CreateTestProfileIOData(false)); std::string continue_url(SyncPromoUI::GetSyncPromoURL( - GURL(), SyncPromoUI::SOURCE_START_PAGE, false).spec()); + SyncPromoUI::SOURCE_START_PAGE, false).spec()); EXPECT_EQ(OneClickSigninHelper::CAN_OFFER, OneClickSigninHelper::CanOfferOnIOThreadImpl( diff --git a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc index 666cfe3..e009cef 100644 --- a/chrome/browser/ui/views/extensions/extension_installed_bubble.cc +++ b/chrome/browser/ui/views/extensions/extension_installed_bubble.cc @@ -262,7 +262,7 @@ class InstalledBubbleContent : public views::View, configure_url += chrome::kExtensionConfigureCommandsSubPage; } else if (source == sign_in_link_) { configure_url = SyncPromoUI::GetSyncPromoURL( - GURL(), SyncPromoUI::SOURCE_EXTENSION_INSTALL_BUBBLE, false).spec(); + SyncPromoUI::SOURCE_EXTENSION_INSTALL_BUBBLE, false).spec(); } else { NOTREACHED(); return; diff --git a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc index 04dfda2..230c06f 100644 --- a/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc +++ b/chrome/browser/ui/webui/bidi_checker_web_ui_test.cc @@ -20,7 +20,6 @@ #include "chrome/browser/prefs/session_startup_pref.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" -#include "chrome/common/chrome_switches.h" #include "chrome/common/url_constants.h" #include "chrome/test/base/ui_test_utils.h" #include "components/autofill/browser/autofill_common_test.h" @@ -86,14 +85,6 @@ static const base::FilePath::CharType* kBidiCheckerTestsJS = void WebUIBidiCheckerBrowserTest::SetUp() { argv_ = CommandLine::ForCurrentProcess()->GetArgs(); - - // Sync only uses webui when client login is enabled. Client login is going - // away, but to keep it tested for now, force client login to be used. - if (!CommandLine::ForCurrentProcess()->HasSwitch( - switches::kUseClientLoginSigninFlow)) { - CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kUseClientLoginSigninFlow); - } } void WebUIBidiCheckerBrowserTest::TearDown() { @@ -442,24 +433,6 @@ IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, } //=================================== -// chrome://settings-frame/syncSetup -//=================================== - -IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestLTR, - TestSettingsFrameSyncSetup) { - std::string url(chrome::kChromeUISettingsFrameURL); - url += std::string(chrome::kSyncSetupSubPage); - RunBidiCheckerOnPage(url); -} - -IN_PROC_BROWSER_TEST_F(WebUIBidiCheckerBrowserTestRTL, - TestSettingsFrameSyncSetup) { - std::string url(chrome::kChromeUISettingsFrameURL); - url += std::string(chrome::kSyncSetupSubPage); - RunBidiCheckerOnPage(url); -} - -//=================================== // chrome://settings-frame/startup //=================================== diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc index 5e7e6c0..a6ce549 100644 --- a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.cc @@ -50,7 +50,6 @@ const char kSyncPromoJsFile[] = "sync_promo.js"; const char kSyncPromoQueryKeyAutoClose[] = "auto_close"; const char kSyncPromoQueryKeyContinue[] = "continue"; -const char kSyncPromoQueryKeyNextPage[] = "next_page"; const char kSyncPromoQueryKeySource[] = "source"; // Gaia cannot support about:blank as a continue URL, so using a hosted blank @@ -209,61 +208,42 @@ std::string SyncPromoUI::GetSyncLandingURL(const char* option, int value) { } // static -GURL SyncPromoUI::GetSyncPromoURL(const GURL& next_page, - Source source, - bool auto_close) { +GURL SyncPromoUI::GetSyncPromoURL(Source source, bool auto_close) { DCHECK_NE(SOURCE_UNKNOWN, source); std::string url_string; - if (UseWebBasedSigninFlow()) { - // Build a Gaia-based URL that can be used to sign the user into chrome. - // There are required request parameters: - // - // - tell Gaia which service the user is signing into. In this case, - // a chrome sign in uses the service "chromiumsync" - // - provide a continue URL. This is the URL that Gaia will redirect to - // once the sign is complete. - // - // The continue URL includes a source parameter that can be extracted using - // the function GetSourceForSyncPromoURL() below. This is used to know - // which of the chrome sign in access points was used to sign the user in. - // See OneClickSigninHelper for details. - url_string = GaiaUrls::GetInstance()->service_login_url(); - url_string.append("?service=chromiumsync&sarp=1"); - - std::string continue_url = GetSyncLandingURL( - kSyncPromoQueryKeySource, static_cast<int>(source)); - - base::StringAppendF(&url_string, "&%s=%s", kSyncPromoQueryKeyContinue, - net::EscapeQueryParamValue( - continue_url, false).c_str()); - } else { - url_string = base::StringPrintf("%s?%s=%d", chrome::kChromeUISyncPromoURL, - kSyncPromoQueryKeySource, - static_cast<int>(source)); - - if (auto_close) - base::StringAppendF(&url_string, "&%s=1", kSyncPromoQueryKeyAutoClose); - - if (!next_page.spec().empty()) { - base::StringAppendF(&url_string, "&%s=%s", kSyncPromoQueryKeyNextPage, - net::EscapeQueryParamValue(next_page.spec(), - false).c_str()); - } - } + // Build a Gaia-based URL that can be used to sign the user into chrome. + // There are required request parameters: + // + // - tell Gaia which service the user is signing into. In this case, + // a chrome sign in uses the service "chromiumsync" + // - provide a continue URL. This is the URL that Gaia will redirect to + // once the sign is complete. + // + // The continue URL includes a source parameter that can be extracted using + // the function GetSourceForSyncPromoURL() below. This is used to know + // which of the chrome sign in access points was used to sign the user in. + // See OneClickSigninHelper for details. + url_string = GaiaUrls::GetInstance()->service_login_url(); + url_string.append("?service=chromiumsync&sarp=1"); + + std::string continue_url = GetSyncLandingURL( + kSyncPromoQueryKeySource, static_cast<int>(source)); + + base::StringAppendF(&url_string, "&%s=%s", kSyncPromoQueryKeyContinue, + net::EscapeQueryParamValue( + continue_url, false).c_str()); return GURL(url_string); } // static GURL SyncPromoUI::GetNextPageURLForSyncPromoURL(const GURL& url) { - const char* key_name = UseWebBasedSigninFlow() ? kSyncPromoQueryKeyContinue : - kSyncPromoQueryKeyNextPage; std::string value; - if (net::GetValueForKeyInQuery(url, key_name, &value)) { + if (net::GetValueForKeyInQuery(url, kSyncPromoQueryKeyContinue, &value)) return GURL(value); - } + return GURL(); } @@ -283,9 +263,7 @@ SyncPromoUI::Source SyncPromoUI::GetSourceForSyncPromoURL(const GURL& url) { // static bool SyncPromoUI::UseWebBasedSigninFlow() { #if defined(ENABLE_ONE_CLICK_SIGNIN) - return !CommandLine::ForCurrentProcess()->HasSwitch( - switches::kUseClientLoginSigninFlow) || - g_force_web_based_signin_flow; + return true; #else return false; #endif diff --git a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h index 2c8e784..a089fe4 100644 --- a/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h +++ b/chrome/browser/ui/webui/sync_promo/sync_promo_ui.h @@ -60,13 +60,10 @@ class SyncPromoUI { static std::string GetSyncLandingURL(const char* option, int value); // Returns the sync promo URL wth the given arguments in the query. - // |next_page| is the URL to navigate to when the user completes or skips the - // promo. If an empty URL is given then the promo will navigate to the NTP. // |source| identifies from where the sync promo is being called, and is used // to record sync promo UMA stats in the context of the source. // |auto_close| whether to close the sync promo automatically when done. - static GURL GetSyncPromoURL( - const GURL& next_page, Source source, bool auto_close); + static GURL GetSyncPromoURL(Source source, bool auto_close); // Gets the next page URL from the query portion of the sync promo URL. static GURL GetNextPageURLForSyncPromoURL(const GURL& url); diff --git a/chrome/browser/ui/webui/sync_setup_handler.cc b/chrome/browser/ui/webui/sync_setup_handler.cc index 228cf8d..829c22d 100644 --- a/chrome/browser/ui/webui/sync_setup_handler.cc +++ b/chrome/browser/ui/webui/sync_setup_handler.cc @@ -658,8 +658,7 @@ void SyncSetupHandler::DisplayGaiaLogin(bool fatal_error) { void SyncSetupHandler::DisplayGaiaLoginInNewTabOrWindow() { DCHECK(!active_gaia_signin_tab_); - GURL url(SyncPromoUI::GetSyncPromoURL(GURL(), - SyncPromoUI::SOURCE_SETTINGS, false)); + GURL url(SyncPromoUI::GetSyncPromoURL(SyncPromoUI::SOURCE_SETTINGS, false)); Browser* browser = chrome::FindBrowserWithWebContents( web_ui()->GetWebContents()); if (!browser) { @@ -1297,8 +1296,7 @@ void SyncSetupHandler::DidStopLoading( const GURL& url = active_gaia_signin_tab_->GetURL(); const GURL continue_url = SyncPromoUI::GetNextPageURLForSyncPromoURL( - SyncPromoUI::GetSyncPromoURL(GURL(), - SyncPromoUI::SOURCE_SETTINGS, + SyncPromoUI::GetSyncPromoURL(SyncPromoUI::SOURCE_SETTINGS, false)); GURL::Replacements replacements; replacements.ClearQuery(); diff --git a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc index b375e50..a2dfed8 100644 --- a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc +++ b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc @@ -21,7 +21,6 @@ #include "chrome/browser/sync/profile_sync_service_mock.h" #include "chrome/browser/ui/webui/signin/login_ui_service.h" #include "chrome/browser/ui/webui/signin/login_ui_service_factory.h" -#include "chrome/browser/ui/webui/sync_promo/sync_promo_ui.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/pref_names.h" #include "chrome/test/base/testing_profile.h" @@ -329,22 +328,10 @@ class TestingSyncSetupHandler : public SyncSetupHandler { // The boolean parameter indicates whether the test is run with ClientOAuth // or not. The test parameter is a bool: whether or not to test with/ // /ClientLogin enabled or not. -class SyncSetupHandlerTest : public testing::TestWithParam<bool> { +class SyncSetupHandlerTest : public testing::Test { public: SyncSetupHandlerTest() : error_(GoogleServiceAuthError::NONE) {} virtual void SetUp() OVERRIDE { - bool use_client_login_flow = GetParam(); - if (use_client_login_flow) { - if (!CommandLine::ForCurrentProcess()->HasSwitch( - switches::kUseClientLoginSigninFlow)) { - CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kUseClientLoginSigninFlow); - } - } else { - DCHECK(!CommandLine::ForCurrentProcess()->HasSwitch( - switches::kUseClientLoginSigninFlow)); - } - error_ = GoogleServiceAuthError::AuthErrorNone(); profile_.reset(ProfileSyncServiceMock::MakeSignedInTestingProfile()); mock_pss_ = static_cast<ProfileSyncServiceMock*>( @@ -447,11 +434,11 @@ class SyncSetupHandlerTest : public testing::TestWithParam<bool> { scoped_ptr<TestingSyncSetupHandler> handler_; }; -TEST_P(SyncSetupHandlerTest, Basic) { +TEST_F(SyncSetupHandlerTest, Basic) { } #if !defined(OS_CHROMEOS) -TEST_P(SyncSetupHandlerTest, DisplayBasicLogin) { +TEST_F(SyncSetupHandlerTest, DisplayBasicLogin) { EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) @@ -465,27 +452,8 @@ TEST_P(SyncSetupHandlerTest, DisplayBasicLogin) { LoginUIServiceFactory::GetForProfile( profile_.get())->current_login_ui()); - if (!SyncPromoUI::UseWebBasedSigninFlow()) { - ASSERT_EQ(1U, web_ui_.call_data().size()); - const TestWebUI::CallData& data = web_ui_.call_data()[0]; - EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); - std::string page; - ASSERT_TRUE(data.arg1->GetAsString(&page)); - EXPECT_EQ(page, "login"); - // Now make sure that the appropriate params are being passed. - DictionaryValue* dictionary; - ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs(dictionary, - std::string(), - false, - GoogleServiceAuthError::NONE, - std::string(), - true, - std::string()); - } else { - ASSERT_FALSE(handler_->is_configuring_sync()); - ASSERT_TRUE(handler_->have_signin_tracker()); - } + ASSERT_FALSE(handler_->is_configuring_sync()); + ASSERT_TRUE(handler_->have_signin_tracker()); handler_->CloseSyncSetup(); EXPECT_EQ(NULL, @@ -493,7 +461,7 @@ TEST_P(SyncSetupHandlerTest, DisplayBasicLogin) { profile_.get())->current_login_ui()); } -TEST_P(SyncSetupHandlerTest, ShowSyncSetupWhenNotSignedIn) { +TEST_F(SyncSetupHandlerTest, ShowSyncSetupWhenNotSignedIn) { EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) @@ -503,26 +471,18 @@ TEST_P(SyncSetupHandlerTest, ShowSyncSetupWhenNotSignedIn) { handler_->HandleShowSetupUI(NULL); ASSERT_EQ(1U, web_ui_.call_data().size()); - if (SyncPromoUI::UseWebBasedSigninFlow()) { - const TestWebUI::CallData& data = web_ui_.call_data()[0]; - EXPECT_EQ("OptionsPage.closeOverlay", data.function_name); - ASSERT_FALSE(handler_->is_configuring_sync()); - EXPECT_EQ(NULL, - LoginUIServiceFactory::GetForProfile( - profile_.get())->current_login_ui()); - } else { - const TestWebUI::CallData& data = web_ui_.call_data()[0]; - EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); - EXPECT_EQ(handler_.get(), - LoginUIServiceFactory::GetForProfile( - profile_.get())->current_login_ui()); - } + const TestWebUI::CallData& data = web_ui_.call_data()[0]; + EXPECT_EQ("OptionsPage.closeOverlay", data.function_name); + ASSERT_FALSE(handler_->is_configuring_sync()); + EXPECT_EQ(NULL, + LoginUIServiceFactory::GetForProfile( + profile_.get())->current_login_ui()); } #endif // Verifies that the handler correctly handles a cancellation when // it is displaying the spinner to the user. -TEST_P(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) { +TEST_F(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) { EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) .WillRepeatedly(Return(true)); profile_->GetPrefs()->SetString(prefs::kGoogleServicesUsername, kTestUser); @@ -551,7 +511,7 @@ TEST_P(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) { // Verifies that the handler correctly transitions from showing the spinner // to showing a configuration page when signin completes successfully. -TEST_P(SyncSetupHandlerTest, +TEST_F(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndSigninSuccess) { EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) .WillRepeatedly(Return(true)); @@ -609,7 +569,7 @@ TEST_P(SyncSetupHandlerTest, // configuration page, tested by // DisplayConfigureWithBackendDisabledAndSigninSuccess), but before the user // before the user has continued on. -TEST_P(SyncSetupHandlerTest, +TEST_F(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancelAfterSigninSuccess) { EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) .WillRepeatedly(Return(true)); @@ -640,7 +600,7 @@ TEST_P(SyncSetupHandlerTest, profile_.get())->current_login_ui()); } -TEST_P(SyncSetupHandlerTest, +TEST_F(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndSigninFalied) { EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) .WillRepeatedly(Return(true)); @@ -682,50 +642,7 @@ class SyncSetupHandlerNonCrosTest : public SyncSetupHandlerTest { } }; -TEST_P(SyncSetupHandlerNonCrosTest, HandleGaiaAuthFailure) { - EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) - .WillRepeatedly(Return(false)); - EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) - .WillRepeatedly(Return(false)); - EXPECT_CALL(*mock_pss_, HasUnrecoverableError()) - .WillRepeatedly(Return(false)); - EXPECT_CALL(*mock_pss_, HasSyncSetupCompleted()) - .WillRepeatedly(Return(false)); - // Open the web UI. - handler_->OpenSyncSetup(); - - if (!SyncPromoUI::UseWebBasedSigninFlow()) { - // Fake a failed signin attempt. - handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); - GoogleServiceAuthError error( - GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); - handler_->SigninFailed(error); - - ASSERT_EQ(2U, web_ui_.call_data().size()); - // Validate the second JS call (the first call was already tested by - // the DisplayBasicLogin test). - const TestWebUI::CallData& data = web_ui_.call_data()[1]; - EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); - std::string page; - ASSERT_TRUE(data.arg1->GetAsString(&page)); - EXPECT_EQ(page, "login"); - // Now make sure that the appropriate params are being passed. - DictionaryValue* dictionary; - ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs(dictionary, - std::string(), - false, - GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS, - kTestUser, - true, - std::string()); - } else { - ASSERT_FALSE(handler_->is_configuring_sync()); - ASSERT_TRUE(handler_->have_signin_tracker()); - } -} - -TEST_P(SyncSetupHandlerNonCrosTest, HandleCaptcha) { +TEST_F(SyncSetupHandlerNonCrosTest, HandleGaiaAuthFailure) { EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) @@ -737,39 +654,12 @@ TEST_P(SyncSetupHandlerNonCrosTest, HandleCaptcha) { // Open the web UI. handler_->OpenSyncSetup(); - if (!SyncPromoUI::UseWebBasedSigninFlow()) { - // Fake a failed signin attempt that requires a captcha. - handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); - GoogleServiceAuthError error = - GoogleServiceAuthError::FromClientLoginCaptchaChallenge( - "token", GURL(kTestCaptchaImageUrl), GURL(kTestCaptchaUnlockUrl)); - handler_->SigninFailed(error); - ASSERT_EQ(2U, web_ui_.call_data().size()); - // Validate the second JS call (the first call was already tested by - // the DisplayBasicLogin test). - const TestWebUI::CallData& data = web_ui_.call_data()[1]; - EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); - std::string page; - ASSERT_TRUE(data.arg1->GetAsString(&page)); - EXPECT_EQ(page, "login"); - // Now make sure that the appropriate params are being passed. - DictionaryValue* dictionary; - ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs(dictionary, - std::string(), - false, - GoogleServiceAuthError::CAPTCHA_REQUIRED, - kTestUser, - true, - kTestCaptchaImageUrl); - } else { - ASSERT_FALSE(handler_->is_configuring_sync()); - ASSERT_TRUE(handler_->have_signin_tracker()); - } + ASSERT_FALSE(handler_->is_configuring_sync()); + ASSERT_TRUE(handler_->have_signin_tracker()); } // TODO(kochi): We need equivalent tests for ChromeOS. -TEST_P(SyncSetupHandlerNonCrosTest, UnrecoverableErrorInitializingSync) { +TEST_F(SyncSetupHandlerNonCrosTest, UnrecoverableErrorInitializingSync) { EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) @@ -779,47 +669,11 @@ TEST_P(SyncSetupHandlerNonCrosTest, UnrecoverableErrorInitializingSync) { // Open the web UI. handler_->OpenSyncSetup(); - if (!SyncPromoUI::UseWebBasedSigninFlow()) { - ASSERT_EQ(1U, web_ui_.call_data().size()); - // Fake a successful GAIA request (gaia credentials valid, but signin not - // complete yet). - handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); - handler_->GaiaCredentialsValid(); - ASSERT_EQ(2U, web_ui_.call_data().size()); - EXPECT_EQ("SyncSetupOverlay.showSuccessAndSettingUp", - web_ui_.call_data()[1].function_name); - // Now fake a sync error. - GoogleServiceAuthError none(GoogleServiceAuthError::NONE); - EXPECT_CALL(*mock_pss_, HasUnrecoverableError()) - .WillRepeatedly(Return(true)); - // On non-Cros platforms, we use SigninManager. - static_cast<SigninManager*>(mock_signin_)->SignOut(); - handler_->SigninFailed(none); - ASSERT_EQ(3U, web_ui_.call_data().size()); - // Validate the second JS call (the first call was already tested by - // the DisplayBasicLogin test). - const TestWebUI::CallData& data = web_ui_.call_data()[2]; - EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); - std::string page; - ASSERT_TRUE(data.arg1->GetAsString(&page)); - EXPECT_EQ(page, "login"); - // Now make sure that the appropriate params are being passed. - DictionaryValue* dictionary; - ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs(dictionary, - std::string(), - true, - GoogleServiceAuthError::NONE, - kTestUser, - true, - std::string()); - } else { - ASSERT_FALSE(handler_->is_configuring_sync()); - ASSERT_TRUE(handler_->have_signin_tracker()); - } + ASSERT_FALSE(handler_->is_configuring_sync()); + ASSERT_TRUE(handler_->have_signin_tracker()); } -TEST_P(SyncSetupHandlerNonCrosTest, GaiaErrorInitializingSync) { +TEST_F(SyncSetupHandlerNonCrosTest, GaiaErrorInitializingSync) { EXPECT_CALL(*mock_pss_, IsSyncEnabledAndLoggedIn()) .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsSyncTokenAvailable()) @@ -829,99 +683,13 @@ TEST_P(SyncSetupHandlerNonCrosTest, GaiaErrorInitializingSync) { // Open the web UI. handler_->OpenSyncSetup(); - if (!SyncPromoUI::UseWebBasedSigninFlow()) { - ASSERT_EQ(1U, web_ui_.call_data().size()); - // Fake a successful GAIA request (gaia credentials valid, but signin not - // complete yet). - handler_->TryLogin(kTestUser, kTestPassword, std::string(), std::string()); - handler_->GaiaCredentialsValid(); - ASSERT_EQ(2U, web_ui_.call_data().size()); - EXPECT_EQ("SyncSetupOverlay.showSuccessAndSettingUp", - web_ui_.call_data()[1].function_name); - // Now fake a sync gaia error. - GoogleServiceAuthError unavailable( - GoogleServiceAuthError::SERVICE_UNAVAILABLE); - EXPECT_CALL(*mock_pss_, HasUnrecoverableError()) - .WillRepeatedly(Return(false)); - // On non-Cros platforms, we use SigninManager. - static_cast<SigninManager*>(mock_signin_)->SignOut(); - handler_->SigninFailed(unavailable); - ASSERT_EQ(3U, web_ui_.call_data().size()); - // Validate the second JS call (the first call was already tested by - // the DisplayBasicLogin test). - const TestWebUI::CallData& data = web_ui_.call_data()[2]; - EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); - std::string page; - ASSERT_TRUE(data.arg1->GetAsString(&page)); - EXPECT_EQ(page, "login"); - // Now make sure that the appropriate params are being passed. - DictionaryValue* dictionary; - ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - CheckShowSyncSetupArgs(dictionary, - std::string(), - false, - GoogleServiceAuthError::SERVICE_UNAVAILABLE, - kTestUser, - true, - std::string()); - } else { - ASSERT_FALSE(handler_->is_configuring_sync()); - ASSERT_TRUE(handler_->have_signin_tracker()); - } -} - -// Tests that trying to log in with an invalid username results in an error -// displayed to the user. -TEST_P(SyncSetupHandlerNonCrosTest, SubmitAuthWithInvalidUsername) { - ScopedTestingLocalState local_state( - TestingBrowserProcess::GetGlobal()); - local_state.Get()->SetString( - prefs::kGoogleServicesUsernamePattern, ".*@valid.com"); - - // Generate a blob of json that matches what would be submitted by the login - // javascript code. - DictionaryValue args; - args.SetString("user", "user@not_allowed.com"); - args.SetString("pass", "password"); - args.SetString("captcha", std::string()); - args.SetString("otp", std::string()); - args.SetString("accessCode", std::string()); - std::string json; - base::JSONWriter::Write(&args, &json); - ListValue list_args; - list_args.Append(new StringValue(json)); - - // Mimic a login attempt from the UI. - handler_->HandleSubmitAuth(&list_args); - - // Should result in the login page being displayed again. - ASSERT_EQ(1U, web_ui_.call_data().size()); - const TestWebUI::CallData& data = web_ui_.call_data()[0]; - EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); - std::string page; - ASSERT_TRUE(data.arg1->GetAsString(&page)); - EXPECT_EQ(page, "login"); - - // Also make sure that the appropriate error message is being passed. - DictionaryValue* dictionary; - ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - std::string err = l10n_util::GetStringUTF8(IDS_SYNC_LOGIN_NAME_PROHIBITED); - CheckShowSyncSetupArgs(dictionary, - err, - false, - GoogleServiceAuthError::NONE, - std::string(), - true, - std::string()); - handler_->CloseSyncSetup(); - EXPECT_EQ(NULL, - LoginUIServiceFactory::GetForProfile( - profile_.get())->current_login_ui()); + ASSERT_FALSE(handler_->is_configuring_sync()); + ASSERT_TRUE(handler_->have_signin_tracker()); } #endif // #if !defined(OS_CHROMEOS) -TEST_P(SyncSetupHandlerTest, TestSyncEverything) { +TEST_F(SyncSetupHandlerTest, TestSyncEverything) { std::string args = GetConfiguration( NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS); ListValue list_args; @@ -939,7 +707,7 @@ TEST_P(SyncSetupHandlerTest, TestSyncEverything) { ExpectDone(); } -TEST_P(SyncSetupHandlerTest, TestSyncNothing) { +TEST_F(SyncSetupHandlerTest, TestSyncNothing) { std::string args = GetConfiguration( NULL, SYNC_NOTHING, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS); ListValue list_args; @@ -953,7 +721,7 @@ TEST_P(SyncSetupHandlerTest, TestSyncNothing) { EXPECT_EQ("OptionsPage.closeOverlay", data.function_name); } -TEST_P(SyncSetupHandlerTest, TurnOnEncryptAll) { +TEST_F(SyncSetupHandlerTest, TurnOnEncryptAll) { std::string args = GetConfiguration( NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_ALL_DATA); ListValue list_args; @@ -972,7 +740,7 @@ TEST_P(SyncSetupHandlerTest, TurnOnEncryptAll) { ExpectDone(); } -TEST_P(SyncSetupHandlerTest, TestPassphraseStillRequired) { +TEST_F(SyncSetupHandlerTest, TestPassphraseStillRequired) { std::string args = GetConfiguration( NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS); ListValue list_args; @@ -993,7 +761,7 @@ TEST_P(SyncSetupHandlerTest, TestPassphraseStillRequired) { ExpectConfig(); } -TEST_P(SyncSetupHandlerTest, SuccessfullySetPassphrase) { +TEST_F(SyncSetupHandlerTest, SuccessfullySetPassphrase) { DictionaryValue dict; dict.SetBoolean("isGooglePassphrase", true); std::string args = GetConfiguration(&dict, @@ -1020,7 +788,7 @@ TEST_P(SyncSetupHandlerTest, SuccessfullySetPassphrase) { ExpectDone(); } -TEST_P(SyncSetupHandlerTest, SelectCustomEncryption) { +TEST_F(SyncSetupHandlerTest, SelectCustomEncryption) { DictionaryValue dict; dict.SetBoolean("isGooglePassphrase", false); std::string args = GetConfiguration(&dict, @@ -1047,7 +815,7 @@ TEST_P(SyncSetupHandlerTest, SelectCustomEncryption) { ExpectDone(); } -TEST_P(SyncSetupHandlerTest, UnsuccessfullySetPassphrase) { +TEST_F(SyncSetupHandlerTest, UnsuccessfullySetPassphrase) { DictionaryValue dict; dict.SetBoolean("isGooglePassphrase", true); std::string args = GetConfiguration(&dict, @@ -1084,7 +852,7 @@ TEST_P(SyncSetupHandlerTest, UnsuccessfullySetPassphrase) { // Walks through each user selectable type, and tries to sync just that single // data type. -TEST_P(SyncSetupHandlerTest, TestSyncIndividualTypes) { +TEST_F(SyncSetupHandlerTest, TestSyncIndividualTypes) { syncer::ModelTypeSet user_selectable_types = GetAllTypes(); syncer::ModelTypeSet::Iterator it; for (it = user_selectable_types.First(); it.Good(); it.Inc()) { @@ -1112,7 +880,7 @@ TEST_P(SyncSetupHandlerTest, TestSyncIndividualTypes) { } } -TEST_P(SyncSetupHandlerTest, TestSyncAllManually) { +TEST_F(SyncSetupHandlerTest, TestSyncAllManually) { std::string args = GetConfiguration(NULL, CHOOSE_WHAT_TO_SYNC, GetAllTypes(), @@ -1132,7 +900,7 @@ TEST_P(SyncSetupHandlerTest, TestSyncAllManually) { ExpectDone(); } -TEST_P(SyncSetupHandlerTest, ShowSyncSetup) { +TEST_F(SyncSetupHandlerTest, ShowSyncSetup) { EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) @@ -1146,7 +914,7 @@ TEST_P(SyncSetupHandlerTest, ShowSyncSetup) { } // We do not display signin on chromeos in the case of auth error. -TEST_P(SyncSetupHandlerTest, ShowSigninOnAuthError) { +TEST_F(SyncSetupHandlerTest, ShowSigninOnAuthError) { // Initialize the system to a signed in state, but with an auth error. error_ = GoogleServiceAuthError( GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); @@ -1183,32 +951,12 @@ TEST_P(SyncSetupHandlerTest, ShowSigninOnAuthError) { #if defined(OS_CHROMEOS) ExpectSpinnerAndClose(); #else - // On desktop platforms, we display a signin page if there's an auth error. - if (!SyncPromoUI::UseWebBasedSigninFlow()) { - ASSERT_EQ(1U, web_ui_.call_data().size()); - const TestWebUI::CallData& data = web_ui_.call_data()[0]; - EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name); - std::string page; - ASSERT_TRUE(data.arg1->GetAsString(&page)); - EXPECT_EQ(page, "login"); - DictionaryValue* dictionary; - ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); - // We should display a login screen with a non-editable username filled in. - CheckShowSyncSetupArgs(dictionary, - std::string(), - false, - GoogleServiceAuthError::NONE, - kTestUser, - false, - std::string()); - } else { - ASSERT_FALSE(handler_->is_configuring_sync()); - ASSERT_TRUE(handler_->have_signin_tracker()); - } + ASSERT_FALSE(handler_->is_configuring_sync()); + ASSERT_TRUE(handler_->have_signin_tracker()); #endif } -TEST_P(SyncSetupHandlerTest, ShowSetupSyncEverything) { +TEST_F(SyncSetupHandlerTest, ShowSetupSyncEverything) { EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) @@ -1240,7 +988,7 @@ TEST_P(SyncSetupHandlerTest, ShowSetupSyncEverything) { CheckConfigDataTypeArguments(dictionary, SYNC_ALL_DATA, GetAllTypes()); } -TEST_P(SyncSetupHandlerTest, ShowSetupManuallySyncAll) { +TEST_F(SyncSetupHandlerTest, ShowSetupManuallySyncAll) { EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) @@ -1259,7 +1007,7 @@ TEST_P(SyncSetupHandlerTest, ShowSetupManuallySyncAll) { CheckConfigDataTypeArguments(dictionary, CHOOSE_WHAT_TO_SYNC, GetAllTypes()); } -TEST_P(SyncSetupHandlerTest, ShowSetupSyncForAllTypesIndividually) { +TEST_F(SyncSetupHandlerTest, ShowSetupSyncForAllTypesIndividually) { syncer::ModelTypeSet user_selectable_types = GetAllTypes(); syncer::ModelTypeSet::Iterator it; for (it = user_selectable_types.First(); it.Good(); it.Inc()) { @@ -1293,7 +1041,7 @@ TEST_P(SyncSetupHandlerTest, ShowSetupSyncForAllTypesIndividually) { } } -TEST_P(SyncSetupHandlerTest, ShowSetupGaiaPassphraseRequired) { +TEST_F(SyncSetupHandlerTest, ShowSetupGaiaPassphraseRequired) { EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) .WillRepeatedly(Return(true)); EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) @@ -1313,7 +1061,7 @@ TEST_P(SyncSetupHandlerTest, ShowSetupGaiaPassphraseRequired) { CheckBool(dictionary, "passphraseFailed", false); } -TEST_P(SyncSetupHandlerTest, ShowSetupCustomPassphraseRequired) { +TEST_F(SyncSetupHandlerTest, ShowSetupCustomPassphraseRequired) { EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) .WillRepeatedly(Return(true)); EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) @@ -1335,7 +1083,7 @@ TEST_P(SyncSetupHandlerTest, ShowSetupCustomPassphraseRequired) { CheckBool(dictionary, "passphraseFailed", false); } -TEST_P(SyncSetupHandlerTest, ShowSetupEncryptAll) { +TEST_F(SyncSetupHandlerTest, ShowSetupEncryptAll) { EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) .WillRepeatedly(Return(false)); EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) @@ -1354,7 +1102,3 @@ TEST_P(SyncSetupHandlerTest, ShowSetupEncryptAll) { ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary)); CheckBool(dictionary, "encryptAllData", true); } - -INSTANTIATE_TEST_CASE_P(SyncSetupHandlerTestWithParam, - SyncSetupHandlerTest, - Values(true, false)); diff --git a/chrome/common/chrome_switches.cc b/chrome/common/chrome_switches.cc index 7a878bc..ddd5da1 100644 --- a/chrome/common/chrome_switches.cc +++ b/chrome/common/chrome_switches.cc @@ -1442,9 +1442,6 @@ const char kMaxSpdyConcurrentStreams[] = "max-spdy-concurrent-streams"; // all of its state. const char kUserDataDir[] = "user-data-dir"; -// Uses the ClientLogin signin flow instead of the web-based signin flow. -const char kUseClientLoginSigninFlow[] = "use-client-login-signin-flow"; - // Examines a .crx for validity and prints the result. const char kValidateCrx[] = "validate-crx"; diff --git a/chrome/common/chrome_switches.h b/chrome/common/chrome_switches.h index 0211989..90a0073 100644 --- a/chrome/common/chrome_switches.h +++ b/chrome/common/chrome_switches.h @@ -383,7 +383,6 @@ extern const char kUseSpellingSuggestions[]; extern const char kMaxSpdySessionsPerDomain[]; extern const char kMaxSpdyConcurrentStreams[]; extern const char kUserDataDir[]; -extern const char kUseClientLoginSigninFlow[]; extern const char kValidateCrx[]; extern const char kVariationsServerURL[]; extern const char kVersion[]; |