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

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

Issue 11275088: Remove implicit scoped_refptr operator T* Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « net/http/http_stream_parser_unittest.cc ('k') | net/http/mock_http_cache.cc » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 void TestTransactionConsumer::DidFinish(int result) { 188 void TestTransactionConsumer::DidFinish(int result) {
189 state_ = DONE; 189 state_ = DONE;
190 error_ = result; 190 error_ = result;
191 if (--quit_counter_ == 0) 191 if (--quit_counter_ == 0)
192 MessageLoop::current()->Quit(); 192 MessageLoop::current()->Quit();
193 } 193 }
194 194
195 void TestTransactionConsumer::Read() { 195 void TestTransactionConsumer::Read() {
196 state_ = READING; 196 state_ = READING;
197 read_buf_ = new net::IOBuffer(1024); 197 read_buf_ = new net::IOBuffer(1024);
198 int result = trans_->Read(read_buf_, 1024, 198 int result = trans_->Read(read_buf_.get(), 1024,
199 base::Bind(&TestTransactionConsumer::OnIOComplete, 199 base::Bind(&TestTransactionConsumer::OnIOComplete,
200 base::Unretained(this))); 200 base::Unretained(this)));
201 if (result != net::ERR_IO_PENDING) 201 if (result != net::ERR_IO_PENDING)
202 DidRead(result); 202 DidRead(result);
203 } 203 }
204 204
205 void TestTransactionConsumer::OnIOComplete(int result) { 205 void TestTransactionConsumer::OnIOComplete(int result) {
206 switch (state_) { 206 switch (state_) {
207 case STARTING: 207 case STARTING:
208 DidStart(result); 208 DidStart(result);
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 // helpers 360 // helpers
361 361
362 int ReadTransaction(net::HttpTransaction* trans, std::string* result) { 362 int ReadTransaction(net::HttpTransaction* trans, std::string* result) {
363 int rv; 363 int rv;
364 364
365 net::TestCompletionCallback callback; 365 net::TestCompletionCallback callback;
366 366
367 std::string content; 367 std::string content;
368 do { 368 do {
369 scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256)); 369 scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256));
370 rv = trans->Read(buf, 256, callback.callback()); 370 rv = trans->Read(buf.get(), 256, callback.callback());
371 if (rv == net::ERR_IO_PENDING) 371 if (rv == net::ERR_IO_PENDING)
372 rv = callback.WaitForResult(); 372 rv = callback.WaitForResult();
373 373
374 if (rv > 0) 374 if (rv > 0)
375 content.append(buf->data(), rv); 375 content.append(buf->data(), rv);
376 else if (rv < 0) 376 else if (rv < 0)
377 return rv; 377 return rv;
378 } while (rv > 0); 378 } while (rv > 0);
379 379
380 result->swap(content); 380 result->swap(content);
381 return net::OK; 381 return net::OK;
382 } 382 }
OLDNEW
« no previous file with comments | « net/http/http_stream_parser_unittest.cc ('k') | net/http/mock_http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698