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

Unified Diff: ipc/ipc_message_utils_unittest.cc

Issue 11642041: Don't allow '\0' characters in FilePath. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: resize -> reserve in SavePackageTest Created 7 years, 11 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
Index: ipc/ipc_message_utils_unittest.cc
diff --git a/ipc/ipc_message_utils_unittest.cc b/ipc/ipc_message_utils_unittest.cc
index 2a49b9a56980d90145cb48fdb9dcef96bb988884..f9cb553a1f0908515d5f9ad8e5b5960a612cb9d0 100644
--- a/ipc/ipc_message_utils_unittest.cc
+++ b/ipc/ipc_message_utils_unittest.cc
@@ -55,17 +55,19 @@ TEST(IPCMessageUtilsTest, NestedMessages) {
// Tests that detection of various bad parameters is working correctly.
TEST(IPCMessageUtilsTest, ParameterValidation) {
+ FilePath::StringType ok_string(FILE_PATH_LITERAL("hello"), 5);
+ FilePath::StringType bad_string(FILE_PATH_LITERAL("hel\0o"), 5);
+
+ // Change this if ParamTraits<FilePath>::Write() changes.
IPC::Message message;
- FilePath::StringType okString(FILE_PATH_LITERAL("hello"), 5);
- FilePath::StringType badString(FILE_PATH_LITERAL("hel\0o"), 5);
- FilePath okPath(okString);
- FilePath badPath(badString);
- ParamTraits<FilePath>::Write(&message, okPath);
- ParamTraits<FilePath>::Write(&message, badPath);
+ ParamTraits<FilePath::StringType>::Write(&message, ok_string);
+ ParamTraits<FilePath::StringType>::Write(&message, bad_string);
PickleIterator iter(message);
- ASSERT_TRUE(ParamTraits<FilePath>::Read(&message, &iter, &okPath));
- ASSERT_FALSE(ParamTraits<FilePath>::Read(&message, &iter, &badPath));
+ FilePath ok_path;
+ FilePath bad_path;
+ ASSERT_TRUE(ParamTraits<FilePath>::Read(&message, &iter, &ok_path));
+ ASSERT_FALSE(ParamTraits<FilePath>::Read(&message, &iter, &bad_path));
}
} // namespace
« content/browser/download/save_package_unittest.cc ('K') | « ipc/ipc_message_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698