| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/browser/loader/async_resource_handler.h" | 5 #include "content/browser/loader/async_resource_handler.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 }; | 166 }; |
| 167 | 167 |
| 168 class AsyncResourceHandlerTest : public ::testing::Test, | 168 class AsyncResourceHandlerTest : public ::testing::Test, |
| 169 public ResourceLoaderDelegate { | 169 public ResourceLoaderDelegate { |
| 170 protected: | 170 protected: |
| 171 AsyncResourceHandlerTest() | 171 AsyncResourceHandlerTest() |
| 172 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), context_(true) {} | 172 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), context_(true) {} |
| 173 | 173 |
| 174 void TearDown() override { | 174 void TearDown() override { |
| 175 // Prevent memory leaks. | 175 // Prevent memory leaks. |
| 176 filter_ = nullptr; |
| 176 rdh_.Shutdown(); | 177 rdh_.Shutdown(); |
| 177 base::RunLoop().RunUntilIdle(); | 178 base::RunLoop().RunUntilIdle(); |
| 178 } | 179 } |
| 179 | 180 |
| 180 void CreateRequestWithResponseDataSize(size_t response_data_size) { | 181 void CreateRequestWithResponseDataSize(size_t response_data_size) { |
| 181 test_job_factory_.SetProtocolHandler( | 182 test_job_factory_.SetProtocolHandler( |
| 182 "test", base::MakeUnique<TestJobProtocolHandler>(response_data_size)); | 183 "test", base::MakeUnique<TestJobProtocolHandler>(response_data_size)); |
| 183 context_.set_job_factory(&test_job_factory_); | 184 context_.set_job_factory(&test_job_factory_); |
| 184 context_.Init(); | 185 context_.Init(); |
| 185 std::unique_ptr<net::URLRequest> request = context_.CreateRequest( | 186 std::unique_ptr<net::URLRequest> request = context_.CreateRequest( |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 330 |
| 330 encoded_data_length = std::get<3>(params); | 331 encoded_data_length = std::get<3>(params); |
| 331 EXPECT_EQ(32768, encoded_data_length); | 332 EXPECT_EQ(32768, encoded_data_length); |
| 332 encoded_body_length = std::get<4>(params); | 333 encoded_body_length = std::get<4>(params); |
| 333 EXPECT_EQ(32768, encoded_body_length); | 334 EXPECT_EQ(32768, encoded_body_length); |
| 334 } | 335 } |
| 335 | 336 |
| 336 } // namespace | 337 } // namespace |
| 337 | 338 |
| 338 } // namespace content | 339 } // namespace content |
| OLD | NEW |