Index: content/child/resource_dispatcher_unittest.cc |
diff --git a/content/child/resource_dispatcher_unittest.cc b/content/child/resource_dispatcher_unittest.cc |
index b12db6b290451621d8af2ba7e9b6563bbfbdeaf4..970fe5dc9316d9a11866574004c42c0e3c8e1552 100644 |
--- a/content/child/resource_dispatcher_unittest.cc |
+++ b/content/child/resource_dispatcher_unittest.cc |
@@ -19,10 +19,8 @@ |
#include "net/base/net_errors.h" |
#include "net/http/http_response_headers.h" |
#include "testing/gtest/include/gtest/gtest.h" |
-#include "webkit/child/resource_loader_bridge.h" |
#include "webkit/common/appcache/appcache_interfaces.h" |
-using webkit_glue::ResourceLoaderBridge; |
using webkit_glue::ResourceResponseInfo; |
namespace content { |
@@ -164,37 +162,37 @@ class ResourceDispatcherTest : public testing::Test, public IPC::Sender { |
dispatcher_.reset(); |
} |
- ResourceLoaderBridge* CreateBridge() { |
- RequestInfo request_info; |
- request_info.method = "GET"; |
- request_info.url = GURL(test_page_url); |
- request_info.first_party_for_cookies = GURL(test_page_url); |
- request_info.referrer = GURL(); |
- request_info.headers = std::string(); |
- request_info.load_flags = 0; |
- request_info.requestor_pid = 0; |
- request_info.request_type = ResourceType::SUB_RESOURCE; |
- request_info.appcache_host_id = appcache::kNoHostId; |
- request_info.routing_id = 0; |
+ RequestInfo* CreateRequestInfo() { |
+ RequestInfo* request_info = new RequestInfo(); |
+ request_info->method = "GET"; |
+ request_info->url = GURL(test_page_url); |
+ request_info->first_party_for_cookies = GURL(test_page_url); |
+ request_info->referrer = GURL(); |
+ request_info->headers = std::string(); |
+ request_info->load_flags = 0; |
+ request_info->requestor_pid = 0; |
+ request_info->request_type = ResourceType::SUB_RESOURCE; |
+ request_info->appcache_host_id = appcache::kNoHostId; |
+ request_info->routing_id = 0; |
RequestExtraData extra_data; |
- request_info.extra_data = &extra_data; |
+ request_info->extra_data = &extra_data; |
- return dispatcher_->CreateBridge(request_info); |
+ return request_info; |
} |
std::vector<IPC::Message> message_queue_; |
static scoped_ptr<ResourceDispatcher> dispatcher_; |
}; |
-/*static*/ |
+// static |
scoped_ptr<ResourceDispatcher> ResourceDispatcherTest::dispatcher_; |
// Does a simple request and tests that the correct data is received. |
TEST_F(ResourceDispatcherTest, RoundTrip) { |
+ scoped_ptr<RequestInfo> request_info(CreateRequestInfo()); |
TestRequestCallback callback; |
- ResourceLoaderBridge* bridge = CreateBridge(); |
- bridge->Start(&callback); |
+ dispatcher_->StartAsync(*request_info.get(), NULL, &callback); |
ProcessMessages(); |
@@ -203,8 +201,6 @@ TEST_F(ResourceDispatcherTest, RoundTrip) { |
//EXPECT_TRUE(callback.complete()); |
//EXPECT_STREQ(test_page_contents, callback.data().c_str()); |
//EXPECT_EQ(test_page_contents_len, callback.total_encoded_data_length()); |
- |
- delete bridge; |
} |
// Tests that the request IDs are straight when there are multiple requests. |
@@ -329,14 +325,12 @@ class DeferredResourceLoadingTest : public ResourceDispatcherTest, |
TEST_F(DeferredResourceLoadingTest, DeferredLoadTest) { |
base::MessageLoopForIO message_loop; |
- ResourceLoaderBridge* bridge = CreateBridge(); |
- |
- bridge->Start(this); |
+ scoped_ptr<RequestInfo> request_info(CreateRequestInfo()); |
+ dispatcher_->StartAsync(*request_info.get(), NULL, this); |
InitMessages(); |
// Dispatch deferred messages. |
message_loop.RunUntilIdle(); |
- delete bridge; |
} |
class TimeConversionTest : public ResourceDispatcherTest, |
@@ -348,8 +342,8 @@ class TimeConversionTest : public ResourceDispatcherTest, |
} |
void PerformTest(const ResourceResponseHead& response_head) { |
- scoped_ptr<ResourceLoaderBridge> bridge(CreateBridge()); |
- bridge->Start(this); |
+ scoped_ptr<RequestInfo> request_info(CreateRequestInfo()); |
+ dispatcher_->StartAsync(*request_info.get(), NULL, this); |
dispatcher_->OnMessageReceived( |
ResourceMsg_ReceivedResponse(0, response_head)); |