diff options
Diffstat (limited to 'base/pickle_unittest.cc')
-rw-r--r-- | base/pickle_unittest.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/base/pickle_unittest.cc b/base/pickle_unittest.cc index 1a98cd2..aea3830 100644 --- a/base/pickle_unittest.cc +++ b/base/pickle_unittest.cc @@ -259,3 +259,17 @@ TEST(PickleTest, ZeroLength) { // We can't assert that outdata is NULL. } +// Check that ReadBytes works properly with an iterator initialized to NULL. +TEST(PickleTest, ReadBytes) { + Pickle pickle; + int data = 0x7abcd; + EXPECT_TRUE(pickle.WriteBytes(&data, sizeof(data))); + + void* iter = NULL; + const char* outdata_char; + EXPECT_TRUE(pickle.ReadBytes(&iter, &outdata_char, sizeof(data))); + + int outdata; + memcpy(&outdata, outdata_char, sizeof(outdata)); + EXPECT_EQ(data, outdata); +} |