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

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

Issue 122453002: Allows deferral of a URLRequest just before talking to the network, at (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated content-length in test to actual length Created 6 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
« no previous file with comments | « net/http/http_transaction_unittest.h ('k') | net/url_request/url_request.h » ('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/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 if (net_log.net_log()) 405 if (net_log.net_log())
406 socket_log_id_ = net_log.net_log()->NextID(); 406 socket_log_id_ = net_log.net_log()->NextID();
407 407
408 if (test_mode_ & TEST_MODE_SYNC_NET_START) 408 if (test_mode_ & TEST_MODE_SYNC_NET_START)
409 return net::OK; 409 return net::OK;
410 410
411 CallbackLater(callback, net::OK); 411 CallbackLater(callback, net::OK);
412 return net::ERR_IO_PENDING; 412 return net::ERR_IO_PENDING;
413 } 413 }
414 414
415 void MockNetworkTransaction::SetBeforeNetworkStartCallback(
416 const BeforeNetworkStartCallback& callback) {
417 }
418
419 int MockNetworkTransaction::ResumeNetworkStart() {
420 // Should not get here.
421 return net::ERR_FAILED;
422 }
423
415 void MockNetworkTransaction::CallbackLater( 424 void MockNetworkTransaction::CallbackLater(
416 const net::CompletionCallback& callback, int result) { 425 const net::CompletionCallback& callback, int result) {
417 base::MessageLoop::current()->PostTask( 426 base::MessageLoop::current()->PostTask(
418 FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback, 427 FROM_HERE, base::Bind(&MockNetworkTransaction::RunCallback,
419 weak_factory_.GetWeakPtr(), callback, result)); 428 weak_factory_.GetWeakPtr(), callback, result));
420 } 429 }
421 430
422 void MockNetworkTransaction::RunCallback( 431 void MockNetworkTransaction::RunCallback(
423 const net::CompletionCallback& callback, int result) { 432 const net::CompletionCallback& callback, int result) {
424 callback.Run(result); 433 callback.Run(result);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 481
473 if (rv > 0) 482 if (rv > 0)
474 content.append(buf->data(), rv); 483 content.append(buf->data(), rv);
475 else if (rv < 0) 484 else if (rv < 0)
476 return rv; 485 return rv;
477 } while (rv > 0); 486 } while (rv > 0);
478 487
479 result->swap(content); 488 result->swap(content);
480 return net::OK; 489 return net::OK;
481 } 490 }
OLDNEW
« no previous file with comments | « net/http/http_transaction_unittest.h ('k') | net/url_request/url_request.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698