diff options
Diffstat (limited to 'chromium/components/signin/core/browser/signin_header_helper_unittest.cc')
-rw-r--r-- | chromium/components/signin/core/browser/signin_header_helper_unittest.cc | 47 |
1 files changed, 22 insertions, 25 deletions
diff --git a/chromium/components/signin/core/browser/signin_header_helper_unittest.cc b/chromium/components/signin/core/browser/signin_header_helper_unittest.cc index 1c67727627d..5141e3d3f0b 100644 --- a/chromium/components/signin/core/browser/signin_header_helper_unittest.cc +++ b/chromium/components/signin/core/browser/signin_header_helper_unittest.cc @@ -8,7 +8,7 @@ #include "base/message_loop/message_loop.h" #include "components/content_settings/core/browser/cookie_settings.h" #include "components/signin/core/browser/signin_header_helper.h" -#include "components/signin/core/common/signin_switches.h" +#include "components/signin/core/common/profile_management_switches.h" #include "components/sync_preferences/testing_pref_service_syncable.h" #include "net/traffic_annotation/network_traffic_annotation_test_helper.h" #include "net/url_request/url_request_test_util.h" @@ -22,7 +22,8 @@ class SigninHeaderHelperTest : public testing::Test { HostContentSettingsMap::RegisterProfilePrefs(prefs_.registry()); settings_map_ = new HostContentSettingsMap( - &prefs_, false /* incognito_profile */, false /* guest_profile */); + &prefs_, false /* incognito_profile */, false /* guest_profile */, + false /* store_last_modified */); cookie_settings_ = new content_settings::CookieSettings(settings_map_.get(), &prefs_, ""); } @@ -70,8 +71,8 @@ class SigninHeaderHelperTest : public testing::Test { // Tests that no Mirror request is returned when the user is not signed in (no // account id). TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestNoAccountId) { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableAccountConsistency); + switches::EnableAccountConsistencyForTesting( + base::CommandLine::ForCurrentProcess()); CheckMirrorHeaderRequest(GURL("https://docs.google.com"), "", ""); CheckMirrorCookieRequest(GURL("https://docs.google.com"), "", ""); } @@ -79,8 +80,8 @@ TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestNoAccountId) { // Tests that no Mirror request is returned when the cookies aren't allowed to // be set. TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestCookieSettingBlocked) { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableAccountConsistency); + switches::EnableAccountConsistencyForTesting( + base::CommandLine::ForCurrentProcess()); cookie_settings_->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); CheckMirrorHeaderRequest(GURL("https://docs.google.com"), "0123456789", ""); CheckMirrorCookieRequest(GURL("https://docs.google.com"), "0123456789", ""); @@ -88,8 +89,8 @@ TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestCookieSettingBlocked) { // Tests that no Mirror request is returned when the target is a non-Google URL. TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestExternalURL) { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableAccountConsistency); + switches::EnableAccountConsistencyForTesting( + base::CommandLine::ForCurrentProcess()); CheckMirrorHeaderRequest(GURL("https://foo.com"), "0123456789", ""); CheckMirrorCookieRequest(GURL("https://foo.com"), "0123456789", ""); } @@ -97,8 +98,8 @@ TEST_F(SigninHeaderHelperTest, TestNoMirrorRequestExternalURL) { // Tests that the Mirror request is returned without the GAIA Id when the target // is a google TLD domain. TEST_F(SigninHeaderHelperTest, TestMirrorRequestGoogleTLD) { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableAccountConsistency); + switches::EnableAccountConsistencyForTesting( + base::CommandLine::ForCurrentProcess()); CheckMirrorHeaderRequest(GURL("https://google.fr"), "0123456789", "mode=0,enable_account_consistency=true"); CheckMirrorCookieRequest(GURL("https://google.de"), "0123456789", @@ -108,8 +109,8 @@ TEST_F(SigninHeaderHelperTest, TestMirrorRequestGoogleTLD) { // Tests that the Mirror request is returned when the target is the domain // google.com, and that the GAIA Id is only attached for the cookie. TEST_F(SigninHeaderHelperTest, TestMirrorRequestGoogleCom) { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableAccountConsistency); + switches::EnableAccountConsistencyForTesting( + base::CommandLine::ForCurrentProcess()); CheckMirrorHeaderRequest(GURL("https://www.google.com"), "0123456789", "mode=0,enable_account_consistency=true"); CheckMirrorCookieRequest( @@ -124,8 +125,7 @@ TEST_F(SigninHeaderHelperTest, TestMirrorRequestGoogleCom) { // only relevant on Desktop. #if !defined(OS_ANDROID) && !defined(OS_IOS) TEST_F(SigninHeaderHelperTest, TestMirrorRequestDrive) { - DCHECK(!base::CommandLine::ForCurrentProcess()->HasSwitch( - switches::kEnableAccountConsistency)); + DCHECK(!switches::IsEnableAccountConsistency()); CheckMirrorHeaderRequest( GURL("https://docs.google.com/document"), "0123456789", "id=0123456789,mode=0,enable_account_consistency=false"); @@ -134,8 +134,8 @@ TEST_F(SigninHeaderHelperTest, TestMirrorRequestDrive) { "id=0123456789:mode=0:enable_account_consistency=false"); // Enable Account Consistency will override the disable. - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableAccountConsistency); + switches::EnableAccountConsistencyForTesting( + base::CommandLine::ForCurrentProcess()); CheckMirrorHeaderRequest( GURL("https://docs.google.com/document"), "0123456789", "id=0123456789,mode=0,enable_account_consistency=true"); @@ -148,9 +148,8 @@ TEST_F(SigninHeaderHelperTest, TestMirrorRequestDrive) { // Tests that the Mirror header request is returned normally when the redirect // URL is eligible. TEST_F(SigninHeaderHelperTest, TestMirrorHeaderEligibleRedirectURL) { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableAccountConsistency); - + switches::EnableAccountConsistencyForTesting( + base::CommandLine::ForCurrentProcess()); const GURL url("https://docs.google.com/document"); const GURL redirect_url("https://www.google.com"); const std::string account_id = "0123456789"; @@ -167,9 +166,8 @@ TEST_F(SigninHeaderHelperTest, TestMirrorHeaderEligibleRedirectURL) { // Tests that the Mirror header request is stripped when the redirect URL is not // eligible. TEST_F(SigninHeaderHelperTest, TestMirrorHeaderNonEligibleRedirectURL) { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableAccountConsistency); - + switches::EnableAccountConsistencyForTesting( + base::CommandLine::ForCurrentProcess()); const GURL url("https://docs.google.com/document"); const GURL redirect_url("http://www.foo.com"); const std::string account_id = "0123456789"; @@ -186,9 +184,8 @@ TEST_F(SigninHeaderHelperTest, TestMirrorHeaderNonEligibleRedirectURL) { // Tests that the Mirror header, whatever its value is, is untouched when both // the current and the redirect URL are non-eligible. TEST_F(SigninHeaderHelperTest, TestIgnoreMirrorHeaderNonEligibleURLs) { - base::CommandLine::ForCurrentProcess()->AppendSwitch( - switches::kEnableAccountConsistency); - + switches::EnableAccountConsistencyForTesting( + base::CommandLine::ForCurrentProcess()); const GURL url("https://www.bar.com"); const GURL redirect_url("http://www.foo.com"); const std::string account_id = "0123456789"; |