Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(175)

Side by Side Diff: chrome/browser/content_settings/content_settings_browsertest.cc

Issue 1391423002: net: Remove FilePath version of URLRequestMockHTTPJob::GetMockUrl(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: mmenke review Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "chrome/browser/chrome_notification_types.h" 9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/content_settings/cookie_settings_factory.h" 10 #include "chrome/browser/content_settings/cookie_settings_factory.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 // This fails on ChromeOS because kRestoreOnStartup is ignored and the startup 185 // This fails on ChromeOS because kRestoreOnStartup is ignored and the startup
186 // preference is always "continue where I left off. 186 // preference is always "continue where I left off.
187 #if !defined(OS_CHROMEOS) 187 #if !defined(OS_CHROMEOS)
188 188
189 // Verify that cookies can be allowed and set using exceptions for particular 189 // Verify that cookies can be allowed and set using exceptions for particular
190 // website(s) only for a session when all others are blocked. 190 // website(s) only for a session when all others are blocked.
191 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, 191 IN_PROC_BROWSER_TEST_F(ContentSettingsTest,
192 PRE_AllowCookiesForASessionUsingExceptions) { 192 PRE_AllowCookiesForASessionUsingExceptions) {
193 // NOTE: don't use test_server here, since we need the port to be the same 193 // NOTE: don't use test_server here, since we need the port to be the same
194 // across the restart. 194 // across the restart.
195 GURL url = URLRequestMockHTTPJob::GetMockUrl( 195 GURL url = URLRequestMockHTTPJob::GetMockUrl("setcookie.html");
196 base::FilePath(FILE_PATH_LITERAL("setcookie.html")));
197 content_settings::CookieSettings* settings = 196 content_settings::CookieSettings* settings =
198 CookieSettingsFactory::GetForProfile(browser()->profile()).get(); 197 CookieSettingsFactory::GetForProfile(browser()->profile()).get();
199 settings->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK); 198 settings->SetDefaultCookieSetting(CONTENT_SETTING_BLOCK);
200 199
201 ui_test_utils::NavigateToURL(browser(), url); 200 ui_test_utils::NavigateToURL(browser(), url);
202 ASSERT_TRUE(GetCookies(browser()->profile(), url).empty()); 201 ASSERT_TRUE(GetCookies(browser()->profile(), url).empty());
203 202
204 settings->SetCookieSetting( 203 settings->SetCookieSetting(
205 ContentSettingsPattern::FromURL(url), 204 ContentSettingsPattern::FromURL(url),
206 ContentSettingsPattern::Wildcard(), CONTENT_SETTING_SESSION_ONLY); 205 ContentSettingsPattern::Wildcard(), CONTENT_SETTING_SESSION_ONLY);
207 ui_test_utils::NavigateToURL(browser(), url); 206 ui_test_utils::NavigateToURL(browser(), url);
208 ASSERT_FALSE(GetCookies(browser()->profile(), url).empty()); 207 ASSERT_FALSE(GetCookies(browser()->profile(), url).empty());
209 } 208 }
210 209
211 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, 210 IN_PROC_BROWSER_TEST_F(ContentSettingsTest,
212 AllowCookiesForASessionUsingExceptions) { 211 AllowCookiesForASessionUsingExceptions) {
213 GURL url = URLRequestMockHTTPJob::GetMockUrl( 212 GURL url = URLRequestMockHTTPJob::GetMockUrl("setcookie.html");
214 base::FilePath(FILE_PATH_LITERAL("setcookie.html")));
215 ASSERT_TRUE(GetCookies(browser()->profile(), url).empty()); 213 ASSERT_TRUE(GetCookies(browser()->profile(), url).empty());
216 } 214 }
217 215
218 #endif // !CHROME_OS 216 #endif // !CHROME_OS
219 217
220 // Regression test for http://crbug.com/63649. 218 // Regression test for http://crbug.com/63649.
221 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, RedirectLoopCookies) { 219 IN_PROC_BROWSER_TEST_F(ContentSettingsTest, RedirectLoopCookies) {
222 ASSERT_TRUE(test_server()->Start()); 220 ASSERT_TRUE(test_server()->Start());
223 221
224 GURL test_url = test_server()->GetURL("files/redirect-loop.html"); 222 GURL test_url = test_server()->GetURL("files/redirect-loop.html");
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 // Disable this test in Metro+Ash for now (http://crbug.com/262796). 549 // Disable this test in Metro+Ash for now (http://crbug.com/262796).
552 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 550 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
553 switches::kAshBrowserTests)) 551 switches::kAshBrowserTests))
554 return; 552 return;
555 #endif 553 #endif
556 RunJavaScriptBlockedTest("load_nacl_no_js.html", true); 554 RunJavaScriptBlockedTest("load_nacl_no_js.html", true);
557 } 555 }
558 #endif // !defined(DISABLE_NACL) 556 #endif // !defined(DISABLE_NACL)
559 557
560 #endif // defined(ENABLE_PLUGINS) 558 #endif // defined(ENABLE_PLUGINS)
OLDNEW
« no previous file with comments | « chrome/browser/captive_portal/captive_portal_browsertest.cc ('k') | chrome/browser/download/download_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698