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

Unified Diff: content/child/resource_dispatcher_unittest.cc

Issue 267973002: Revert of Remove webkit's ResourceLoaderBridge interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 8 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
« no previous file with comments | « content/child/resource_dispatcher.cc ('k') | content/child/web_url_loader_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/resource_dispatcher_unittest.cc
diff --git a/content/child/resource_dispatcher_unittest.cc b/content/child/resource_dispatcher_unittest.cc
index 2781387f7ce26332452fa20314d3480cbbd2c5e3..b12db6b290451621d8af2ba7e9b6563bbfbdeaf4 100644
--- a/content/child/resource_dispatcher_unittest.cc
+++ b/content/child/resource_dispatcher_unittest.cc
@@ -19,8 +19,10 @@
#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 {
@@ -162,37 +164,37 @@
dispatcher_.reset();
}
- RequestInfo* CreateRequestInfo(RequestExtraData* extra_data) {
- 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;
- request_info->extra_data = extra_data;
-
- return request_info;
+ 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;
+ RequestExtraData extra_data;
+ request_info.extra_data = &extra_data;
+
+ return dispatcher_->CreateBridge(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) {
- RequestExtraData extra_data;
- scoped_ptr<RequestInfo> request_info(CreateRequestInfo(&extra_data));
TestRequestCallback callback;
-
- dispatcher_->StartAsync(*request_info.get(), NULL, &callback);
+ ResourceLoaderBridge* bridge = CreateBridge();
+
+ bridge->Start(&callback);
ProcessMessages();
@@ -201,6 +203,8 @@
//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.
@@ -325,13 +329,14 @@
TEST_F(DeferredResourceLoadingTest, DeferredLoadTest) {
base::MessageLoopForIO message_loop;
- RequestExtraData extra_data;
- scoped_ptr<RequestInfo> request_info(CreateRequestInfo(&extra_data));
- dispatcher_->StartAsync(*request_info.get(), NULL, this);
+ ResourceLoaderBridge* bridge = CreateBridge();
+
+ bridge->Start(this);
InitMessages();
// Dispatch deferred messages.
message_loop.RunUntilIdle();
+ delete bridge;
}
class TimeConversionTest : public ResourceDispatcherTest,
@@ -343,9 +348,8 @@
}
void PerformTest(const ResourceResponseHead& response_head) {
- RequestExtraData extra_data;
- scoped_ptr<RequestInfo> request_info(CreateRequestInfo(&extra_data));
- dispatcher_->StartAsync(*request_info.get(), NULL, this);
+ scoped_ptr<ResourceLoaderBridge> bridge(CreateBridge());
+ bridge->Start(this);
dispatcher_->OnMessageReceived(
ResourceMsg_ReceivedResponse(0, response_head));
« no previous file with comments | « content/child/resource_dispatcher.cc ('k') | content/child/web_url_loader_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698