| 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/mojo_async_resource_handler.h" | 5 #include "content/browser/loader/mojo_async_resource_handler.h" |
| 6 | 6 |
| 7 #include <string.h> | 7 #include <string.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 EXPECT_EQ(1, rdh_.num_in_flight_requests_for_testing()); | 531 EXPECT_EQ(1, rdh_.num_in_flight_requests_for_testing()); |
| 532 handler_ = nullptr; | 532 handler_ = nullptr; |
| 533 EXPECT_EQ(0, rdh_.num_in_flight_requests_for_testing()); | 533 EXPECT_EQ(0, rdh_.num_in_flight_requests_for_testing()); |
| 534 } | 534 } |
| 535 | 535 |
| 536 TEST_F(MojoAsyncResourceHandlerTest, OnWillReadWithInsufficientResource) { | 536 TEST_F(MojoAsyncResourceHandlerTest, OnWillReadWithInsufficientResource) { |
| 537 rdh_.set_max_num_in_flight_requests_per_process(0); | 537 rdh_.set_max_num_in_flight_requests_per_process(0); |
| 538 ASSERT_TRUE(CallOnWillStartAndOnResponseStarted()); | 538 ASSERT_TRUE(CallOnWillStartAndOnResponseStarted()); |
| 539 | 539 |
| 540 ASSERT_EQ(MockResourceLoader::Status::CANCELED, mock_loader_->OnWillRead(-1)); | 540 ASSERT_EQ(MockResourceLoader::Status::CANCELED, mock_loader_->OnWillRead(-1)); |
| 541 EXPECT_EQ(net::ERR_INSUFFICIENT_RESOURCES, mock_loader_->error_code()); | 541 // TODO(mmenke): Make this fail with net::ERR_INSUFFICIENT_RESOURCES. |
| 542 EXPECT_EQ(net::ERR_ABORTED, mock_loader_->error_code()); |
| 542 EXPECT_EQ(1, rdh_.num_in_flight_requests_for_testing()); | 543 EXPECT_EQ(1, rdh_.num_in_flight_requests_for_testing()); |
| 543 handler_ = nullptr; | 544 handler_ = nullptr; |
| 544 EXPECT_EQ(0, rdh_.num_in_flight_requests_for_testing()); | 545 EXPECT_EQ(0, rdh_.num_in_flight_requests_for_testing()); |
| 545 } | 546 } |
| 546 | 547 |
| 547 TEST_F(MojoAsyncResourceHandlerTest, OnWillReadAndOnReadCompleted) { | 548 TEST_F(MojoAsyncResourceHandlerTest, OnWillReadAndOnReadCompleted) { |
| 548 ASSERT_TRUE(CallOnWillStartAndOnResponseStarted()); | 549 ASSERT_TRUE(CallOnWillStartAndOnResponseStarted()); |
| 549 ASSERT_EQ(MockResourceLoader::Status::IDLE, mock_loader_->OnWillRead(-1)); | 550 ASSERT_EQ(MockResourceLoader::Status::IDLE, mock_loader_->OnWillRead(-1)); |
| 550 // The buffer size that the mime sniffer requires implicitly. | 551 // The buffer size that the mime sniffer requires implicitly. |
| 551 ASSERT_GE(mock_loader_->io_buffer_size(), | 552 ASSERT_GE(mock_loader_->io_buffer_size(), |
| (...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1262 } | 1263 } |
| 1263 } | 1264 } |
| 1264 EXPECT_EQ("B", body); | 1265 EXPECT_EQ("B", body); |
| 1265 } | 1266 } |
| 1266 | 1267 |
| 1267 INSTANTIATE_TEST_CASE_P(MojoAsyncResourceHandlerWithAllocationSizeTest, | 1268 INSTANTIATE_TEST_CASE_P(MojoAsyncResourceHandlerWithAllocationSizeTest, |
| 1268 MojoAsyncResourceHandlerWithAllocationSizeTest, | 1269 MojoAsyncResourceHandlerWithAllocationSizeTest, |
| 1269 ::testing::Values(8, 32 * 2014)); | 1270 ::testing::Values(8, 32 * 2014)); |
| 1270 } // namespace | 1271 } // namespace |
| 1271 } // namespace content | 1272 } // namespace content |
| OLD | NEW |