Chromium Code Reviews| 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 1269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1280 } | 1280 } |
| 1281 | 1281 |
| 1282 // Test the private helper method "CalculateApproximateMemoryCost()". | 1282 // Test the private helper method "CalculateApproximateMemoryCost()". |
| 1283 TEST_F(ResourceDispatcherHostTest, CalculateApproximateMemoryCost) { | 1283 TEST_F(ResourceDispatcherHostTest, CalculateApproximateMemoryCost) { |
| 1284 net::URLRequestContext context; | 1284 net::URLRequestContext context; |
| 1285 net::URLRequest req(GURL("http://www.google.com"), NULL, &context); | 1285 net::URLRequest req(GURL("http://www.google.com"), NULL, &context); |
| 1286 EXPECT_EQ(4427, | 1286 EXPECT_EQ(4427, |
| 1287 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); | 1287 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); |
| 1288 | 1288 |
| 1289 // Add 9 bytes of referrer. | 1289 // Add 9 bytes of referrer. |
| 1290 req.set_referrer("123456789"); | 1290 req.SetReferrer("123456789"); |
|
mef
2013/03/18 16:42:07
I've verified that this test passes.
| |
| 1291 EXPECT_EQ(4436, | 1291 EXPECT_EQ(4436, |
| 1292 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); | 1292 ResourceDispatcherHostImpl::CalculateApproximateMemoryCost(&req)); |
| 1293 | 1293 |
| 1294 // Add 33 bytes of upload content. | 1294 // Add 33 bytes of upload content. |
| 1295 std::string upload_content; | 1295 std::string upload_content; |
| 1296 upload_content.resize(33); | 1296 upload_content.resize(33); |
| 1297 std::fill(upload_content.begin(), upload_content.end(), 'x'); | 1297 std::fill(upload_content.begin(), upload_content.end(), 'x'); |
| 1298 scoped_ptr<net::UploadElementReader> reader(new net::UploadBytesElementReader( | 1298 scoped_ptr<net::UploadElementReader> reader(new net::UploadBytesElementReader( |
| 1299 upload_content.data(), upload_content.size())); | 1299 upload_content.data(), upload_content.size())); |
| 1300 req.set_upload(make_scoped_ptr( | 1300 req.set_upload(make_scoped_ptr( |
| (...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1954 } | 1954 } |
| 1955 | 1955 |
| 1956 MessageLoop::current()->RunUntilIdle(); | 1956 MessageLoop::current()->RunUntilIdle(); |
| 1957 | 1957 |
| 1958 msgs.clear(); | 1958 msgs.clear(); |
| 1959 accum_.GetClassifiedMessages(&msgs); | 1959 accum_.GetClassifiedMessages(&msgs); |
| 1960 } | 1960 } |
| 1961 } | 1961 } |
| 1962 | 1962 |
| 1963 } // namespace content | 1963 } // namespace content |
| OLD | NEW |