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