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

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

Issue 2005273002: Move MimeTypeResourceHandler before ThrottlingResourceHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed gypi error Created 4 years, 6 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 2551 matching lines...) Expand 10 before | Expand all | Expand 10 after
2562 SetResponse(raw_headers, response_data); 2562 SetResponse(raw_headers, response_data);
2563 job_factory_->SetDelayedCompleteJobGeneration(true); 2563 job_factory_->SetDelayedCompleteJobGeneration(true);
2564 HandleScheme("http"); 2564 HandleScheme("http");
2565 2565
2566 MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id, 2566 MakeTestRequestWithResourceType(filter_.get(), render_view_id, request_id,
2567 GURL("http://example.com/blah"), 2567 GURL("http://example.com/blah"),
2568 RESOURCE_TYPE_MAIN_FRAME); 2568 RESOURCE_TYPE_MAIN_FRAME);
2569 // Return some data so that the request is identified as a download 2569 // Return some data so that the request is identified as a download
2570 // and the proper resource handlers are created. 2570 // and the proper resource handlers are created.
2571 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage()); 2571 EXPECT_TRUE(net::URLRequestTestJob::ProcessOnePendingMessage());
2572 base::MessageLoop::current()->RunUntilIdle();
2572 2573
2573 // And now simulate a cancellation coming from the renderer. 2574 // And now simulate a cancellation coming from the renderer.
2574 ResourceHostMsg_CancelRequest msg(request_id); 2575 ResourceHostMsg_CancelRequest msg(request_id);
2575 host_.OnMessageReceived(msg, filter_.get()); 2576 host_.OnMessageReceived(msg, filter_.get());
2576 2577
2577 // Since the request had already started processing as a download, 2578 // Since the request had already started processing as a download,
2578 // the cancellation above should have been ignored and the request 2579 // the cancellation above should have been ignored and the request
2579 // should still be alive. 2580 // should still be alive.
2580 EXPECT_EQ(1, host_.pending_requests()); 2581 EXPECT_EQ(1, host_.pending_requests());
2581 2582
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
3021 SetResponse("HTTP/1.1 200 OK\n" 3022 SetResponse("HTTP/1.1 200 OK\n"
3022 "Content-Type: text/plain\n\n", 3023 "Content-Type: text/plain\n\n",
3023 kResponseBody); 3024 kResponseBody);
3024 ResourceHostMsg_FollowRedirect redirect_msg(request_id); 3025 ResourceHostMsg_FollowRedirect redirect_msg(request_id);
3025 host_.OnMessageReceived(redirect_msg, filter_.get()); 3026 host_.OnMessageReceived(redirect_msg, filter_.get());
3026 base::MessageLoop::current()->RunUntilIdle(); 3027 base::MessageLoop::current()->RunUntilIdle();
3027 3028
3028 // Flush all the pending requests to get the response through the 3029 // Flush all the pending requests to get the response through the
3029 // MimeTypeResourceHandler. 3030 // MimeTypeResourceHandler.
3030 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} 3031 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
3032 base::MessageLoop::current()->RunUntilIdle();
3031 3033
3032 // Restore, now that we've set up a transfer. 3034 // Restore, now that we've set up a transfer.
3033 SetBrowserClientForTesting(old_client); 3035 SetBrowserClientForTesting(old_client);
3034 3036
3035 // This second filter is used to emulate a second process. 3037 // This second filter is used to emulate a second process.
3036 scoped_refptr<ForwardingFilter> second_filter = MakeForwardingFilter(); 3038 scoped_refptr<ForwardingFilter> second_filter = MakeForwardingFilter();
3037 3039
3038 int new_render_view_id = 1; 3040 int new_render_view_id = 1;
3039 int new_request_id = 2; 3041 int new_request_id = 2;
3040 3042
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
3189 SetResponse("HTTP/1.1 200 OK\n" 3191 SetResponse("HTTP/1.1 200 OK\n"
3190 "Content-Type: text/plain\n\n", 3192 "Content-Type: text/plain\n\n",
3191 kResponseBody); 3193 kResponseBody);
3192 ResourceHostMsg_FollowRedirect redirect_msg2(request_id); 3194 ResourceHostMsg_FollowRedirect redirect_msg2(request_id);
3193 host_.OnMessageReceived(redirect_msg2, filter_.get()); 3195 host_.OnMessageReceived(redirect_msg2, filter_.get());
3194 base::MessageLoop::current()->RunUntilIdle(); 3196 base::MessageLoop::current()->RunUntilIdle();
3195 3197
3196 // Flush all the pending requests to get the response through the 3198 // Flush all the pending requests to get the response through the
3197 // MimeTypeResourceHandler. 3199 // MimeTypeResourceHandler.
3198 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} 3200 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
3201 base::MessageLoop::current()->RunUntilIdle();
3199 3202
3200 // Restore. 3203 // Restore.
3201 SetBrowserClientForTesting(old_client); 3204 SetBrowserClientForTesting(old_client);
3202 3205
3203 // This second filter is used to emulate a second process. 3206 // This second filter is used to emulate a second process.
3204 scoped_refptr<ForwardingFilter> second_filter = MakeForwardingFilter(); 3207 scoped_refptr<ForwardingFilter> second_filter = MakeForwardingFilter();
3205 3208
3206 int new_render_view_id = 1; 3209 int new_render_view_id = 1;
3207 int new_request_id = 2; 3210 int new_request_id = 2;
3208 3211
(...skipping 687 matching lines...) Expand 10 before | Expand all | Expand 10 after
3896 return nullptr; 3899 return nullptr;
3897 } 3900 }
3898 3901
3899 INSTANTIATE_TEST_CASE_P( 3902 INSTANTIATE_TEST_CASE_P(
3900 ResourceDispatcherHostTests, 3903 ResourceDispatcherHostTests,
3901 ResourceDispatcherHostTest, 3904 ResourceDispatcherHostTest,
3902 testing::Values(TestConfig::kDefault, 3905 testing::Values(TestConfig::kDefault,
3903 TestConfig::kOptimizeIPCForSmallResourceEnabled)); 3906 TestConfig::kOptimizeIPCForSmallResourceEnabled));
3904 3907
3905 } // namespace content 3908 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698