| OLD | NEW |
| 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 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1284 | 1284 |
| 1285 // Add 9 bytes of referrer. | 1285 // Add 9 bytes of referrer. |
| 1286 req.set_referrer("123456789"); | 1286 req.set_referrer("123456789"); |
| 1287 EXPECT_EQ(4436, | 1287 EXPECT_EQ(4436, |
| 1288 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); | 1288 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); |
| 1289 | 1289 |
| 1290 // Add 33 bytes of upload content. | 1290 // Add 33 bytes of upload content. |
| 1291 std::string upload_content; | 1291 std::string upload_content; |
| 1292 upload_content.resize(33); | 1292 upload_content.resize(33); |
| 1293 std::fill(upload_content.begin(), upload_content.end(), 'x'); | 1293 std::fill(upload_content.begin(), upload_content.end(), 'x'); |
| 1294 req.AppendBytesToUpload(upload_content.data(), upload_content.size()); | 1294 scoped_refptr<net::UploadData> upload_data(new net::UploadData()); |
| 1295 upload_data->AppendBytes(upload_content.data(), upload_content.size()); |
| 1296 req.set_upload(upload_data); |
| 1295 | 1297 |
| 1296 // Since the upload throttling is disabled, this has no effect on the cost. | 1298 // Since the upload throttling is disabled, this has no effect on the cost. |
| 1297 EXPECT_EQ(4436, | 1299 EXPECT_EQ(4436, |
| 1298 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); | 1300 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); |
| 1299 } | 1301 } |
| 1300 | 1302 |
| 1301 // Test the private helper method "IncrementOutstandingRequestsMemoryCost()". | 1303 // Test the private helper method "IncrementOutstandingRequestsMemoryCost()". |
| 1302 TEST_F(ResourceDispatcherHostTest, IncrementOutstandingRequestsMemoryCost) { | 1304 TEST_F(ResourceDispatcherHostTest, IncrementOutstandingRequestsMemoryCost) { |
| 1303 // Add some counts for render_process_host=7 | 1305 // Add some counts for render_process_host=7 |
| 1304 EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(7)); | 1306 EXPECT_EQ(0, host_.GetOutstandingRequestsMemoryCost(7)); |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1947 } | 1949 } |
| 1948 | 1950 |
| 1949 MessageLoop::current()->RunUntilIdle(); | 1951 MessageLoop::current()->RunUntilIdle(); |
| 1950 | 1952 |
| 1951 msgs.clear(); | 1953 msgs.clear(); |
| 1952 accum_.GetClassifiedMessages(&msgs); | 1954 accum_.GetClassifiedMessages(&msgs); |
| 1953 } | 1955 } |
| 1954 } | 1956 } |
| 1955 | 1957 |
| 1956 } // namespace content | 1958 } // namespace content |
| OLD | NEW |