summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/child_process_security_policy_unittest.cc7
-rw-r--r--chrome/browser/chrome_plugin_unittest.cc24
-rw-r--r--chrome/browser/chromeos/gview_request_interceptor_unittest.cc6
-rw-r--r--chrome/browser/extensions/autoupdate_interceptor.cc15
-rw-r--r--chrome/browser/extensions/user_script_listener_unittest.cc6
-rw-r--r--chrome/browser/policy/device_management_service_browsertest.cc10
-rw-r--r--chrome/browser/printing/print_dialog_cloud_uitest.cc10
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc169
-rw-r--r--net/url_request/url_request_job_tracker_unittest.cc4
-rw-r--r--net/url_request/url_request_test_job.cc4
-rw-r--r--net/url_request/url_request_test_job.h3
-rw-r--r--net/url_request/url_request_unittest.cc48
-rw-r--r--webkit/appcache/appcache_update_job_unittest.cc17
13 files changed, 168 insertions, 155 deletions
diff --git a/chrome/browser/child_process_security_policy_unittest.cc b/chrome/browser/child_process_security_policy_unittest.cc
index cc31188..5ab84a9 100644
--- a/chrome/browser/child_process_security_policy_unittest.cc
+++ b/chrome/browser/child_process_security_policy_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -19,7 +19,7 @@ class ChildProcessSecurityPolicyTest : public testing::Test {
virtual void SetUp() {
// In the real world, "chrome:" is a handled scheme.
net::URLRequest::RegisterProtocolFactory(chrome::kChromeUIScheme,
- &URLRequestTestJob::Factory);
+ &net::URLRequestTestJob::Factory);
}
virtual void TearDown() {
net::URLRequest::RegisterProtocolFactory(chrome::kChromeUIScheme, NULL);
@@ -133,7 +133,8 @@ TEST_F(ChildProcessSecurityPolicyTest, RegisterWebSafeSchemeTest) {
EXPECT_TRUE(p->CanRequestURL(kRendererID, GURL("asdf:rockers")));
// Once we register a ProtocolFactory for "asdf", we default to deny.
- net::URLRequest::RegisterProtocolFactory("asdf", &URLRequestTestJob::Factory);
+ net::URLRequest::RegisterProtocolFactory("asdf",
+ &net::URLRequestTestJob::Factory);
EXPECT_FALSE(p->CanRequestURL(kRendererID, GURL("asdf:rockers")));
// We can allow new schemes by adding them to the whitelist.
diff --git a/chrome/browser/chrome_plugin_unittest.cc b/chrome/browser/chrome_plugin_unittest.cc
index 9322678..93dc18d 100644
--- a/chrome/browser/chrome_plugin_unittest.cc
+++ b/chrome/browser/chrome_plugin_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Tests exercising the Chrome Plugin API.
@@ -74,7 +74,7 @@ class ChromePluginTest : public testing::Test,
virtual void SetUp() {
LoadPlugin();
net::URLRequest::RegisterProtocolFactory("test",
- &URLRequestTestJob::Factory);
+ &net::URLRequestTestJob::Factory);
// We need to setup a default request context in order to issue HTTP
// requests.
@@ -126,10 +126,10 @@ static void STDCALL CPT_Complete(CPRequest* request, bool success,
EXPECT_TRUE(success);
EXPECT_EQ(200, headers->response_code());
- if (url == URLRequestTestJob::test_url_1()) {
- EXPECT_EQ(URLRequestTestJob::test_data_1(), body);
- } else if (url == URLRequestTestJob::test_url_2()) {
- EXPECT_EQ(URLRequestTestJob::test_data_2(), body);
+ if (url == net::URLRequestTestJob::test_url_1()) {
+ EXPECT_EQ(net::URLRequestTestJob::test_data_1(), body);
+ } else if (url == net::URLRequestTestJob::test_url_2()) {
+ EXPECT_EQ(net::URLRequestTestJob::test_data_2(), body);
} else if (url.spec().find("echo") != std::string::npos) {
EXPECT_EQ(kChromeTestPluginPostData, body);
}
@@ -249,7 +249,7 @@ TEST_F(ChromePluginTest, UnregisterIntercept) {
}
static void ProcessAllPendingMessages() {
- while (URLRequestTestJob::ProcessOnePendingMessage());
+ while (net::URLRequestTestJob::ProcessOnePendingMessage());
}
// Tests that the plugin can issue a GET request and receives the data when
@@ -257,10 +257,10 @@ static void ProcessAllPendingMessages() {
TEST_F(ChromePluginTest, CanMakeGETRequestSync) {
// test_url_1 has a synchronous response
EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request(
- "GET", URLRequestTestJob::test_url_1()));
+ "GET", net::URLRequestTestJob::test_url_1()));
// Note: we must add this task after we make the request, so that
- // URLRequestTestJob's StartAsync task is added and run first.
+ // net::URLRequestTestJob's StartAsync task is added and run first.
MessageLoop::current()->PostTask(FROM_HERE,
NewRunnableFunction(&ProcessAllPendingMessages));
MessageLoop::current()->Run();
@@ -271,10 +271,10 @@ TEST_F(ChromePluginTest, CanMakeGETRequestSync) {
TEST_F(ChromePluginTest, CanMakeGETRequestAsync) {
// test_url_2 has an asynchronous response
EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request(
- "GET", URLRequestTestJob::test_url_2()));
+ "GET", net::URLRequestTestJob::test_url_2()));
// Note: we must add this task after we make the request, so that
- // URLRequestTestJob's StartAsync task is added and run first.
+ // net::URLRequestTestJob's StartAsync task is added and run first.
MessageLoop::current()->PostTask(FROM_HERE,
NewRunnableFunction(&ProcessAllPendingMessages));
MessageLoop::current()->Run();
@@ -290,7 +290,7 @@ TEST_F(ChromePluginTest, CanMakePOSTRequest) {
EXPECT_EQ(CPERR_SUCCESS, test_funcs_.test_make_request("POST", url));
// Note: we must add this task after we make the request, so that
- // URLRequestTestJob's StartAsync task is added and run first.
+ // net::URLRequestTestJob's StartAsync task is added and run first.
MessageLoop::current()->PostTask(FROM_HERE,
NewRunnableFunction(&ProcessAllPendingMessages));
MessageLoop::current()->Run();
diff --git a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
index 6f9c68e..ba84fd5 100644
--- a/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
+++ b/chrome/browser/chromeos/gview_request_interceptor_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -17,10 +17,10 @@
namespace chromeos {
-class GViewURLRequestTestJob : public URLRequestTestJob {
+class GViewURLRequestTestJob : public net::URLRequestTestJob {
public:
explicit GViewURLRequestTestJob(net::URLRequest* request)
- : URLRequestTestJob(request, true) {
+ : net::URLRequestTestJob(request, true) {
}
virtual bool GetMimeType(std::string* mime_type) const {
diff --git a/chrome/browser/extensions/autoupdate_interceptor.cc b/chrome/browser/extensions/autoupdate_interceptor.cc
index 751658b..7f90a10 100644
--- a/chrome/browser/extensions/autoupdate_interceptor.cc
+++ b/chrome/browser/extensions/autoupdate_interceptor.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -10,14 +10,19 @@
#include "net/url_request/url_request_test_job.h"
#include "testing/gtest/include/gtest/gtest.h"
-// This is a specialized version of URLRequestTestJob that lets us specify
+// This is a specialized version of net::URLRequestTestJob that lets us specify
// response data and make sure the response code is 200, which the autoupdate
// code relies on.
-class AutoUpdateTestRequestJob : public URLRequestTestJob {
+class AutoUpdateTestRequestJob : public net::URLRequestTestJob {
public:
AutoUpdateTestRequestJob(net::URLRequest* request,
- const std::string& response_data) : URLRequestTestJob(
- request, URLRequestTestJob::test_headers(), response_data, true) {}
+ const std::string& response_data)
+ : net::URLRequestTestJob(request,
+ net::URLRequestTestJob::test_headers(),
+ response_data,
+ true) {
+ }
+
virtual int GetResponseCode() const { return 200; }
private:
diff --git a/chrome/browser/extensions/user_script_listener_unittest.cc b/chrome/browser/extensions/user_script_listener_unittest.cc
index fe735ae..8c8a415 100644
--- a/chrome/browser/extensions/user_script_listener_unittest.cc
+++ b/chrome/browser/extensions/user_script_listener_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -95,10 +95,10 @@ ResourceDispatcherHostRequestInfo* CreateRequestInfo(int request_id) {
// A simple test net::URLRequestJob. We don't care what it does, only that
// whether it starts and finishes.
-class SimpleTestJob : public URLRequestTestJob {
+class SimpleTestJob : public net::URLRequestTestJob {
public:
explicit SimpleTestJob(net::URLRequest* request)
- : URLRequestTestJob(request, test_headers(), kTestData, true) {}
+ : net::URLRequestTestJob(request, test_headers(), kTestData, true) {}
private:
~SimpleTestJob() {}
};
diff --git a/chrome/browser/policy/device_management_service_browsertest.cc b/chrome/browser/policy/device_management_service_browsertest.cc
index feed86f..b8ad273 100644
--- a/chrome/browser/policy/device_management_service_browsertest.cc
+++ b/chrome/browser/policy/device_management_service_browsertest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -60,10 +60,10 @@ class CannedResponseInterceptor : public net::URLRequest::Interceptor {
virtual net::URLRequestJob* MaybeIntercept(net::URLRequest* request) {
if (request->url().GetOrigin() == service_url_.GetOrigin() &&
request->url().path() == service_url_.path()) {
- return new URLRequestTestJob(request,
- URLRequestTestJob::test_headers(),
- response_data_,
- true);
+ return new net::URLRequestTestJob(request,
+ net::URLRequestTestJob::test_headers(),
+ response_data_,
+ true);
}
return NULL;
diff --git a/chrome/browser/printing/print_dialog_cloud_uitest.cc b/chrome/browser/printing/print_dialog_cloud_uitest.cc
index aee03ee..1753de3 100644
--- a/chrome/browser/printing/print_dialog_cloud_uitest.cc
+++ b/chrome/browser/printing/print_dialog_cloud_uitest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -59,14 +59,14 @@ class TestData {
// A simple test net::URLRequestJob. We don't care what it does, only that
// whether it starts and finishes.
-class SimpleTestJob : public URLRequestTestJob {
+class SimpleTestJob : public net::URLRequestTestJob {
public:
explicit SimpleTestJob(net::URLRequest* request)
- : URLRequestTestJob(request, test_headers(),
- TestData::GetInstance()->GetTestData(), true) {}
+ : net::URLRequestTestJob(request, test_headers(),
+ TestData::GetInstance()->GetTestData(), true) {}
virtual void GetResponseInfo(net::HttpResponseInfo* info) {
- URLRequestTestJob::GetResponseInfo(info);
+ net::URLRequestTestJob::GetResponseInfo(info);
if (request_->url().SchemeIsSecure()) {
// Make up a fake certificate for this response since we don't have
// access to the real SSL info.
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
index 5b6758c..91bbe4d 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -252,10 +252,12 @@ class ResourceDispatcherHostTest : public testing::Test,
static net::URLRequestJob* Factory(net::URLRequest* request,
const std::string& scheme) {
if (test_fixture_->response_headers_.empty()) {
- return new URLRequestTestJob(request);
+ return new net::URLRequestTestJob(request);
} else {
- return new URLRequestTestJob(request, test_fixture_->response_headers_,
- test_fixture_->response_data_, false);
+ return new net::URLRequestTestJob(request,
+ test_fixture_->response_headers_,
+ test_fixture_->response_data_,
+ false);
}
}
@@ -342,12 +344,12 @@ void CheckSuccessfulRequest(const std::vector<IPC::Message>& messages,
TEST_F(ResourceDispatcherHostTest, TestMany) {
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
- MakeTestRequest(0, 1, URLRequestTestJob::test_url_1());
- MakeTestRequest(0, 2, URLRequestTestJob::test_url_2());
- MakeTestRequest(0, 3, URLRequestTestJob::test_url_3());
+ MakeTestRequest(0, 1, net::URLRequestTestJob::test_url_1());
+ MakeTestRequest(0, 2, net::URLRequestTestJob::test_url_2());
+ MakeTestRequest(0, 3, net::URLRequestTestJob::test_url_3());
// flush all the pending requests
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
@@ -358,9 +360,9 @@ TEST_F(ResourceDispatcherHostTest, TestMany) {
// there are three requests, so we should have gotten them classified as such
ASSERT_EQ(3U, msgs.size());
- CheckSuccessfulRequest(msgs[0], URLRequestTestJob::test_data_1());
- CheckSuccessfulRequest(msgs[1], URLRequestTestJob::test_data_2());
- CheckSuccessfulRequest(msgs[2], URLRequestTestJob::test_data_3());
+ CheckSuccessfulRequest(msgs[0], net::URLRequestTestJob::test_data_1());
+ CheckSuccessfulRequest(msgs[1], net::URLRequestTestJob::test_data_2());
+ CheckSuccessfulRequest(msgs[2], net::URLRequestTestJob::test_data_3());
}
// Tests whether messages get canceled properly. We issue three requests,
@@ -368,13 +370,13 @@ TEST_F(ResourceDispatcherHostTest, TestMany) {
TEST_F(ResourceDispatcherHostTest, Cancel) {
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
- MakeTestRequest(0, 1, URLRequestTestJob::test_url_1());
- MakeTestRequest(0, 2, URLRequestTestJob::test_url_2());
- MakeTestRequest(0, 3, URLRequestTestJob::test_url_3());
+ MakeTestRequest(0, 1, net::URLRequestTestJob::test_url_1());
+ MakeTestRequest(0, 2, net::URLRequestTestJob::test_url_2());
+ MakeTestRequest(0, 3, net::URLRequestTestJob::test_url_3());
MakeCancelRequest(2);
// flush all the pending requests
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
MessageLoop::current()->RunAllPending();
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
@@ -385,8 +387,8 @@ TEST_F(ResourceDispatcherHostTest, Cancel) {
// there are three requests, so we should have gotten them classified as such
ASSERT_EQ(3U, msgs.size());
- CheckSuccessfulRequest(msgs[0], URLRequestTestJob::test_data_1());
- CheckSuccessfulRequest(msgs[2], URLRequestTestJob::test_data_3());
+ CheckSuccessfulRequest(msgs[0], net::URLRequestTestJob::test_data_1());
+ CheckSuccessfulRequest(msgs[2], net::URLRequestTestJob::test_data_3());
// Check that request 2 got canceled.
ASSERT_EQ(2U, msgs[1].size());
@@ -431,17 +433,19 @@ TEST_F(ResourceDispatcherHostTest, TestProcessCancel) {
// request 1 goes to the test delegate
ViewHostMsg_Resource_Request request = CreateResourceRequest(
- "GET", ResourceType::SUB_RESOURCE, URLRequestTestJob::test_url_1());
+ "GET", ResourceType::SUB_RESOURCE, net::URLRequestTestJob::test_url_1());
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
- MakeTestRequest(test_filter.get(), 0, 1, URLRequestTestJob::test_url_1());
+ MakeTestRequest(test_filter.get(), 0, 1,
+ net::URLRequestTestJob::test_url_1());
// request 2 goes to us
- MakeTestRequest(0, 2, URLRequestTestJob::test_url_2());
+ MakeTestRequest(0, 2, net::URLRequestTestJob::test_url_2());
// request 3 goes to the test delegate
- MakeTestRequest(test_filter.get(), 0, 3, URLRequestTestJob::test_url_3());
+ MakeTestRequest(test_filter.get(), 0, 3,
+ net::URLRequestTestJob::test_url_3());
// TODO(mbelshe):
// Now that the async IO path is in place, the IO always completes on the
@@ -451,14 +455,14 @@ TEST_F(ResourceDispatcherHostTest, TestProcessCancel) {
// Process each request for one level so one callback is called.
for (int i = 0; i < 3; i++)
- EXPECT_TRUE(URLRequestTestJob::ProcessOnePendingMessage());
+ EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage());
// Cancel the requests to the test process.
host_.CancelRequestsForProcess(filter_->child_id());
test_filter->has_canceled_ = true;
// Flush all the pending requests.
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
EXPECT_EQ(0, host_.pending_requests());
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(filter_->child_id()));
@@ -470,7 +474,7 @@ TEST_F(ResourceDispatcherHostTest, TestProcessCancel) {
ResourceIPCAccumulator::ClassifiedMessages msgs;
accum_.GetClassifiedMessages(&msgs);
ASSERT_EQ(1U, msgs.size());
- CheckSuccessfulRequest(msgs[0], URLRequestTestJob::test_data_2());
+ CheckSuccessfulRequest(msgs[0], net::URLRequestTestJob::test_data_2());
}
// Tests blocking and resuming requests.
@@ -481,15 +485,15 @@ TEST_F(ResourceDispatcherHostTest, TestBlockingResumingRequests) {
host_.BlockRequestsForRoute(filter_->child_id(), 2);
host_.BlockRequestsForRoute(filter_->child_id(), 3);
- MakeTestRequest(0, 1, URLRequestTestJob::test_url_1());
- MakeTestRequest(1, 2, URLRequestTestJob::test_url_2());
- MakeTestRequest(0, 3, URLRequestTestJob::test_url_3());
- MakeTestRequest(1, 4, URLRequestTestJob::test_url_1());
- MakeTestRequest(2, 5, URLRequestTestJob::test_url_2());
- MakeTestRequest(3, 6, URLRequestTestJob::test_url_3());
+ MakeTestRequest(0, 1, net::URLRequestTestJob::test_url_1());
+ MakeTestRequest(1, 2, net::URLRequestTestJob::test_url_2());
+ MakeTestRequest(0, 3, net::URLRequestTestJob::test_url_3());
+ MakeTestRequest(1, 4, net::URLRequestTestJob::test_url_1());
+ MakeTestRequest(2, 5, net::URLRequestTestJob::test_url_2());
+ MakeTestRequest(3, 6, net::URLRequestTestJob::test_url_3());
// Flush all the pending requests
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
// Sort out all the messages we saw by request
ResourceIPCAccumulator::ClassifiedMessages msgs;
@@ -498,41 +502,41 @@ TEST_F(ResourceDispatcherHostTest, TestBlockingResumingRequests) {
// All requests but the 2 for the RVH 0 should have been blocked.
ASSERT_EQ(2U, msgs.size());
- CheckSuccessfulRequest(msgs[0], URLRequestTestJob::test_data_1());
- CheckSuccessfulRequest(msgs[1], URLRequestTestJob::test_data_3());
+ CheckSuccessfulRequest(msgs[0], net::URLRequestTestJob::test_data_1());
+ CheckSuccessfulRequest(msgs[1], net::URLRequestTestJob::test_data_3());
// Resume requests for RVH 1 and flush pending requests.
host_.ResumeBlockedRequestsForRoute(filter_->child_id(), 1);
KickOffRequest();
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
msgs.clear();
accum_.GetClassifiedMessages(&msgs);
ASSERT_EQ(2U, msgs.size());
- CheckSuccessfulRequest(msgs[0], URLRequestTestJob::test_data_2());
- CheckSuccessfulRequest(msgs[1], URLRequestTestJob::test_data_1());
+ CheckSuccessfulRequest(msgs[0], net::URLRequestTestJob::test_data_2());
+ CheckSuccessfulRequest(msgs[1], net::URLRequestTestJob::test_data_1());
// Test that new requests are not blocked for RVH 1.
- MakeTestRequest(1, 7, URLRequestTestJob::test_url_1());
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ MakeTestRequest(1, 7, net::URLRequestTestJob::test_url_1());
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
msgs.clear();
accum_.GetClassifiedMessages(&msgs);
ASSERT_EQ(1U, msgs.size());
- CheckSuccessfulRequest(msgs[0], URLRequestTestJob::test_data_1());
+ CheckSuccessfulRequest(msgs[0], net::URLRequestTestJob::test_data_1());
// Now resumes requests for all RVH (2 and 3).
host_.ResumeBlockedRequestsForRoute(filter_->child_id(), 2);
host_.ResumeBlockedRequestsForRoute(filter_->child_id(), 3);
KickOffRequest();
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(filter_->child_id()));
msgs.clear();
accum_.GetClassifiedMessages(&msgs);
ASSERT_EQ(2U, msgs.size());
- CheckSuccessfulRequest(msgs[0], URLRequestTestJob::test_data_2());
- CheckSuccessfulRequest(msgs[1], URLRequestTestJob::test_data_3());
+ CheckSuccessfulRequest(msgs[0], net::URLRequestTestJob::test_data_2());
+ CheckSuccessfulRequest(msgs[1], net::URLRequestTestJob::test_data_3());
}
// Tests blocking and canceling requests.
@@ -541,13 +545,13 @@ TEST_F(ResourceDispatcherHostTest, TestBlockingCancelingRequests) {
host_.BlockRequestsForRoute(filter_->child_id(), 1);
- MakeTestRequest(0, 1, URLRequestTestJob::test_url_1());
- MakeTestRequest(1, 2, URLRequestTestJob::test_url_2());
- MakeTestRequest(0, 3, URLRequestTestJob::test_url_3());
- MakeTestRequest(1, 4, URLRequestTestJob::test_url_1());
+ MakeTestRequest(0, 1, net::URLRequestTestJob::test_url_1());
+ MakeTestRequest(1, 2, net::URLRequestTestJob::test_url_2());
+ MakeTestRequest(0, 3, net::URLRequestTestJob::test_url_3());
+ MakeTestRequest(1, 4, net::URLRequestTestJob::test_url_1());
// Flush all the pending requests.
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
// Sort out all the messages we saw by request.
ResourceIPCAccumulator::ClassifiedMessages msgs;
@@ -556,13 +560,13 @@ TEST_F(ResourceDispatcherHostTest, TestBlockingCancelingRequests) {
// The 2 requests for the RVH 0 should have been processed.
ASSERT_EQ(2U, msgs.size());
- CheckSuccessfulRequest(msgs[0], URLRequestTestJob::test_data_1());
- CheckSuccessfulRequest(msgs[1], URLRequestTestJob::test_data_3());
+ CheckSuccessfulRequest(msgs[0], net::URLRequestTestJob::test_data_1());
+ CheckSuccessfulRequest(msgs[1], net::URLRequestTestJob::test_data_3());
// Cancel requests for RVH 1.
host_.CancelBlockedRequestsForRoute(filter_->child_id(), 1);
KickOffRequest();
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(filter_->child_id()));
@@ -582,16 +586,18 @@ TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies) {
host_.BlockRequestsForRoute(second_filter->child_id(), 0);
- MakeTestRequest(filter_.get(), 0, 1, URLRequestTestJob::test_url_1());
- MakeTestRequest(second_filter.get(), 0, 2, URLRequestTestJob::test_url_2());
- MakeTestRequest(filter_.get(), 0, 3, URLRequestTestJob::test_url_3());
- MakeTestRequest(second_filter.get(), 0, 4, URLRequestTestJob::test_url_1());
+ MakeTestRequest(filter_.get(), 0, 1, net::URLRequestTestJob::test_url_1());
+ MakeTestRequest(second_filter.get(), 0, 2,
+ net::URLRequestTestJob::test_url_2());
+ MakeTestRequest(filter_.get(), 0, 3, net::URLRequestTestJob::test_url_3());
+ MakeTestRequest(second_filter.get(), 0, 4,
+ net::URLRequestTestJob::test_url_1());
// Simulate process death.
host_.CancelRequestsForProcess(second_filter->child_id());
// Flush all the pending requests.
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(filter_->child_id()));
EXPECT_EQ(0,
@@ -604,8 +610,8 @@ TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsProcessDies) {
// The 2 requests for the RVH 0 should have been processed.
ASSERT_EQ(2U, msgs.size());
- CheckSuccessfulRequest(msgs[0], URLRequestTestJob::test_data_1());
- CheckSuccessfulRequest(msgs[1], URLRequestTestJob::test_data_3());
+ CheckSuccessfulRequest(msgs[0], net::URLRequestTestJob::test_data_1());
+ CheckSuccessfulRequest(msgs[1], net::URLRequestTestJob::test_data_3());
EXPECT_TRUE(host_.blocked_requests_map_.empty());
}
@@ -622,15 +628,16 @@ TEST_F(ResourceDispatcherHostTest, TestBlockedRequestsDontLeak) {
host_.BlockRequestsForRoute(filter_->child_id(), 2);
host_.BlockRequestsForRoute(second_filter->child_id(), 1);
- MakeTestRequest(filter_.get(), 0, 1, URLRequestTestJob::test_url_1());
- MakeTestRequest(filter_.get(), 1, 2, URLRequestTestJob::test_url_2());
- MakeTestRequest(filter_.get(), 0, 3, URLRequestTestJob::test_url_3());
- MakeTestRequest(second_filter.get(), 1, 4, URLRequestTestJob::test_url_1());
- MakeTestRequest(filter_.get(), 2, 5, URLRequestTestJob::test_url_2());
- MakeTestRequest(filter_.get(), 2, 6, URLRequestTestJob::test_url_3());
+ MakeTestRequest(filter_.get(), 0, 1, net::URLRequestTestJob::test_url_1());
+ MakeTestRequest(filter_.get(), 1, 2, net::URLRequestTestJob::test_url_2());
+ MakeTestRequest(filter_.get(), 0, 3, net::URLRequestTestJob::test_url_3());
+ MakeTestRequest(second_filter.get(), 1, 4,
+ net::URLRequestTestJob::test_url_1());
+ MakeTestRequest(filter_.get(), 2, 5, net::URLRequestTestJob::test_url_2());
+ MakeTestRequest(filter_.get(), 2, 6, net::URLRequestTestJob::test_url_3());
// Flush all the pending requests.
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
}
// Test the private helper method "CalculateApproximateMemoryCost()".
@@ -699,7 +706,7 @@ TEST_F(ResourceDispatcherHostTest, TooManyOutstandingRequests) {
int kMemoryCostOfTest2Req =
ResourceDispatcherHost::kAvgBytesPerOutstandingRequest +
std::string("GET").size() +
- URLRequestTestJob::test_url_2().spec().size();
+ net::URLRequestTestJob::test_url_2().spec().size();
// Tighten the bound on the ResourceDispatcherHost, to speed things up.
int kMaxCostPerProcess = 440000;
@@ -713,24 +720,26 @@ TEST_F(ResourceDispatcherHostTest, TooManyOutstandingRequests) {
scoped_refptr<ForwardingFilter> second_filter = new ForwardingFilter(this);
// Saturate the number of outstanding requests for our process.
- for (size_t i = 0; i < kMaxRequests; ++i)
- MakeTestRequest(filter_.get(), 0, i + 1, URLRequestTestJob::test_url_2());
+ for (size_t i = 0; i < kMaxRequests; ++i) {
+ MakeTestRequest(filter_.get(), 0, i + 1,
+ net::URLRequestTestJob::test_url_2());
+ }
// Issue two more requests for our process -- these should fail immediately.
MakeTestRequest(filter_.get(), 0, kMaxRequests + 1,
- URLRequestTestJob::test_url_2());
+ net::URLRequestTestJob::test_url_2());
MakeTestRequest(filter_.get(), 0, kMaxRequests + 2,
- URLRequestTestJob::test_url_2());
+ net::URLRequestTestJob::test_url_2());
// Issue two requests for the second process -- these should succeed since
// it is just process 0 that is saturated.
MakeTestRequest(second_filter.get(), 0, kMaxRequests + 3,
- URLRequestTestJob::test_url_2());
+ net::URLRequestTestJob::test_url_2());
MakeTestRequest(second_filter.get(), 0, kMaxRequests + 4,
- URLRequestTestJob::test_url_2());
+ net::URLRequestTestJob::test_url_2());
// Flush all the pending requests.
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
MessageLoop::current()->RunAllPending();
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(filter_->child_id()));
@@ -744,7 +753,7 @@ TEST_F(ResourceDispatcherHostTest, TooManyOutstandingRequests) {
// Check that the first kMaxRequests succeeded.
for (size_t i = 0; i < kMaxRequests; ++i)
- CheckSuccessfulRequest(msgs[i], URLRequestTestJob::test_data_2());
+ CheckSuccessfulRequest(msgs[i], net::URLRequestTestJob::test_data_2());
// Check that the subsequent two requests (kMaxRequests + 1) and
// (kMaxRequests + 2) were failed, since the per-process bound was reached.
@@ -770,9 +779,9 @@ TEST_F(ResourceDispatcherHostTest, TooManyOutstandingRequests) {
// The final 2 requests should have succeeded.
CheckSuccessfulRequest(msgs[kMaxRequests + 2],
- URLRequestTestJob::test_data_2());
+ net::URLRequestTestJob::test_data_2());
CheckSuccessfulRequest(msgs[kMaxRequests + 3],
- URLRequestTestJob::test_data_2());
+ net::URLRequestTestJob::test_data_2());
}
// Tests that we sniff the mime type for a simple request.
@@ -789,7 +798,7 @@ TEST_F(ResourceDispatcherHostTest, MimeSniffed) {
MakeTestRequest(0, 1, GURL("http:bla"));
// Flush all pending requests.
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
@@ -818,7 +827,7 @@ TEST_F(ResourceDispatcherHostTest, MimeNotSniffed) {
MakeTestRequest(0, 1, GURL("http:bla"));
// Flush all pending requests.
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
@@ -846,7 +855,7 @@ TEST_F(ResourceDispatcherHostTest, MimeNotSniffed2) {
MakeTestRequest(0, 1, GURL("http:bla"));
// Flush all pending requests.
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
@@ -873,7 +882,7 @@ TEST_F(ResourceDispatcherHostTest, MimeSniff204) {
MakeTestRequest(0, 1, GURL("http:bla"));
// Flush all pending requests.
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
@@ -906,7 +915,7 @@ TEST_F(ResourceDispatcherHostTest, ForbiddenDownload) {
MakeTestRequest(0, 1, GURL("http:bla"));
// Flush all pending requests.
- while (URLRequestTestJob::ProcessOnePendingMessage()) {}
+ while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
diff --git a/net/url_request/url_request_job_tracker_unittest.cc b/net/url_request/url_request_job_tracker_unittest.cc
index bd62ef7..31818ac 100644
--- a/net/url_request/url_request_job_tracker_unittest.cc
+++ b/net/url_request/url_request_job_tracker_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -64,7 +64,7 @@ class MockJobObserver : public net::URLRequestJobTracker::JobObserver {
};
// A net::URLRequestJob that returns static content for given URLs. We do
-// not use URLRequestTestJob here because URLRequestTestJob fakes
+// not use net::URLRequestTestJob here because net::URLRequestTestJob fakes
// async operations by calling ReadRawData synchronously in an async
// callback. This test requires a net::URLRequestJob that returns false for
// async reads, in order to exercise the real async read codepath.
diff --git a/net/url_request/url_request_test_job.cc b/net/url_request/url_request_test_job.cc
index 4aa7c16..0d0bc5d 100644
--- a/net/url_request/url_request_test_job.cc
+++ b/net/url_request/url_request_test_job.cc
@@ -13,13 +13,13 @@
#include "net/http/http_response_headers.h"
#include "net/url_request/url_request.h"
+namespace net {
+
// This emulates the global message loop for the test URL request class, since
// this is only test code, it's probably not too dangerous to have this static
// object.
static std::vector< scoped_refptr<URLRequestTestJob> > g_pending_jobs;
-namespace net {
-
// static getters for known URLs
GURL URLRequestTestJob::test_url_1() {
return GURL("test:url1");
diff --git a/net/url_request/url_request_test_job.h b/net/url_request/url_request_test_job.h
index 252c173..133565e 100644
--- a/net/url_request/url_request_test_job.h
+++ b/net/url_request/url_request_test_job.h
@@ -138,7 +138,4 @@ class URLRequestTestJob : public URLRequestJob {
} // namespace net
-// TODO(tfarina): Fix the callers and remove this!
-typedef net::URLRequestTestJob URLRequestTestJob;
-
#endif // NET_URL_REQUEST_URL_REQUEST_TEST_JOB_H_
diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc
index 4be2ec5..11a313b 100644
--- a/net/url_request/url_request_unittest.cc
+++ b/net/url_request/url_request_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -1820,10 +1820,10 @@ TEST_F(URLRequestTestHTTP, Post307RedirectPost) {
}
// Custom URLRequestJobs for use with interceptor tests
-class RestartTestJob : public URLRequestTestJob {
+class RestartTestJob : public net::URLRequestTestJob {
public:
explicit RestartTestJob(net::URLRequest* request)
- : URLRequestTestJob(request, true) {}
+ : net::URLRequestTestJob(request, true) {}
protected:
virtual void StartAsync() {
this->NotifyRestartRequired();
@@ -1832,10 +1832,10 @@ class RestartTestJob : public URLRequestTestJob {
~RestartTestJob() {}
};
-class CancelTestJob : public URLRequestTestJob {
+class CancelTestJob : public net::URLRequestTestJob {
public:
explicit CancelTestJob(net::URLRequest* request)
- : URLRequestTestJob(request, true) {}
+ : net::URLRequestTestJob(request, true) {}
protected:
virtual void StartAsync() {
request_->Cancel();
@@ -1844,10 +1844,10 @@ class CancelTestJob : public URLRequestTestJob {
~CancelTestJob() {}
};
-class CancelThenRestartTestJob : public URLRequestTestJob {
+class CancelThenRestartTestJob : public net::URLRequestTestJob {
public:
explicit CancelThenRestartTestJob(net::URLRequest* request)
- : URLRequestTestJob(request, true) {
+ : net::URLRequestTestJob(request, true) {
}
protected:
virtual void StartAsync() {
@@ -1899,16 +1899,16 @@ class TestInterceptor : net::URLRequest::Interceptor {
simulate_main_network_error_ = false;
did_simulate_error_main_ = true;
// will error since the requeted url is not one of its canned urls
- return new URLRequestTestJob(request, true);
+ return new net::URLRequestTestJob(request, true);
}
if (!intercept_main_request_)
return NULL;
intercept_main_request_ = false;
did_intercept_main_ = true;
- return new URLRequestTestJob(request,
- main_headers_,
- main_data_,
- true);
+ return new net::URLRequestTestJob(request,
+ main_headers_,
+ main_data_,
+ true);
}
virtual net::URLRequestJob* MaybeInterceptRedirect(net::URLRequest* request,
@@ -1922,10 +1922,10 @@ class TestInterceptor : net::URLRequest::Interceptor {
return NULL;
intercept_redirect_ = false;
did_intercept_redirect_ = true;
- return new URLRequestTestJob(request,
- redirect_headers_,
- redirect_data_,
- true);
+ return new net::URLRequestTestJob(request,
+ redirect_headers_,
+ redirect_data_,
+ true);
}
virtual net::URLRequestJob* MaybeInterceptResponse(net::URLRequest* request) {
@@ -1938,10 +1938,10 @@ class TestInterceptor : net::URLRequest::Interceptor {
return NULL;
intercept_final_response_ = false;
did_intercept_final_ = true;
- return new URLRequestTestJob(request,
- final_headers_,
- final_data_,
- true);
+ return new net::URLRequestTestJob(request,
+ final_headers_,
+ final_data_,
+ true);
}
// Whether to intercept the main request, and if so the response to return.
@@ -1985,11 +1985,11 @@ class TestInterceptor : net::URLRequest::Interceptor {
// Static getters for canned response header and data strings
static std::string ok_data() {
- return URLRequestTestJob::test_data_1();
+ return net::URLRequestTestJob::test_data_1();
}
static std::string ok_headers() {
- return URLRequestTestJob::test_headers();
+ return net::URLRequestTestJob::test_headers();
}
static std::string redirect_data() {
@@ -1997,7 +1997,7 @@ class TestInterceptor : net::URLRequest::Interceptor {
}
static std::string redirect_headers() {
- return URLRequestTestJob::test_redirect_headers();
+ return net::URLRequestTestJob::test_redirect_headers();
}
static std::string error_data() {
@@ -2005,7 +2005,7 @@ class TestInterceptor : net::URLRequest::Interceptor {
}
static std::string error_headers() {
- return URLRequestTestJob::test_error_headers();
+ return net::URLRequestTestJob::test_error_headers();
}
};
diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc
index 234c967..46f4cf7 100644
--- a/webkit/appcache/appcache_update_job_unittest.cc
+++ b/webkit/appcache/appcache_update_job_unittest.cc
@@ -48,7 +48,7 @@ class MockHttpServer {
std::string headers, body;
GetMockResponse(request->url().path(), &headers, &body);
- return new URLRequestTestJob(request, headers, body, true);
+ return new net::URLRequestTestJob(request, headers, body, true);
}
private:
@@ -289,14 +289,15 @@ class MockFrontend : public AppCacheFrontend {
// Helper factories to simulate redirected URL responses for tests.
static net::URLRequestJob* RedirectFactory(net::URLRequest* request,
const std::string& scheme) {
- return new URLRequestTestJob(request,
- URLRequestTestJob::test_redirect_headers(),
- URLRequestTestJob::test_data_1(),
- true);
+ return new net::URLRequestTestJob(
+ request,
+ net::URLRequestTestJob::test_redirect_headers(),
+ net::URLRequestTestJob::test_data_1(),
+ true);
}
// Helper class to simulate a URL that returns retry or success.
-class RetryRequestTestJob : public URLRequestTestJob {
+class RetryRequestTestJob : public net::URLRequestTestJob {
public:
enum RetryHeader {
NO_RETRY_AFTER,
@@ -380,7 +381,7 @@ class RetryRequestTestJob : public URLRequestTestJob {
explicit RetryRequestTestJob(net::URLRequest* request,
const std::string& headers,
int response_code)
- : URLRequestTestJob(request, headers, data(), true),
+ : net::URLRequestTestJob(request, headers, data(), true),
response_code_(response_code) {
}
@@ -400,7 +401,7 @@ RetryRequestTestJob::RetryHeader RetryRequestTestJob::retry_after_;
int RetryRequestTestJob::expected_requests_ = 0;
// Helper class to check for certain HTTP headers.
-class HttpHeadersRequestTestJob : public URLRequestTestJob {
+class HttpHeadersRequestTestJob : public net::URLRequestTestJob {
public:
// Call this at the start of each HTTP header-related test.
static void Initialize(const std::string& expect_if_modified_since,