Index: ipc/ipc_message_utils_unittest.cc |
diff --git a/ipc/ipc_message_utils_unittest.cc b/ipc/ipc_message_utils_unittest.cc |
index 0c9a7da1c97fbb5a3466a4e23428e8ad7c730b55..659047d206106053409601765b93947c88315d6f 100644 |
--- a/ipc/ipc_message_utils_unittest.cc |
+++ b/ipc/ipc_message_utils_unittest.cc |
@@ -8,6 +8,7 @@ |
#include <stdint.h> |
#include "base/files/file_path.h" |
+#include "base/json/json_reader.h" |
#include "ipc/ipc_message.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -116,5 +117,21 @@ TEST(IPCMessageUtilsTest, ValueSize) { |
EXPECT_EQ(sizer.payload_size(), pickle.payload_size()); |
} |
+TEST(IPCMessageUtilsTest, JsonValueSize) { |
+ const char kJson[] = "[ { \"foo\": \"bar\", \"baz\": 1234.0 } ]"; |
+ std::unique_ptr<base::Value> json_value = base::JSONReader::Read(kJson); |
+ EXPECT_NE(nullptr, json_value); |
+ base::ListValue value; |
+ value.Append(std::move(json_value)); |
+ |
+ base::Pickle pickle; |
+ IPC::WriteParam(&pickle, value); |
+ |
+ base::PickleSizer sizer; |
+ IPC::GetParamSize(&sizer, value); |
+ |
+ EXPECT_EQ(sizer.payload_size(), pickle.payload_size()); |
+} |
+ |
} // namespace |
} // namespace IPC |