Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(97)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_unittest.cc

Issue 2526983002: Refactor ResourceHandler API. (Closed)
Patch Set: Fix merge again (?) Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698