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

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

Issue 182993003: Add the ability for DevTools to wrap network transactions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added optional QUIC setup in HttpCache constructor Created 6 years, 8 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
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/mock_http_cache.h" 5 #include "net/http/mock_http_cache.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "net/base/completion_callback.h" 9 #include "net/base/completion_callback.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 int MockBackendFactory::CreateBackend(net::NetLog* net_log, 490 int MockBackendFactory::CreateBackend(net::NetLog* net_log,
491 scoped_ptr<disk_cache::Backend>* backend, 491 scoped_ptr<disk_cache::Backend>* backend,
492 const net::CompletionCallback& callback) { 492 const net::CompletionCallback& callback) {
493 backend->reset(new MockDiskCache()); 493 backend->reset(new MockDiskCache());
494 return net::OK; 494 return net::OK;
495 } 495 }
496 496
497 //----------------------------------------------------------------------------- 497 //-----------------------------------------------------------------------------
498 498
499 MockHttpCache::MockHttpCache() 499 MockHttpCache::MockHttpCache()
500 : http_cache_(new MockNetworkLayer(), NULL, new MockBackendFactory()) { 500 : http_cache_(new MockNetworkLayer(), NULL, new MockBackendFactory(),
501 false) {
mmenke 2014/03/31 18:10:20 nit: This should probably line up with the first
eustas 2014/04/18 12:33:19 Done.
501 } 502 }
502 503
503 MockHttpCache::MockHttpCache(net::HttpCache::BackendFactory* disk_cache_factory) 504 MockHttpCache::MockHttpCache(net::HttpCache::BackendFactory* disk_cache_factory)
504 : http_cache_(new MockNetworkLayer(), NULL, disk_cache_factory) { 505 : http_cache_(new MockNetworkLayer(), NULL, disk_cache_factory, false) {
505 } 506 }
506 507
507 MockDiskCache* MockHttpCache::disk_cache() { 508 MockDiskCache* MockHttpCache::disk_cache() {
508 net::TestCompletionCallback cb; 509 net::TestCompletionCallback cb;
509 disk_cache::Backend* backend; 510 disk_cache::Backend* backend;
510 int rv = http_cache_.GetBackend(&backend, cb.callback()); 511 int rv = http_cache_.GetBackend(&backend, cb.callback());
511 rv = cb.GetResult(rv); 512 rv = cb.GetResult(rv);
512 return (rv == net::OK) ? static_cast<MockDiskCache*>(backend) : NULL; 513 return (rv == net::OK) ? static_cast<MockDiskCache*>(backend) : NULL;
513 } 514 }
514 515
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 void MockBlockingBackendFactory::FinishCreation() { 623 void MockBlockingBackendFactory::FinishCreation() {
623 block_ = false; 624 block_ = false;
624 if (!callback_.is_null()) { 625 if (!callback_.is_null()) {
625 if (!fail_) 626 if (!fail_)
626 backend_->reset(new MockDiskCache()); 627 backend_->reset(new MockDiskCache());
627 net::CompletionCallback cb = callback_; 628 net::CompletionCallback cb = callback_;
628 callback_.Reset(); 629 callback_.Reset();
629 cb.Run(Result()); // This object can be deleted here. 630 cb.Run(Result()); // This object can be deleted here.
630 } 631 }
631 } 632 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698