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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 9368031: Expose a static configuration value for the host to use for URLRequestTestHTTP tests. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Parameterize ALL the HTTP servers! Created 8 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: net/url_request/url_request_unittest.cc
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index bafbd6f7d831745c3d1449453206cb151a1501c7..24f33d265d26814079113cd41640aaabb871fdf2 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -64,6 +64,21 @@ namespace net {
namespace {
+// A subclass of TestServer that uses a statically-configured hostname. This is
+// to work around mysterious failures in chrome_frame_net_tests. See:
+// http://crbug.com/114369
+class LocalHttpServer : public TestServer {
eroman 2012/02/16 02:41:00 nit: I suggest calling LocalHttpTestServer
erikwright (departed) 2012/02/16 16:04:13 Done.
+ public:
+ explicit LocalHttpServer(const FilePath& document_root)
+ : TestServer(TestServer::TYPE_HTTP,
+ url_request_test_http_host(),
+ document_root) {}
+ LocalHttpServer()
+ : TestServer(TestServer::TYPE_HTTP,
+ url_request_test_http_host(),
+ FilePath()) {}
+};
+
const string16 kChrome(ASCIIToUTF16("chrome"));
const string16 kSecret(ASCIIToUTF16("secret"));
const string16 kUser(ASCIIToUTF16("user"));
@@ -395,8 +410,7 @@ class URLRequestTest : public PlatformTest {
class URLRequestTestHTTP : public URLRequestTest {
public:
URLRequestTestHTTP()
- : test_server_(TestServer::TYPE_HTTP,
- FilePath(FILE_PATH_LITERAL(
+ : test_server_(FilePath(FILE_PATH_LITERAL(
"net/data/url_request_unittest"))) {
}
@@ -506,7 +520,7 @@ class URLRequestTestHTTP : public URLRequestTest {
strlen(expected_data)));
}
- TestServer test_server_;
+ LocalHttpServer test_server_;
};
// In this unit test, we're using the HTTPTestServer as a proxy server and
@@ -2499,7 +2513,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) {
}
TEST_F(URLRequestTest, DelayedCookieCallback) {
- TestServer test_server(TestServer::TYPE_HTTP, FilePath());
+ LocalHttpServer test_server;
ASSERT_TRUE(test_server.Start());
scoped_refptr<URLRequestContext> context(new TestURLRequestContext());
@@ -2536,7 +2550,7 @@ TEST_F(URLRequestTest, DelayedCookieCallback) {
}
TEST_F(URLRequestTest, DoNotSendCookies) {
- TestServer test_server(TestServer::TYPE_HTTP, FilePath());
+ LocalHttpServer test_server;
ASSERT_TRUE(test_server.Start());
// Set up a cookie.
@@ -2583,7 +2597,7 @@ TEST_F(URLRequestTest, DoNotSendCookies) {
}
TEST_F(URLRequestTest, DoNotSaveCookies) {
- TestServer test_server(TestServer::TYPE_HTTP, FilePath());
+ LocalHttpServer test_server;
ASSERT_TRUE(test_server.Start());
// Set up a cookie.
@@ -2636,7 +2650,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies) {
}
TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) {
- TestServer test_server(TestServer::TYPE_HTTP, FilePath());
+ LocalHttpServer test_server;
ASSERT_TRUE(test_server.Start());
// Set up a cookie.
@@ -2684,7 +2698,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) {
}
TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) {
- TestServer test_server(TestServer::TYPE_HTTP, FilePath());
+ LocalHttpServer test_server;
ASSERT_TRUE(test_server.Start());
// Set up a cookie.
@@ -2734,7 +2748,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) {
}
TEST_F(URLRequestTest, DoNotSaveEmptyCookies) {
- TestServer test_server(TestServer::TYPE_HTTP, FilePath());
+ LocalHttpServer test_server;
ASSERT_TRUE(test_server.Start());
// Set up an empty cookie.
@@ -2752,7 +2766,7 @@ TEST_F(URLRequestTest, DoNotSaveEmptyCookies) {
}
TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) {
- TestServer test_server(TestServer::TYPE_HTTP, FilePath());
+ LocalHttpServer test_server;
ASSERT_TRUE(test_server.Start());
// Set up a cookie.
@@ -2800,7 +2814,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) {
}
TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) {
- TestServer test_server(TestServer::TYPE_HTTP, FilePath());
+ LocalHttpServer test_server;
ASSERT_TRUE(test_server.Start());
// Set up a cookie.
@@ -2856,7 +2870,7 @@ void CheckCookiePolicyCallback(bool* was_run, const CookieList& cookies) {
}
TEST_F(URLRequestTest, CookiePolicy_ForceSession) {
- TestServer test_server(TestServer::TYPE_HTTP, FilePath());
+ LocalHttpServer test_server;
ASSERT_TRUE(test_server.Start());
// Set up a cookie.
@@ -3534,7 +3548,7 @@ TEST_F(URLRequestTest, NetworkDelegateProxyError) {
// Check that it is impossible to change the referrer in the extra headers of
// an URLRequest.
TEST_F(URLRequestTest, DoNotOverrideReferrer) {
- TestServer test_server(TestServer::TYPE_HTTP, FilePath());
+ LocalHttpServer test_server;
ASSERT_TRUE(test_server.Start());
// If extra headers contain referer and the request contains a referer,
« net/url_request/url_request_test_util.cc ('K') | « net/url_request/url_request_test_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698