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) { |