diff options
author | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-16 20:21:57 +0000 |
---|---|---|
committer | mpcomplete@google.com <mpcomplete@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-03-16 20:21:57 +0000 |
commit | 2de4626d5839e76e071029a25a0287b11ac6f0ef (patch) | |
tree | c69b188ba505ebc4bd9f315ef7d3798bfc84f4ed /base/pickle_unittest.cc | |
parent | b65ce0948709317aadc38e18c1a16f23a72bb5eb (diff) | |
download | chromium_src-2de4626d5839e76e071029a25a0287b11ac6f0ef.zip chromium_src-2de4626d5839e76e071029a25a0287b11ac6f0ef.tar.gz chromium_src-2de4626d5839e76e071029a25a0287b11ac6f0ef.tar.bz2 |
Change Pickle to double its capacity by default, rather than increasing
incrementally, when it needs to expand on writing data.
BUG=8760
Review URL: http://codereview.chromium.org/46056
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@11769 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/pickle_unittest.cc')
-rw-r--r-- | base/pickle_unittest.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/base/pickle_unittest.cc b/base/pickle_unittest.cc index a3fa1eb..48ab1cd 100644 --- a/base/pickle_unittest.cc +++ b/base/pickle_unittest.cc @@ -167,7 +167,8 @@ TEST(PickleTest, Resize) { static_cast<int>(payload_size_after_header - sizeof(uint32))); size_t cur_payload = payload_size_after_header; - EXPECT_EQ(pickle.capacity(), unit); + // note: we assume 'unit' is a power of 2 + EXPECT_EQ(unit, pickle.capacity()); EXPECT_EQ(pickle.payload_size(), payload_size_after_header); // fill out a full page (noting data header) @@ -176,10 +177,10 @@ TEST(PickleTest, Resize) { EXPECT_EQ(unit * 2, pickle.capacity()); EXPECT_EQ(cur_payload, pickle.payload_size()); - // one more byte should expand the capacity by one unit + // one more byte should double the capacity pickle.WriteData(data_ptr, 1); cur_payload += 5; - EXPECT_EQ(unit * 3, pickle.capacity()); + EXPECT_EQ(unit * 4, pickle.capacity()); EXPECT_EQ(cur_payload, pickle.payload_size()); } |