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

Side by Side Diff: content/child/web_url_loader_impl_unittest.cc

Issue 630743005: Replace OVERRIDE and FINAL with override and final in content/child/[a-s]* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 | « content/child/web_url_loader_impl.cc ('k') | content/child/webcrypto/nss/aes_cbc_nss.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/web_url_loader_impl.h" 5 #include "content/child/web_url_loader_impl.h"
6 6
7 #include <string.h> 7 #include <string.h>
8 8
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/weak_ptr.h" 10 #include "base/memory/weak_ptr.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 "Content-type: text/html\n\n" 54 "Content-type: text/html\n\n"
55 "ah!"; 55 "ah!";
56 56
57 class TestBridge : public ResourceLoaderBridge, 57 class TestBridge : public ResourceLoaderBridge,
58 public base::SupportsWeakPtr<TestBridge> { 58 public base::SupportsWeakPtr<TestBridge> {
59 public: 59 public:
60 TestBridge() : peer_(NULL), canceled_(false) {} 60 TestBridge() : peer_(NULL), canceled_(false) {}
61 virtual ~TestBridge() {} 61 virtual ~TestBridge() {}
62 62
63 // ResourceLoaderBridge implementation: 63 // ResourceLoaderBridge implementation:
64 virtual void SetRequestBody(ResourceRequestBody* request_body) OVERRIDE {} 64 virtual void SetRequestBody(ResourceRequestBody* request_body) override {}
65 65
66 virtual bool Start(RequestPeer* peer) OVERRIDE { 66 virtual bool Start(RequestPeer* peer) override {
67 EXPECT_FALSE(peer_); 67 EXPECT_FALSE(peer_);
68 peer_ = peer; 68 peer_ = peer;
69 return true; 69 return true;
70 } 70 }
71 71
72 virtual void Cancel() OVERRIDE { 72 virtual void Cancel() override {
73 EXPECT_FALSE(canceled_); 73 EXPECT_FALSE(canceled_);
74 canceled_ = true; 74 canceled_ = true;
75 } 75 }
76 76
77 virtual void SetDefersLoading(bool value) OVERRIDE {} 77 virtual void SetDefersLoading(bool value) override {}
78 78
79 virtual void DidChangePriority(net::RequestPriority new_priority, 79 virtual void DidChangePriority(net::RequestPriority new_priority,
80 int intra_priority_value) OVERRIDE {} 80 int intra_priority_value) override {}
81 81
82 virtual bool AttachThreadedDataReceiver( 82 virtual bool AttachThreadedDataReceiver(
83 blink::WebThreadedDataReceiver* threaded_data_receiver) OVERRIDE { 83 blink::WebThreadedDataReceiver* threaded_data_receiver) override {
84 NOTREACHED(); 84 NOTREACHED();
85 return false; 85 return false;
86 } 86 }
87 87
88 virtual void SyncLoad(SyncLoadResponse* response) OVERRIDE {} 88 virtual void SyncLoad(SyncLoadResponse* response) override {}
89 89
90 RequestPeer* peer() { return peer_; } 90 RequestPeer* peer() { return peer_; }
91 91
92 bool canceled() { return canceled_; } 92 bool canceled() { return canceled_; }
93 93
94 private: 94 private:
95 RequestPeer* peer_; 95 RequestPeer* peer_;
96 bool canceled_; 96 bool canceled_;
97 97
98 DISALLOW_COPY_AND_ASSIGN(TestBridge); 98 DISALLOW_COPY_AND_ASSIGN(TestBridge);
99 }; 99 };
100 100
101 class TestResourceDispatcher : public ResourceDispatcher { 101 class TestResourceDispatcher : public ResourceDispatcher {
102 public: 102 public:
103 TestResourceDispatcher() : ResourceDispatcher(NULL) {} 103 TestResourceDispatcher() : ResourceDispatcher(NULL) {}
104 virtual ~TestResourceDispatcher() {} 104 virtual ~TestResourceDispatcher() {}
105 105
106 // ResourceDispatcher implementation: 106 // ResourceDispatcher implementation:
107 virtual ResourceLoaderBridge* CreateBridge( 107 virtual ResourceLoaderBridge* CreateBridge(
108 const RequestInfo& request_info) OVERRIDE { 108 const RequestInfo& request_info) override {
109 EXPECT_FALSE(bridge_.get()); 109 EXPECT_FALSE(bridge_.get());
110 TestBridge* bridge = new TestBridge(); 110 TestBridge* bridge = new TestBridge();
111 bridge_ = bridge->AsWeakPtr(); 111 bridge_ = bridge->AsWeakPtr();
112 return bridge; 112 return bridge;
113 } 113 }
114 114
115 TestBridge* bridge() { return bridge_.get(); } 115 TestBridge* bridge() { return bridge_.get(); }
116 116
117 private: 117 private:
118 base::WeakPtr<TestBridge> bridge_; 118 base::WeakPtr<TestBridge> bridge_;
(...skipping 15 matching lines...) Expand all
134 did_receive_response_(false), 134 did_receive_response_(false),
135 did_finish_(false) { 135 did_finish_(false) {
136 } 136 }
137 137
138 virtual ~TestWebURLLoaderClient() {} 138 virtual ~TestWebURLLoaderClient() {}
139 139
140 // blink::WebURLLoaderClient implementation: 140 // blink::WebURLLoaderClient implementation:
141 virtual void willSendRequest( 141 virtual void willSendRequest(
142 blink::WebURLLoader* loader, 142 blink::WebURLLoader* loader,
143 blink::WebURLRequest& newRequest, 143 blink::WebURLRequest& newRequest,
144 const blink::WebURLResponse& redirectResponse) OVERRIDE { 144 const blink::WebURLResponse& redirectResponse) override {
145 EXPECT_TRUE(loader_); 145 EXPECT_TRUE(loader_);
146 EXPECT_EQ(loader_.get(), loader); 146 EXPECT_EQ(loader_.get(), loader);
147 // No test currently simulates mutiple redirects. 147 // No test currently simulates mutiple redirects.
148 EXPECT_FALSE(did_receive_redirect_); 148 EXPECT_FALSE(did_receive_redirect_);
149 did_receive_redirect_ = true; 149 did_receive_redirect_ = true;
150 150
151 if (delete_on_receive_redirect_) 151 if (delete_on_receive_redirect_)
152 loader_.reset(); 152 loader_.reset();
153 } 153 }
154 154
155 virtual void didSendData(blink::WebURLLoader* loader, 155 virtual void didSendData(blink::WebURLLoader* loader,
156 unsigned long long bytesSent, 156 unsigned long long bytesSent,
157 unsigned long long totalBytesToBeSent) OVERRIDE { 157 unsigned long long totalBytesToBeSent) override {
158 EXPECT_TRUE(loader_); 158 EXPECT_TRUE(loader_);
159 EXPECT_EQ(loader_.get(), loader); 159 EXPECT_EQ(loader_.get(), loader);
160 } 160 }
161 161
162 virtual void didReceiveResponse( 162 virtual void didReceiveResponse(
163 blink::WebURLLoader* loader, 163 blink::WebURLLoader* loader,
164 const blink::WebURLResponse& response) OVERRIDE { 164 const blink::WebURLResponse& response) override {
165 EXPECT_TRUE(loader_); 165 EXPECT_TRUE(loader_);
166 EXPECT_EQ(loader_.get(), loader); 166 EXPECT_EQ(loader_.get(), loader);
167 167
168 // Only multipart requests may receive multiple response headers. 168 // Only multipart requests may receive multiple response headers.
169 EXPECT_TRUE(expect_multipart_response_ || !did_receive_response_); 169 EXPECT_TRUE(expect_multipart_response_ || !did_receive_response_);
170 170
171 did_receive_response_ = true; 171 did_receive_response_ = true;
172 if (delete_on_receive_response_) 172 if (delete_on_receive_response_)
173 loader_.reset(); 173 loader_.reset();
174 } 174 }
175 175
176 virtual void didDownloadData(blink::WebURLLoader* loader, 176 virtual void didDownloadData(blink::WebURLLoader* loader,
177 int dataLength, 177 int dataLength,
178 int encodedDataLength) OVERRIDE { 178 int encodedDataLength) override {
179 EXPECT_TRUE(loader_); 179 EXPECT_TRUE(loader_);
180 EXPECT_EQ(loader_.get(), loader); 180 EXPECT_EQ(loader_.get(), loader);
181 } 181 }
182 182
183 virtual void didReceiveData(blink::WebURLLoader* loader, 183 virtual void didReceiveData(blink::WebURLLoader* loader,
184 const char* data, 184 const char* data,
185 int dataLength, 185 int dataLength,
186 int encodedDataLength) OVERRIDE { 186 int encodedDataLength) override {
187 EXPECT_TRUE(loader_); 187 EXPECT_TRUE(loader_);
188 EXPECT_EQ(loader_.get(), loader); 188 EXPECT_EQ(loader_.get(), loader);
189 // The response should have started, but must not have finished, or failed. 189 // The response should have started, but must not have finished, or failed.
190 EXPECT_TRUE(did_receive_response_); 190 EXPECT_TRUE(did_receive_response_);
191 EXPECT_FALSE(did_finish_); 191 EXPECT_FALSE(did_finish_);
192 EXPECT_EQ(net::OK, error_.reason); 192 EXPECT_EQ(net::OK, error_.reason);
193 EXPECT_EQ("", error_.domain.utf8()); 193 EXPECT_EQ("", error_.domain.utf8());
194 194
195 received_data_.append(data, dataLength); 195 received_data_.append(data, dataLength);
196 196
197 if (delete_on_receive_data_) 197 if (delete_on_receive_data_)
198 loader_.reset(); 198 loader_.reset();
199 } 199 }
200 200
201 virtual void didReceiveCachedMetadata(blink::WebURLLoader* loader, 201 virtual void didReceiveCachedMetadata(blink::WebURLLoader* loader,
202 const char* data, 202 const char* data,
203 int dataLength) OVERRIDE { 203 int dataLength) override {
204 EXPECT_EQ(loader_.get(), loader); 204 EXPECT_EQ(loader_.get(), loader);
205 } 205 }
206 206
207 virtual void didFinishLoading(blink::WebURLLoader* loader, 207 virtual void didFinishLoading(blink::WebURLLoader* loader,
208 double finishTime, 208 double finishTime,
209 int64_t totalEncodedDataLength) OVERRIDE { 209 int64_t totalEncodedDataLength) override {
210 EXPECT_TRUE(loader_); 210 EXPECT_TRUE(loader_);
211 EXPECT_EQ(loader_.get(), loader); 211 EXPECT_EQ(loader_.get(), loader);
212 EXPECT_TRUE(did_receive_response_); 212 EXPECT_TRUE(did_receive_response_);
213 EXPECT_FALSE(did_finish_); 213 EXPECT_FALSE(did_finish_);
214 did_finish_ = true; 214 did_finish_ = true;
215 215
216 if (delete_on_finish_) 216 if (delete_on_finish_)
217 loader_.reset(); 217 loader_.reset();
218 } 218 }
219 219
220 virtual void didFail(blink::WebURLLoader* loader, 220 virtual void didFail(blink::WebURLLoader* loader,
221 const blink::WebURLError& error) OVERRIDE { 221 const blink::WebURLError& error) override {
222 EXPECT_TRUE(loader_); 222 EXPECT_TRUE(loader_);
223 EXPECT_EQ(loader_.get(), loader); 223 EXPECT_EQ(loader_.get(), loader);
224 EXPECT_FALSE(did_finish_); 224 EXPECT_FALSE(did_finish_);
225 error_ = error; 225 error_ = error;
226 226
227 if (delete_on_fail_) 227 if (delete_on_fail_)
228 loader_.reset(); 228 loader_.reset();
229 } 229 }
230 230
231 WebURLLoaderImpl* loader() { return loader_.get(); } 231 WebURLLoaderImpl* loader() { return loader_.get(); }
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
641 client()->set_delete_on_fail(); 641 client()->set_delete_on_fail();
642 DoStartAsyncRequest(); 642 DoStartAsyncRequest();
643 DoReceiveResponseMultipart(); 643 DoReceiveResponseMultipart();
644 DoReceiveDataMultipart(); 644 DoReceiveDataMultipart();
645 DoFailRequest(); 645 DoFailRequest();
646 EXPECT_FALSE(bridge()); 646 EXPECT_FALSE(bridge());
647 } 647 }
648 648
649 } // namespace 649 } // namespace
650 } // namespace content 650 } // namespace content
OLDNEW
« no previous file with comments | « content/child/web_url_loader_impl.cc ('k') | content/child/webcrypto/nss/aes_cbc_nss.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698