| 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/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 8 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 10 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 11 #include "chrome/browser/content_settings/cookie_settings_factory.h" | 12 #include "chrome/browser/content_settings/cookie_settings_factory.h" |
| 12 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" | 13 #include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h" |
| 13 #include "chrome/browser/signin/fake_signin_manager_builder.h" | 14 #include "chrome/browser/signin/fake_signin_manager_builder.h" |
| 14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" | 15 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" |
| 15 #include "chrome/browser/signin/signin_manager_factory.h" | 16 #include "chrome/browser/signin/signin_manager_factory.h" |
| 16 #include "chrome/browser/signin/signin_promo.h" | 17 #include "chrome/browser/signin/signin_promo.h" |
| (...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 void InlineLoginUIBrowserTest::EnableOneClick(bool enable) { | 281 void InlineLoginUIBrowserTest::EnableOneClick(bool enable) { |
| 281 PrefService* pref_service = browser()->profile()->GetPrefs(); | 282 PrefService* pref_service = browser()->profile()->GetPrefs(); |
| 282 pref_service->SetBoolean(prefs::kReverseAutologinEnabled, enable); | 283 pref_service->SetBoolean(prefs::kReverseAutologinEnabled, enable); |
| 283 } | 284 } |
| 284 | 285 |
| 285 void InlineLoginUIBrowserTest::AddEmailToOneClickRejectedList( | 286 void InlineLoginUIBrowserTest::AddEmailToOneClickRejectedList( |
| 286 const std::string& email) { | 287 const std::string& email) { |
| 287 PrefService* pref_service = browser()->profile()->GetPrefs(); | 288 PrefService* pref_service = browser()->profile()->GetPrefs(); |
| 288 ListPrefUpdate updater(pref_service, | 289 ListPrefUpdate updater(pref_service, |
| 289 prefs::kReverseAutologinRejectedEmailList); | 290 prefs::kReverseAutologinRejectedEmailList); |
| 290 updater->AppendIfNotPresent(new base::StringValue(email)); | 291 updater->AppendIfNotPresent(base::MakeUnique<base::StringValue>(email)); |
| 291 } | 292 } |
| 292 | 293 |
| 293 void InlineLoginUIBrowserTest::AllowSigninCookies(bool enable) { | 294 void InlineLoginUIBrowserTest::AllowSigninCookies(bool enable) { |
| 294 content_settings::CookieSettings* cookie_settings = | 295 content_settings::CookieSettings* cookie_settings = |
| 295 CookieSettingsFactory::GetForProfile(browser()->profile()).get(); | 296 CookieSettingsFactory::GetForProfile(browser()->profile()).get(); |
| 296 cookie_settings->SetDefaultCookieSetting(enable ? CONTENT_SETTING_ALLOW | 297 cookie_settings->SetDefaultCookieSetting(enable ? CONTENT_SETTING_ALLOW |
| 297 : CONTENT_SETTING_BLOCK); | 298 : CONTENT_SETTING_BLOCK); |
| 298 } | 299 } |
| 299 | 300 |
| 300 void InlineLoginUIBrowserTest::SetAllowedUsernamePattern( | 301 void InlineLoginUIBrowserTest::SetAllowedUsernamePattern( |
| (...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 848 content::WebContents* contents = | 849 content::WebContents* contents = |
| 849 browser()->tab_strip_model()->GetActiveWebContents(); | 850 browser()->tab_strip_model()->GetActiveWebContents(); |
| 850 ASSERT_TRUE(content::ExecuteScript( | 851 ASSERT_TRUE(content::ExecuteScript( |
| 851 contents, "window.location.href = 'chrome://foo'")); | 852 contents, "window.location.href = 'chrome://foo'")); |
| 852 | 853 |
| 853 content::TestNavigationObserver navigation_observer(contents, 1); | 854 content::TestNavigationObserver navigation_observer(contents, 1); |
| 854 navigation_observer.Wait(); | 855 navigation_observer.Wait(); |
| 855 | 856 |
| 856 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); | 857 EXPECT_EQ(GURL("about:blank"), contents->GetVisibleURL()); |
| 857 } | 858 } |
| OLD | NEW |