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

Unified Diff: ipc/ipc_message_utils_unittest.cc

Issue 1866633002: Make IPC::ParamTraits<>GetSize work with base::Value as a result of JSON parsing. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « ipc/ipc_message_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « ipc/ipc_message_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698