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

Side by Side Diff: net/http/http_transaction_unittest.cc

Issue 18390: Change URLRequest to use a ref-counted buffer for actual IO.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_transaction_unittest.h ('k') | net/net_lib.scons » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_transaction_unittest.h" 5 #include "net/http/http_transaction_unittest.h"
6 6
7 #include "base/hash_tables.h" 7 #include "base/hash_tables.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 //----------------------------------------------------------------------------- 130 //-----------------------------------------------------------------------------
131 // helpers 131 // helpers
132 132
133 int ReadTransaction(net::HttpTransaction* trans, std::string* result) { 133 int ReadTransaction(net::HttpTransaction* trans, std::string* result) {
134 int rv; 134 int rv;
135 135
136 TestCompletionCallback callback; 136 TestCompletionCallback callback;
137 137
138 std::string content; 138 std::string content;
139 do { 139 do {
140 char buf[256]; 140 scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(256);
141 rv = trans->Read(buf, sizeof(buf), &callback); 141 rv = trans->Read(buf, 256, &callback);
142 if (rv == net::ERR_IO_PENDING) 142 if (rv == net::ERR_IO_PENDING)
143 rv = callback.WaitForResult(); 143 rv = callback.WaitForResult();
144 if (rv > 0) { 144 if (rv > 0) {
145 content.append(buf, rv); 145 content.append(buf->data(), rv);
146 } else if (rv < 0) { 146 } else if (rv < 0) {
147 return rv; 147 return rv;
148 } 148 }
149 } while (rv > 0); 149 } while (rv > 0);
150 150
151 result->swap(content); 151 result->swap(content);
152 return net::OK; 152 return net::OK;
153 } 153 }
OLDNEW
« no previous file with comments | « net/http/http_transaction_unittest.h ('k') | net/net_lib.scons » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698