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

Unified Diff: ipc/ipc_message_utils_unittest.cc

Issue 2825853002: Improvements to uses of base::SmallMap (Closed)
Patch Set: Review comments Created 3 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.h ('k') | net/quic/platform/impl/quic_containers_impl.h » ('j') | 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 4a10d34e2c45dcc7b36bf9d10e6136062db347b5..4561c2e5cb9380b8139cd03ae75e2cb59ed52531 100644
--- a/ipc/ipc_message_utils_unittest.cc
+++ b/ipc/ipc_message_utils_unittest.cc
@@ -215,5 +215,25 @@ TEST(IPCMessageUtilsTest, UnguessableTokenTest) {
EXPECT_EQ(token, deserialized_token);
}
+TEST(IPCMessageUtilsTest, FlatMap) {
+ base::flat_map<std::string, int> input;
+ input["foo"] = 42;
+ input["bar"] = 96;
+
+ base::Pickle pickle;
+ IPC::WriteParam(&pickle, input);
+
+ base::PickleSizer sizer;
+ IPC::GetParamSize(&sizer, input);
+
+ EXPECT_EQ(sizer.payload_size(), pickle.payload_size());
+
+ base::PickleIterator iter(pickle);
+ base::flat_map<std::string, int> output;
+ EXPECT_TRUE(IPC::ReadParam(&pickle, &iter, &output));
+
+ EXPECT_EQ(input, output);
+}
+
} // namespace
} // namespace IPC
« no previous file with comments | « ipc/ipc_message_utils.h ('k') | net/quic/platform/impl/quic_containers_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698