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