| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/pickle.h" | 7 #include "base/pickle.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebHTTPBody.h" | 10 #include "third_party/WebKit/Source/Platform/chromium/public/WebHTTPBody.h" |
| (...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 EXPECT_FALSE(body2.isNull()); | 258 EXPECT_FALSE(body2.isNull()); |
| 259 EXPECT_GT(body1.elementCount(), 0U); | 259 EXPECT_GT(body1.elementCount(), 0U); |
| 260 EXPECT_EQ(0U, body2.elementCount()); | 260 EXPECT_EQ(0U, body2.elementCount()); |
| 261 EXPECT_EQ(body1.identifier(), body2.identifier()); | 261 EXPECT_EQ(body1.identifier(), body2.identifier()); |
| 262 } | 262 } |
| 263 | 263 |
| 264 TEST_F(GlueSerializeTest, FilePathsFromHistoryState) { | 264 TEST_F(GlueSerializeTest, FilePathsFromHistoryState) { |
| 265 WebHistoryItem item = MakeHistoryItem(false, true); | 265 WebHistoryItem item = MakeHistoryItem(false, true); |
| 266 | 266 |
| 267 // Append file paths to item. | 267 // Append file paths to item. |
| 268 FilePath file_path1(FILE_PATH_LITERAL("file.txt")); | 268 base::FilePath file_path1(FILE_PATH_LITERAL("file.txt")); |
| 269 FilePath file_path2(FILE_PATH_LITERAL("another_file")); | 269 base::FilePath file_path2(FILE_PATH_LITERAL("another_file")); |
| 270 WebHTTPBody http_body; | 270 WebHTTPBody http_body; |
| 271 http_body.initialize(); | 271 http_body.initialize(); |
| 272 http_body.appendFile(webkit_base::FilePathToWebString(file_path1)); | 272 http_body.appendFile(webkit_base::FilePathToWebString(file_path1)); |
| 273 http_body.appendFile(webkit_base::FilePathToWebString(file_path2)); | 273 http_body.appendFile(webkit_base::FilePathToWebString(file_path2)); |
| 274 item.setHTTPBody(http_body); | 274 item.setHTTPBody(http_body); |
| 275 | 275 |
| 276 std::string serialized_item = webkit_glue::HistoryItemToString(item); | 276 std::string serialized_item = webkit_glue::HistoryItemToString(item); |
| 277 const std::vector<FilePath>& file_paths = | 277 const std::vector<base::FilePath>& file_paths = |
| 278 webkit_glue::FilePathsFromHistoryState(serialized_item); | 278 webkit_glue::FilePathsFromHistoryState(serialized_item); |
| 279 ASSERT_EQ(2U, file_paths.size()); | 279 ASSERT_EQ(2U, file_paths.size()); |
| 280 EXPECT_EQ(file_path1, file_paths[0]); | 280 EXPECT_EQ(file_path1, file_paths[0]); |
| 281 EXPECT_EQ(file_path2, file_paths[1]); | 281 EXPECT_EQ(file_path2, file_paths[1]); |
| 282 } | 282 } |
| 283 | 283 |
| 284 // Makes sure that a HistoryItem containing password data remains intact after | 284 // Makes sure that a HistoryItem containing password data remains intact after |
| 285 // being serialized and deserialized. | 285 // being serialized and deserialized. |
| 286 TEST_F(GlueSerializeTest, HistoryItemWithPasswordsSerializeTest) { | 286 TEST_F(GlueSerializeTest, HistoryItemWithPasswordsSerializeTest) { |
| 287 const WebHistoryItem& item = MakeHistoryItemWithPasswordData(true); | 287 const WebHistoryItem& item = MakeHistoryItemWithPasswordData(true); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 330 | 330 |
| 331 ASSERT_FALSE(item1.isNull()); | 331 ASSERT_FALSE(item1.isNull()); |
| 332 ASSERT_FALSE(item2.isNull()); | 332 ASSERT_FALSE(item2.isNull()); |
| 333 | 333 |
| 334 // Form data was not removed. | 334 // Form data was not removed. |
| 335 HistoryItemExpectEqual(item1, item2, | 335 HistoryItemExpectEqual(item1, item2, |
| 336 webkit_glue::HistoryItemCurrentVersion()); | 336 webkit_glue::HistoryItemCurrentVersion()); |
| 337 } | 337 } |
| 338 | 338 |
| 339 } // namespace | 339 } // namespace |
| OLD | NEW |