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

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

Issue 9836066: Have content cancel requests for ResourceContexts when they shutdown, instead of depending on the e… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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 | Annotate | Revision Log
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 "content/browser/renderer_host/resource_dispatcher_host_impl.h" 5 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 915 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 host_.BlockRequestsForRoute(second_filter->child_id(), 1); 926 host_.BlockRequestsForRoute(second_filter->child_id(), 1);
927 927
928 MakeTestRequest(filter_.get(), 0, 1, net::URLRequestTestJob::test_url_1()); 928 MakeTestRequest(filter_.get(), 0, 1, net::URLRequestTestJob::test_url_1());
929 MakeTestRequest(filter_.get(), 1, 2, net::URLRequestTestJob::test_url_2()); 929 MakeTestRequest(filter_.get(), 1, 2, net::URLRequestTestJob::test_url_2());
930 MakeTestRequest(filter_.get(), 0, 3, net::URLRequestTestJob::test_url_3()); 930 MakeTestRequest(filter_.get(), 0, 3, net::URLRequestTestJob::test_url_3());
931 MakeTestRequest(second_filter.get(), 1, 4, 931 MakeTestRequest(second_filter.get(), 1, 4,
932 net::URLRequestTestJob::test_url_1()); 932 net::URLRequestTestJob::test_url_1());
933 MakeTestRequest(filter_.get(), 2, 5, net::URLRequestTestJob::test_url_2()); 933 MakeTestRequest(filter_.get(), 2, 5, net::URLRequestTestJob::test_url_2());
934 MakeTestRequest(filter_.get(), 2, 6, net::URLRequestTestJob::test_url_3()); 934 MakeTestRequest(filter_.get(), 2, 6, net::URLRequestTestJob::test_url_3());
935 935
936 host_.CancelRequestsForProcess(filter_->child_id());
937 host_.CancelRequestsForProcess(second_filter->child_id());
938
936 // Flush all the pending requests. 939 // Flush all the pending requests.
937 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {} 940 while (net::URLRequestTestJob::ProcessOnePendingMessage()) {}
938 } 941 }
939 942
940 // Test the private helper method "CalculateApproximateMemoryCost()". 943 // Test the private helper method "CalculateApproximateMemoryCost()".
941 TEST_F(ResourceDispatcherHostTest, CalculateApproximateMemoryCost) { 944 TEST_F(ResourceDispatcherHostTest, CalculateApproximateMemoryCost) {
942 net::URLRequest req(GURL("http://www.google.com"), NULL); 945 net::URLRequest req(GURL("http://www.google.com"), NULL);
943 EXPECT_EQ(4427, 946 EXPECT_EQ(4427,
944 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); 947 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req));
945 948
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after
1385 PickleIterator iter(msgs[0][0]); 1388 PickleIterator iter(msgs[0][0]);
1386 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &request_id)); 1389 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &request_id));
1387 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &status)); 1390 EXPECT_TRUE(IPC::ReadParam(&msgs[0][0], &iter, &status));
1388 1391
1389 EXPECT_EQ(1, request_id); 1392 EXPECT_EQ(1, request_id);
1390 EXPECT_EQ(net::URLRequestStatus::FAILED, status.status()); 1393 EXPECT_EQ(net::URLRequestStatus::FAILED, status.status());
1391 EXPECT_EQ(net::ERR_UNKNOWN_URL_SCHEME, status.error()); 1394 EXPECT_EQ(net::ERR_UNKNOWN_URL_SCHEME, status.error());
1392 } 1395 }
1393 1396
1394 } // namespace content 1397 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/resource_dispatcher_host_impl.h ('k') | content/browser/resource_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698