| OLD | NEW |
| 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/url_request/url_request_http_job.h" | 5 #include "net/url_request/url_request_http_job.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 DCHECK(!context_.sdch_manager()); | 183 DCHECK(!context_.sdch_manager()); |
| 184 | 184 |
| 185 std::unique_ptr<URLRequest> request = context_.CreateRequest( | 185 std::unique_ptr<URLRequest> request = context_.CreateRequest( |
| 186 GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate_); | 186 GURL("http://www.example.com"), DEFAULT_PRIORITY, &delegate_); |
| 187 std::unique_ptr<TestURLRequestHttpJob> job( | 187 std::unique_ptr<TestURLRequestHttpJob> job( |
| 188 new TestURLRequestHttpJob(request.get())); | 188 new TestURLRequestHttpJob(request.get())); |
| 189 test_job_interceptor_->set_main_intercept_job(std::move(job)); | 189 test_job_interceptor_->set_main_intercept_job(std::move(job)); |
| 190 request->Start(); | 190 request->Start(); |
| 191 | 191 |
| 192 base::RunLoop().Run(); | 192 base::RunLoop().Run(); |
| 193 // Pass through the raw response the same way as if received unknown encoding. | 193 EXPECT_EQ(ERR_CONTENT_DECODING_FAILED, delegate_.request_status()); |
| 194 EXPECT_EQ(OK, delegate_.request_status()); | |
| 195 EXPECT_EQ("Test Content", delegate_.data_received()); | |
| 196 } | 194 } |
| 197 | 195 |
| 198 class URLRequestHttpJobTest : public ::testing::Test { | 196 class URLRequestHttpJobTest : public ::testing::Test { |
| 199 protected: | 197 protected: |
| 200 URLRequestHttpJobTest() : context_(true) { | 198 URLRequestHttpJobTest() : context_(true) { |
| 201 context_.set_http_transaction_factory(&network_layer_); | 199 context_.set_http_transaction_factory(&network_layer_); |
| 202 | 200 |
| 203 // The |test_job_factory_| takes ownership of the interceptor. | 201 // The |test_job_factory_| takes ownership of the interceptor. |
| 204 test_job_interceptor_ = new TestJobInterceptor(); | 202 test_job_interceptor_ = new TestJobInterceptor(); |
| 205 EXPECT_TRUE(test_job_factory_.SetProtocolHandler( | 203 EXPECT_TRUE(test_job_factory_.SetProtocolHandler( |
| (...skipping 984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 base::RunLoop().RunUntilIdle(); | 1188 base::RunLoop().RunUntilIdle(); |
| 1191 EXPECT_THAT(delegate_.request_status(), IsError(ERR_IO_PENDING)); | 1189 EXPECT_THAT(delegate_.request_status(), IsError(ERR_IO_PENDING)); |
| 1192 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called()); | 1190 EXPECT_TRUE(fake_handshake_stream->initialize_stream_was_called()); |
| 1193 } | 1191 } |
| 1194 | 1192 |
| 1195 #endif // BUILDFLAG(ENABLE_WEBSOCKETS) | 1193 #endif // BUILDFLAG(ENABLE_WEBSOCKETS) |
| 1196 | 1194 |
| 1197 } // namespace | 1195 } // namespace |
| 1198 | 1196 |
| 1199 } // namespace net | 1197 } // namespace net |
| OLD | NEW |