| OLD | NEW |
| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 | 144 |
| 145 // static | 145 // static |
| 146 int TestTransactionConsumer::quit_counter_ = 0; | 146 int TestTransactionConsumer::quit_counter_ = 0; |
| 147 | 147 |
| 148 TestTransactionConsumer::TestTransactionConsumer( | 148 TestTransactionConsumer::TestTransactionConsumer( |
| 149 net::HttpTransactionFactory* factory) | 149 net::HttpTransactionFactory* factory) |
| 150 : state_(IDLE), | 150 : state_(IDLE), |
| 151 trans_(NULL), | 151 trans_(NULL), |
| 152 error_(net::OK) { | 152 error_(net::OK) { |
| 153 // Disregard the error code. | 153 // Disregard the error code. |
| 154 factory->CreateTransaction(&trans_); | 154 factory->CreateTransaction(&trans_, NULL); |
| 155 ++quit_counter_; | 155 ++quit_counter_; |
| 156 } | 156 } |
| 157 | 157 |
| 158 TestTransactionConsumer::~TestTransactionConsumer() { | 158 TestTransactionConsumer::~TestTransactionConsumer() { |
| 159 } | 159 } |
| 160 | 160 |
| 161 void TestTransactionConsumer::Start(const net::HttpRequestInfo* request, | 161 void TestTransactionConsumer::Start(const net::HttpRequestInfo* request, |
| 162 const net::BoundNetLog& net_log) { | 162 const net::BoundNetLog& net_log) { |
| 163 state_ = STARTING; | 163 state_ = STARTING; |
| 164 int result = trans_->Start( | 164 int result = trans_->Start( |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 334 MockNetworkLayer::MockNetworkLayer() | 334 MockNetworkLayer::MockNetworkLayer() |
| 335 : transaction_count_(0), done_reading_called_(false) {} | 335 : transaction_count_(0), done_reading_called_(false) {} |
| 336 | 336 |
| 337 MockNetworkLayer::~MockNetworkLayer() {} | 337 MockNetworkLayer::~MockNetworkLayer() {} |
| 338 | 338 |
| 339 void MockNetworkLayer::TransactionDoneReading() { | 339 void MockNetworkLayer::TransactionDoneReading() { |
| 340 done_reading_called_ = true; | 340 done_reading_called_ = true; |
| 341 } | 341 } |
| 342 | 342 |
| 343 int MockNetworkLayer::CreateTransaction( | 343 int MockNetworkLayer::CreateTransaction( |
| 344 scoped_ptr<net::HttpTransaction>* trans) { | 344 scoped_ptr<net::HttpTransaction>* trans, |
| 345 net::HttpTransactionDelegate* delegate) { |
| 345 transaction_count_++; | 346 transaction_count_++; |
| 346 trans->reset(new MockNetworkTransaction(this)); | 347 trans->reset(new MockNetworkTransaction(this)); |
| 347 return net::OK; | 348 return net::OK; |
| 348 } | 349 } |
| 349 | 350 |
| 350 net::HttpCache* MockNetworkLayer::GetCache() { | 351 net::HttpCache* MockNetworkLayer::GetCache() { |
| 351 return NULL; | 352 return NULL; |
| 352 } | 353 } |
| 353 | 354 |
| 354 net::HttpNetworkSession* MockNetworkLayer::GetSession() { | 355 net::HttpNetworkSession* MockNetworkLayer::GetSession() { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 372 | 373 |
| 373 if (rv > 0) | 374 if (rv > 0) |
| 374 content.append(buf->data(), rv); | 375 content.append(buf->data(), rv); |
| 375 else if (rv < 0) | 376 else if (rv < 0) |
| 376 return rv; | 377 return rv; |
| 377 } while (rv > 0); | 378 } while (rv > 0); |
| 378 | 379 |
| 379 result->swap(content); | 380 result->swap(content); |
| 380 return net::OK; | 381 return net::OK; |
| 381 } | 382 } |
| OLD | NEW |