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

Side by Side Diff: net/proxy/proxy_resolver_v8_tracing_unittest.cc

Issue 2351513002: net: rename BoundNetLog to NetLogWithSource (Closed)
Patch Set: one more fix, content bound_net_log_ Created 4 years, 3 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/proxy/proxy_resolver_v8_tracing.h" 5 #include "net/proxy/proxy_resolver_v8_tracing.h"
6 6
7 #include <string> 7 #include <string>
8 #include <utility> 8 #include <utility>
9 9
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 void Alert(const base::string16& message) override { 107 void Alert(const base::string16& message) override {
108 DCHECK(thread_checker_.CalledOnValidThread()); 108 DCHECK(thread_checker_.CalledOnValidThread());
109 bindings_->Alert(message); 109 bindings_->Alert(message);
110 } 110 }
111 111
112 void OnError(int line_number, const base::string16& error) override { 112 void OnError(int line_number, const base::string16& error) override {
113 DCHECK(thread_checker_.CalledOnValidThread()); 113 DCHECK(thread_checker_.CalledOnValidThread());
114 bindings_->OnError(line_number, error); 114 bindings_->OnError(line_number, error);
115 } 115 }
116 116
117 BoundNetLog GetBoundNetLog() override { 117 NetLogWithSource GetNetLogWithSource() override {
118 DCHECK(thread_checker_.CalledOnValidThread()); 118 DCHECK(thread_checker_.CalledOnValidThread());
119 return BoundNetLog(); 119 return NetLogWithSource();
120 } 120 }
121 121
122 HostResolver* GetHostResolver() override { 122 HostResolver* GetHostResolver() override {
123 DCHECK(thread_checker_.CalledOnValidThread()); 123 DCHECK(thread_checker_.CalledOnValidThread());
124 return bindings_->host_resolver(); 124 return bindings_->host_resolver();
125 } 125 }
126 126
127 private: 127 private:
128 MockBindings* bindings_; 128 MockBindings* bindings_;
129 base::ThreadChecker thread_checker_; 129 base::ThreadChecker thread_checker_;
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
679 class BlockableHostResolver : public HostResolver { 679 class BlockableHostResolver : public HostResolver {
680 public: 680 public:
681 BlockableHostResolver() 681 BlockableHostResolver()
682 : num_cancelled_requests_(0), waiting_for_resolve_(false) {} 682 : num_cancelled_requests_(0), waiting_for_resolve_(false) {}
683 683
684 int Resolve(const RequestInfo& info, 684 int Resolve(const RequestInfo& info,
685 RequestPriority priority, 685 RequestPriority priority,
686 AddressList* addresses, 686 AddressList* addresses,
687 const CompletionCallback& callback, 687 const CompletionCallback& callback,
688 std::unique_ptr<Request>* out_req, 688 std::unique_ptr<Request>* out_req,
689 const BoundNetLog& net_log) override { 689 const NetLogWithSource& net_log) override {
690 EXPECT_FALSE(callback.is_null()); 690 EXPECT_FALSE(callback.is_null());
691 EXPECT_TRUE(out_req); 691 EXPECT_TRUE(out_req);
692 692
693 if (!action_.is_null()) 693 if (!action_.is_null())
694 action_.Run(); 694 action_.Run();
695 695
696 // Indicate to the caller that a request was received. 696 // Indicate to the caller that a request was received.
697 EXPECT_TRUE(waiting_for_resolve_); 697 EXPECT_TRUE(waiting_for_resolve_);
698 base::MessageLoop::current()->QuitWhenIdle(); 698 base::MessageLoop::current()->QuitWhenIdle();
699 699
700 // This line is intentionally after action_.Run(), since one of the 700 // This line is intentionally after action_.Run(), since one of the
701 // tests does a cancellation inside of Resolve(), and it is more 701 // tests does a cancellation inside of Resolve(), and it is more
702 // interesting if *out_req hasn't been written yet at that point. 702 // interesting if *out_req hasn't been written yet at that point.
703 out_req->reset(new RequestImpl(this)); 703 out_req->reset(new RequestImpl(this));
704 704
705 // Return ERR_IO_PENDING as this request will NEVER be completed. 705 // Return ERR_IO_PENDING as this request will NEVER be completed.
706 // Expectation is for the caller to later cancel the request. 706 // Expectation is for the caller to later cancel the request.
707 return ERR_IO_PENDING; 707 return ERR_IO_PENDING;
708 } 708 }
709 709
710 int ResolveFromCache(const RequestInfo& info, 710 int ResolveFromCache(const RequestInfo& info,
711 AddressList* addresses, 711 AddressList* addresses,
712 const BoundNetLog& net_log) override { 712 const NetLogWithSource& net_log) override {
713 NOTREACHED(); 713 NOTREACHED();
714 return ERR_DNS_CACHE_MISS; 714 return ERR_DNS_CACHE_MISS;
715 } 715 }
716 716
717 void IncreaseNumOfCancelledRequests() { num_cancelled_requests_++; } 717 void IncreaseNumOfCancelledRequests() { num_cancelled_requests_++; }
718 718
719 void SetAction(const base::Callback<void(void)>& action) { 719 void SetAction(const base::Callback<void(void)>& action) {
720 action_ = action; 720 action_ = action;
721 } 721 }
722 722
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after
1035 proxy_uri.substr(0, proxy_uri.find(':') + 1)); 1035 proxy_uri.substr(0, proxy_uri.find(':') + 1));
1036 } else { 1036 } else {
1037 NOTREACHED(); 1037 NOTREACHED();
1038 } 1038 }
1039 } 1039 }
1040 } 1040 }
1041 1041
1042 } // namespace 1042 } // namespace
1043 1043
1044 } // namespace net 1044 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698