| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 2410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2421 | 2421 |
| 2422 // The processes issued the following requests: | 2422 // The processes issued the following requests: |
| 2423 // #1 issued kMaxRequestsPerProcess that passed + 1 that failed | 2423 // #1 issued kMaxRequestsPerProcess that passed + 1 that failed |
| 2424 // #2 issued 1 request that passed | 2424 // #2 issued 1 request that passed |
| 2425 // #3 issued 1 request that failed | 2425 // #3 issued 1 request that failed |
| 2426 ASSERT_EQ((kMaxRequestsPerProcess + 1) + 1 + 1, msgs.size()); | 2426 ASSERT_EQ((kMaxRequestsPerProcess + 1) + 1 + 1, msgs.size()); |
| 2427 | 2427 |
| 2428 for (size_t i = 0; i < kMaxRequestsPerProcess; ++i) | 2428 for (size_t i = 0; i < kMaxRequestsPerProcess; ++i) |
| 2429 CheckSuccessfulRequest(msgs[i], net::URLRequestTestJob::test_data_2()); | 2429 CheckSuccessfulRequest(msgs[i], net::URLRequestTestJob::test_data_2()); |
| 2430 | 2430 |
| 2431 // TODO(mmenke): These should be failing with ERR_INSUFFICIENT_RESOURCES. |
| 2432 // Update OnWillRead to use a ResourceController so it can fail with different |
| 2433 // error codes. |
| 2431 CheckFailedRequest(msgs[kMaxRequestsPerProcess + 0], | 2434 CheckFailedRequest(msgs[kMaxRequestsPerProcess + 0], |
| 2432 net::URLRequestTestJob::test_data_2(), | 2435 net::URLRequestTestJob::test_data_2(), net::ERR_ABORTED); |
| 2433 net::ERR_INSUFFICIENT_RESOURCES); | |
| 2434 CheckSuccessfulRequest(msgs[kMaxRequestsPerProcess + 1], | 2436 CheckSuccessfulRequest(msgs[kMaxRequestsPerProcess + 1], |
| 2435 net::URLRequestTestJob::test_data_2()); | 2437 net::URLRequestTestJob::test_data_2()); |
| 2436 CheckFailedRequest(msgs[kMaxRequestsPerProcess + 2], | 2438 CheckFailedRequest(msgs[kMaxRequestsPerProcess + 2], |
| 2437 net::URLRequestTestJob::test_data_2(), | 2439 net::URLRequestTestJob::test_data_2(), net::ERR_ABORTED); |
| 2438 net::ERR_INSUFFICIENT_RESOURCES); | |
| 2439 | 2440 |
| 2440 second_filter->OnChannelClosing(); | 2441 second_filter->OnChannelClosing(); |
| 2441 third_filter->OnChannelClosing(); | 2442 third_filter->OnChannelClosing(); |
| 2442 } | 2443 } |
| 2443 | 2444 |
| 2444 // Tests that we sniff the mime type for a simple request. | 2445 // Tests that we sniff the mime type for a simple request. |
| 2445 TEST_P(ResourceDispatcherHostTest, MimeSniffed) { | 2446 TEST_P(ResourceDispatcherHostTest, MimeSniffed) { |
| 2446 std::string raw_headers("HTTP/1.1 200 OK\n\n"); | 2447 std::string raw_headers("HTTP/1.1 200 OK\n\n"); |
| 2447 std::string response_data("<html><title>Test One</title></html>"); | 2448 std::string response_data("<html><title>Test One</title></html>"); |
| 2448 SetResponse(raw_headers, response_data); | 2449 SetResponse(raw_headers, response_data); |
| (...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3989 return nullptr; | 3990 return nullptr; |
| 3990 } | 3991 } |
| 3991 | 3992 |
| 3992 INSTANTIATE_TEST_CASE_P( | 3993 INSTANTIATE_TEST_CASE_P( |
| 3993 ResourceDispatcherHostTests, | 3994 ResourceDispatcherHostTests, |
| 3994 ResourceDispatcherHostTest, | 3995 ResourceDispatcherHostTest, |
| 3995 testing::Values(TestConfig::kDefault, | 3996 testing::Values(TestConfig::kDefault, |
| 3996 TestConfig::kOptimizeIPCForSmallResourceEnabled)); | 3997 TestConfig::kOptimizeIPCForSmallResourceEnabled)); |
| 3997 | 3998 |
| 3998 } // namespace content | 3999 } // namespace content |
| OLD | NEW |