diff options
author | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-09 00:09:21 +0000 |
---|---|---|
committer | michaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-09 00:09:21 +0000 |
commit | 3367fc1dd134eeaf9ab6e62397f05ad3964319fe (patch) | |
tree | 78fb4d7ac912bbaf47b64f0aaefef331906b5fca /webkit/appcache/appcache_response_unittest.cc | |
parent | 9f9e1fcbbd52267fa657b3b0b80ece683ceb6dd6 (diff) | |
download | chromium_src-3367fc1dd134eeaf9ab6e62397f05ad3964319fe.zip chromium_src-3367fc1dd134eeaf9ab6e62397f05ad3964319fe.tar.gz chromium_src-3367fc1dd134eeaf9ab6e62397f05ad3964319fe.tar.bz2 |
AppCache changes to the networking model. Added new classes AppCacheRequestHandler and AppCacheURLRequestJob.
TEST=appcache_url_request_job_unittest.cc, appcache_request_handler_unittest.cc
BUG=none
Review URL: http://codereview.chromium.org/338034
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31411 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/appcache/appcache_response_unittest.cc')
-rw-r--r-- | webkit/appcache/appcache_response_unittest.cc | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/webkit/appcache/appcache_response_unittest.cc b/webkit/appcache/appcache_response_unittest.cc index 939086e..1077b9b 100644 --- a/webkit/appcache/appcache_response_unittest.cc +++ b/webkit/appcache/appcache_response_unittest.cc @@ -12,6 +12,7 @@ #include "webkit/appcache/mock_appcache_service.h" using net::IOBuffer; +using net::WrappedIOBuffer; namespace appcache { @@ -164,16 +165,21 @@ class AppCacheResponseTest : public testing::Test { // Wrappers to call AppCacheResponseReader/Writer Read and Write methods void WriteBasicResponse() { - static const char* kRawHttpHeaders = - "HTTP/1.0 200 OK\r\nContent-Length: 5\r\n\r\n"; - static const char* kRawHttpBody = "Hello"; - WriteResponse(MakeHttpResponseInfo(kRawHttpHeaders), kRawHttpBody); - } - - void WriteResponse(net::HttpResponseInfo* head, const char* body) { + static const char kHttpHeaders[] = + "HTTP/1.0 200 OK\0Content-Length: 5\0\0"; + static const char* kHttpBody = "Hello"; + scoped_refptr<IOBuffer> body = new WrappedIOBuffer(kHttpBody); + std::string raw_headers(kHttpHeaders, arraysize(kHttpHeaders)); + WriteResponse(MakeHttpResponseInfo(raw_headers), body, strlen(kHttpBody)); + } + + void WriteResponse(net::HttpResponseInfo* head, + IOBuffer* body, int body_len) { + DCHECK(body); + scoped_refptr<IOBuffer> body_ref(body); PushNextTask(method_factory_.NewRunnableMethod( &AppCacheResponseTest::WriteResponseBody, - new net::WrappedIOBuffer(body), strlen(body))); + body_ref, body_len)); WriteResponseHead(head); } @@ -238,7 +244,7 @@ class AppCacheResponseTest : public testing::Test { // Helpers to work with HttpResponseInfo objects - net::HttpResponseInfo* MakeHttpResponseInfo(const char* raw_headers) { + net::HttpResponseInfo* MakeHttpResponseInfo(const std::string& raw_headers) { net::HttpResponseInfo* info = new net::HttpResponseInfo; info->request_time = base::Time::Now(); info->response_time = base::Time::Now(); |