| 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 "android_webview/browser/net/android_stream_reader_url_request_job.h" | 5 #include "android_webview/browser/net/android_stream_reader_url_request_job.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "android_webview/browser/input_stream.h" | 9 #include "android_webview/browser/input_stream.h" |
| 10 #include "android_webview/browser/net/aw_url_request_job_factory.h" | 10 #include "android_webview/browser/net/aw_url_request_job_factory.h" |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 // The TestDelegate will quit the message loop on request completion. | 267 // The TestDelegate will quit the message loop on request completion. |
| 268 base::MessageLoop::current()->Run(); | 268 base::MessageLoop::current()->Run(); |
| 269 | 269 |
| 270 // The request_failed() method is named confusingly but all it checks is | 270 // The request_failed() method is named confusingly but all it checks is |
| 271 // whether the request got as far as calling NotifyHeadersComplete. | 271 // whether the request got as far as calling NotifyHeadersComplete. |
| 272 EXPECT_FALSE(url_request_delegate_.request_failed()); | 272 EXPECT_FALSE(url_request_delegate_.request_failed()); |
| 273 EXPECT_EQ(1, network_delegate_.completed_requests()); | 273 EXPECT_EQ(1, network_delegate_.completed_requests()); |
| 274 // A null input stream shouldn't result in an error. See crbug.com/180950. | 274 // A null input stream shouldn't result in an error. See crbug.com/180950. |
| 275 EXPECT_EQ(0, network_delegate_.error_count()); | 275 EXPECT_EQ(0, network_delegate_.error_count()); |
| 276 EXPECT_EQ(404, req_->GetResponseCode()); | 276 EXPECT_EQ(404, req_->GetResponseCode()); |
| 277 DCHECK(false); |
| 277 } | 278 } |
| 278 | 279 |
| 279 TEST_F(AndroidStreamReaderURLRequestJobTest, ModifyHeadersAndStatus) { | 280 TEST_F(AndroidStreamReaderURLRequestJobTest, ModifyHeadersAndStatus) { |
| 280 SetUpTestJob(nullptr, | 281 SetUpTestJob(nullptr, |
| 281 make_scoped_ptr(new HeaderAlteringStreamReaderDelegate())); | 282 make_scoped_ptr(new HeaderAlteringStreamReaderDelegate())); |
| 282 req_->Start(); | 283 req_->Start(); |
| 283 | 284 |
| 284 // The TestDelegate will quit the message loop on request completion. | 285 // The TestDelegate will quit the message loop on request completion. |
| 285 base::MessageLoop::current()->Run(); | 286 base::MessageLoop::current()->Run(); |
| 286 | 287 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 409 req_->Start(); | 410 req_->Start(); |
| 410 | 411 |
| 411 loop.Run(); | 412 loop.Run(); |
| 412 | 413 |
| 413 EXPECT_EQ(0, network_delegate_.completed_requests()); | 414 EXPECT_EQ(0, network_delegate_.completed_requests()); |
| 414 req_->Cancel(); | 415 req_->Cancel(); |
| 415 EXPECT_EQ(1, network_delegate_.completed_requests()); | 416 EXPECT_EQ(1, network_delegate_.completed_requests()); |
| 416 } | 417 } |
| 417 | 418 |
| 418 } // namespace android_webview | 419 } // namespace android_webview |
| OLD | NEW |