summaryrefslogtreecommitdiffstats
path: root/chrome/browser/renderer_host
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 22:26:05 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-07 22:26:05 +0000
commita24cb443103a83d16744b74808226aec6ff57aef (patch)
tree5732ce762d889d173ce0ba8e8507a5d7727bf8ed /chrome/browser/renderer_host
parentbf67d582b2a8cb255f467a18de6625fdcb4923f5 (diff)
downloadchromium_src-a24cb443103a83d16744b74808226aec6ff57aef.zip
chromium_src-a24cb443103a83d16744b74808226aec6ff57aef.tar.gz
chromium_src-a24cb443103a83d16744b74808226aec6ff57aef.tar.bz2
Fix the unit tests that had multiple ResourceDispatcherHost objects instantiated at the same time.
Review URL: http://codereview.chromium.org/149287 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20093 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/renderer_host')
-rw-r--r--chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc44
1 files changed, 20 insertions, 24 deletions
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
index 2a9d95b..513c464 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host_unittest.cc
@@ -254,8 +254,6 @@ TEST_F(ResourceDispatcherHostTest, TestMany) {
// Tests whether messages get canceled properly. We issue three requests,
// cancel one of them, and make sure that each sent the proper notifications.
TEST_F(ResourceDispatcherHostTest, Cancel) {
- ResourceDispatcherHost host(NULL);
-
EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(0));
MakeTestRequest(0, 0, 1, URLRequestTestJob::test_url_1());
@@ -542,37 +540,35 @@ TEST_F(ResourceDispatcherHostTest, CalculateApproximateMemoryCost) {
// Test the private helper method "IncrementOutstandingRequestsMemoryCost()".
TEST_F(ResourceDispatcherHostTest, IncrementOutstandingRequestsMemoryCost) {
- ResourceDispatcherHost host(NULL);
-
// Add some counts for render_process_host=7
- EXPECT_EQ(0, host.GetOutstandingRequestsMemoryCost(7));
- EXPECT_EQ(1, host.IncrementOutstandingRequestsMemoryCost(1, 7));
- EXPECT_EQ(2, host.IncrementOutstandingRequestsMemoryCost(1, 7));
- EXPECT_EQ(3, host.IncrementOutstandingRequestsMemoryCost(1, 7));
+ EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(7));
+ EXPECT_EQ(1, host_.IncrementOutstandingRequestsMemoryCost(1, 7));
+ EXPECT_EQ(2, host_.IncrementOutstandingRequestsMemoryCost(1, 7));
+ EXPECT_EQ(3, host_.IncrementOutstandingRequestsMemoryCost(1, 7));
// Add some counts for render_process_host=3
- EXPECT_EQ(0, host.GetOutstandingRequestsMemoryCost(3));
- EXPECT_EQ(1, host.IncrementOutstandingRequestsMemoryCost(1, 3));
- EXPECT_EQ(2, host.IncrementOutstandingRequestsMemoryCost(1, 3));
+ EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(3));
+ EXPECT_EQ(1, host_.IncrementOutstandingRequestsMemoryCost(1, 3));
+ EXPECT_EQ(2, host_.IncrementOutstandingRequestsMemoryCost(1, 3));
// Remove all the counts for render_process_host=7
- EXPECT_EQ(3, host.GetOutstandingRequestsMemoryCost(7));
- EXPECT_EQ(2, host.IncrementOutstandingRequestsMemoryCost(-1, 7));
- EXPECT_EQ(1, host.IncrementOutstandingRequestsMemoryCost(-1, 7));
- EXPECT_EQ(0, host.IncrementOutstandingRequestsMemoryCost(-1, 7));
- EXPECT_EQ(0, host.GetOutstandingRequestsMemoryCost(7));
+ EXPECT_EQ(3, host_.GetOutstandingRequestsMemoryCost(7));
+ EXPECT_EQ(2, host_.IncrementOutstandingRequestsMemoryCost(-1, 7));
+ EXPECT_EQ(1, host_.IncrementOutstandingRequestsMemoryCost(-1, 7));
+ EXPECT_EQ(0, host_.IncrementOutstandingRequestsMemoryCost(-1, 7));
+ EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(7));
// Remove all the counts for render_process_host=3
- EXPECT_EQ(2, host.GetOutstandingRequestsMemoryCost(3));
- EXPECT_EQ(1, host.IncrementOutstandingRequestsMemoryCost(-1, 3));
- EXPECT_EQ(0, host.IncrementOutstandingRequestsMemoryCost(-1, 3));
- EXPECT_EQ(0, host.GetOutstandingRequestsMemoryCost(3));
+ EXPECT_EQ(2, host_.GetOutstandingRequestsMemoryCost(3));
+ EXPECT_EQ(1, host_.IncrementOutstandingRequestsMemoryCost(-1, 3));
+ EXPECT_EQ(0, host_.IncrementOutstandingRequestsMemoryCost(-1, 3));
+ EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(3));
// When an entry reaches 0, it should be deleted.
- EXPECT_TRUE(host.outstanding_requests_memory_cost_map_.end() ==
- host.outstanding_requests_memory_cost_map_.find(7));
- EXPECT_TRUE(host.outstanding_requests_memory_cost_map_.end() ==
- host.outstanding_requests_memory_cost_map_.find(3));
+ EXPECT_TRUE(host_.outstanding_requests_memory_cost_map_.end() ==
+ host_.outstanding_requests_memory_cost_map_.find(7));
+ EXPECT_TRUE(host_.outstanding_requests_memory_cost_map_.end() ==
+ host_.outstanding_requests_memory_cost_map_.find(3));
}
// Test that when too many requests are outstanding for a particular