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

Unified Diff: webkit/glue/glue_serialize_unittest.cc

Issue 10695107: Fix: file permissions when restoring a page with file inputs with selected files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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
« webkit/glue/glue_serialize.cc ('K') | « webkit/glue/glue_serialize.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webkit/glue/glue_serialize_unittest.cc
diff --git a/webkit/glue/glue_serialize_unittest.cc b/webkit/glue/glue_serialize_unittest.cc
index 306a0f5184731bfcd0b63c1e3421b7a704cc5d41..52fb12cc6a4cd47cd0a2e28d00ecef548522dfb6 100644
--- a/webkit/glue/glue_serialize_unittest.cc
+++ b/webkit/glue/glue_serialize_unittest.cc
@@ -281,6 +281,37 @@ TEST_F(GlueSerializeTest, FilePathsFromHistoryState) {
EXPECT_EQ(file_path2, file_paths[1]);
}
+TEST_F(GlueSerializeTest, FilePathsFromInputsInHistoryState) {
+ WebHistoryItem item;
+ item.initialize();
+
+ FilePath file_path_bad(FILE_PATH_LITERAL("bad-file.txt"));
+ FilePath file_path_good(FILE_PATH_LITERAL("good-file.txt"));
+ WebVector<WebString> document_state(size_t(13));
+ document_state[0] = WebString::fromUTF8(
+ "something and WebKit serialized form state version 5 and more");
+ document_state[1] = WebString::fromUTF8("name1");
+ document_state[2] = WebString::fromUTF8("not-a-file"); // control type
+ document_state[3] = WebString::fromUTF8("key");
+ document_state[4] = WebString::fromUTF8("2");
+ document_state[5] = webkit_glue::FilePathToWebString(file_path_bad);
+ document_state[6] = WebString::fromUTF8("filename");
+
+ document_state[7] = WebString::fromUTF8("name2");
+ document_state[8] = WebString::fromUTF8("file"); // control type
+ document_state[9] = WebString::fromUTF8("key");
+ document_state[10] = WebString::fromUTF8("2");
+ document_state[11] = webkit_glue::FilePathToWebString(file_path_good);
+ document_state[12] = WebString::fromUTF8("filename");
+ item.setDocumentState(document_state);
+
+ std::string serialized_item = webkit_glue::HistoryItemToString(item);
+ const std::vector<FilePath>& file_paths =
+ webkit_glue::FilePathsFromInputsInHistoryState(serialized_item);
+ ASSERT_EQ(1U, file_paths.size());
+ EXPECT_EQ(file_path_good, file_paths[0]);
+}
+
// Makes sure that a HistoryItem containing password data remains intact after
// being serialized and deserialized.
TEST_F(GlueSerializeTest, HistoryItemWithPasswordsSerializeTest) {
« webkit/glue/glue_serialize.cc ('K') | « webkit/glue/glue_serialize.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698