| 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 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 std::vector<std::unique_ptr<IPC::Message>> messages_; | 135 std::vector<std::unique_ptr<IPC::Message>> messages_; |
| 136 }; | 136 }; |
| 137 | 137 |
| 138 class AsyncResourceHandlerTest : public ::testing::Test, | 138 class AsyncResourceHandlerTest : public ::testing::Test, |
| 139 public ResourceLoaderDelegate { | 139 public ResourceLoaderDelegate { |
| 140 protected: | 140 protected: |
| 141 AsyncResourceHandlerTest() | 141 AsyncResourceHandlerTest() |
| 142 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), context_(true) {} | 142 : thread_bundle_(TestBrowserThreadBundle::IO_MAINLOOP), context_(true) {} |
| 143 | 143 |
| 144 void TearDown() override { | 144 void TearDown() override { |
| 145 if (filter_) |
| 146 filter_->OnChannelClosing(); |
| 145 // Prevent memory leaks. | 147 // Prevent memory leaks. |
| 146 filter_ = nullptr; | 148 filter_ = nullptr; |
| 147 rdh_.Shutdown(); | 149 rdh_.Shutdown(); |
| 148 base::RunLoop().RunUntilIdle(); | 150 base::RunLoop().RunUntilIdle(); |
| 149 } | 151 } |
| 150 | 152 |
| 151 void CreateRequestWithResponseDataSize(size_t response_data_size) { | 153 void CreateRequestWithResponseDataSize(size_t response_data_size) { |
| 152 test_job_factory_.SetProtocolHandler( | 154 test_job_factory_.SetProtocolHandler( |
| 153 "test", base::MakeUnique<TestProtocolHandler>(response_data_size)); | 155 "test", base::MakeUnique<TestProtocolHandler>(response_data_size)); |
| 154 context_.set_job_factory(&test_job_factory_); | 156 context_.set_job_factory(&test_job_factory_); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 | 303 |
| 302 encoded_data_length = std::get<3>(params); | 304 encoded_data_length = std::get<3>(params); |
| 303 EXPECT_EQ(32768, encoded_data_length); | 305 EXPECT_EQ(32768, encoded_data_length); |
| 304 encoded_body_length = std::get<4>(params); | 306 encoded_body_length = std::get<4>(params); |
| 305 EXPECT_EQ(32768, encoded_body_length); | 307 EXPECT_EQ(32768, encoded_body_length); |
| 306 } | 308 } |
| 307 | 309 |
| 308 } // namespace | 310 } // namespace |
| 309 | 311 |
| 310 } // namespace content | 312 } // namespace content |
| OLD | NEW |