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

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

Issue 2526983002: Refactor ResourceHandler API. (Closed)
Patch Set: Response to comments Created 3 years, 10 months 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 2413 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
2434 CheckFailedRequest(msgs[kMaxRequestsPerProcess + 0], 2437 CheckFailedRequest(msgs[kMaxRequestsPerProcess + 0],
2435 net::URLRequestTestJob::test_data_2(), 2438 net::URLRequestTestJob::test_data_2(), net::ERR_ABORTED);
2436 net::ERR_INSUFFICIENT_RESOURCES);
2437 CheckSuccessfulRequest(msgs[kMaxRequestsPerProcess + 1], 2439 CheckSuccessfulRequest(msgs[kMaxRequestsPerProcess + 1],
2438 net::URLRequestTestJob::test_data_2()); 2440 net::URLRequestTestJob::test_data_2());
2439 CheckFailedRequest(msgs[kMaxRequestsPerProcess + 2], 2441 CheckFailedRequest(msgs[kMaxRequestsPerProcess + 2],
2440 net::URLRequestTestJob::test_data_2(), 2442 net::URLRequestTestJob::test_data_2(), net::ERR_ABORTED);
2441 net::ERR_INSUFFICIENT_RESOURCES);
2442 2443
2443 second_filter->OnChannelClosing(); 2444 second_filter->OnChannelClosing();
2444 third_filter->OnChannelClosing(); 2445 third_filter->OnChannelClosing();
2445 } 2446 }
2446 2447
2447 // Tests that we sniff the mime type for a simple request. 2448 // Tests that we sniff the mime type for a simple request.
2448 TEST_P(ResourceDispatcherHostTest, MimeSniffed) { 2449 TEST_P(ResourceDispatcherHostTest, MimeSniffed) {
2449 std::string raw_headers("HTTP/1.1 200 OK\n\n"); 2450 std::string raw_headers("HTTP/1.1 200 OK\n\n");
2450 std::string response_data("<html><title>Test One</title></html>"); 2451 std::string response_data("<html><title>Test One</title></html>");
2451 SetResponse(raw_headers, response_data); 2452 SetResponse(raw_headers, response_data);
(...skipping 1542 matching lines...) Expand 10 before | Expand all | Expand 10 after
3994 return nullptr; 3995 return nullptr;
3995 } 3996 }
3996 3997
3997 INSTANTIATE_TEST_CASE_P( 3998 INSTANTIATE_TEST_CASE_P(
3998 ResourceDispatcherHostTests, 3999 ResourceDispatcherHostTests,
3999 ResourceDispatcherHostTest, 4000 ResourceDispatcherHostTest,
4000 testing::Values(TestConfig::kDefault, 4001 testing::Values(TestConfig::kDefault,
4001 TestConfig::kOptimizeIPCForSmallResourceEnabled)); 4002 TestConfig::kOptimizeIPCForSmallResourceEnabled));
4002 4003
4003 } // namespace content 4004 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.cc ('k') | content/browser/loader/resource_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698