Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: pickle_unittest.cc

Issue 2050803003: Update to Chromium //base at Chromium commit e3a753f17bac62738b0dbf0b36510f767b081e4b. (Closed) Base URL: https://github.com/domokit/base.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pickle.cc ('k') | power_monitor/power_monitor_device_source_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pickle_unittest.cc
diff --git a/pickle_unittest.cc b/pickle_unittest.cc
index b0a8f21f89f9282d5d6783eaf13d49e43f837a6e..6f9fcc7f62ad898bf4b7de91aee43faafddbda6d 100644
--- a/pickle_unittest.cc
+++ b/pickle_unittest.cc
@@ -428,4 +428,18 @@ TEST(PickleTest, ReadBytes) {
EXPECT_EQ(data, outdata);
}
+// Checks that when a pickle is deep-copied, the result is not larger than
+// needed.
+TEST(PickleTest, DeepCopyResize) {
+ Pickle pickle;
+ while (pickle.capacity_after_header() != pickle.payload_size())
+ pickle.WriteBool(true);
+
+ // Make a deep copy.
+ Pickle pickle2(pickle);
+
+ // Check that there isn't any extraneous capacity.
+ EXPECT_EQ(pickle.capacity_after_header(), pickle2.capacity_after_header());
+}
+
} // namespace base
« no previous file with comments | « pickle.cc ('k') | power_monitor/power_monitor_device_source_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698