| 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/memory/scoped_vector.h" | 9 #include "base/memory/scoped_vector.h" |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| (...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1281 } | 1281 } |
| 1282 | 1282 |
| 1283 // Test the private helper method "CalculateApproximateMemoryCost()". | 1283 // Test the private helper method "CalculateApproximateMemoryCost()". |
| 1284 TEST_F(ResourceDispatcherHostTest, CalculateApproximateMemoryCost) { | 1284 TEST_F(ResourceDispatcherHostTest, CalculateApproximateMemoryCost) { |
| 1285 net::URLRequestContext context; | 1285 net::URLRequestContext context; |
| 1286 net::URLRequest req(GURL("http://www.google.com"), NULL, &context); | 1286 net::URLRequest req(GURL("http://www.google.com"), NULL, &context); |
| 1287 EXPECT_EQ(4427, | 1287 EXPECT_EQ(4427, |
| 1288 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); | 1288 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); |
| 1289 | 1289 |
| 1290 // Add 9 bytes of referrer. | 1290 // Add 9 bytes of referrer. |
| 1291 req.set_referrer("123456789"); | 1291 req.SetReferrer("123456789"); |
| 1292 EXPECT_EQ(4436, | 1292 EXPECT_EQ(4436, |
| 1293 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); | 1293 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); |
| 1294 | 1294 |
| 1295 // Add 33 bytes of upload content. | 1295 // Add 33 bytes of upload content. |
| 1296 std::string upload_content; | 1296 std::string upload_content; |
| 1297 upload_content.resize(33); | 1297 upload_content.resize(33); |
| 1298 std::fill(upload_content.begin(), upload_content.end(), 'x'); | 1298 std::fill(upload_content.begin(), upload_content.end(), 'x'); |
| 1299 scoped_ptr<net::UploadElementReader> reader(new net::UploadBytesElementReader( | 1299 scoped_ptr<net::UploadElementReader> reader(new net::UploadBytesElementReader( |
| 1300 upload_content.data(), upload_content.size())); | 1300 upload_content.data(), upload_content.size())); |
| 1301 req.set_upload(make_scoped_ptr( | 1301 req.set_upload(make_scoped_ptr( |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1953 } | 1953 } |
| 1954 | 1954 |
| 1955 MessageLoop::current()->RunUntilIdle(); | 1955 MessageLoop::current()->RunUntilIdle(); |
| 1956 | 1956 |
| 1957 msgs.clear(); | 1957 msgs.clear(); |
| 1958 accum_.GetClassifiedMessages(&msgs); | 1958 accum_.GetClassifiedMessages(&msgs); |
| 1959 } | 1959 } |
| 1960 } | 1960 } |
| 1961 | 1961 |
| 1962 } // namespace content | 1962 } // namespace content |
| OLD | NEW |