diff options
author | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-10 12:02:05 +0000 |
---|---|---|
committer | marja@chromium.org <marja@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-10 12:02:05 +0000 |
commit | e5cb53c66eba1d1a8be7844f59900b1c48268ec9 (patch) | |
tree | c869889186afdd0e9473adce51ff1fca31c356ae /webkit | |
parent | 14eb6cee18e7b19d26c72cf25eeb709ae2763d7e (diff) | |
download | chromium_src-e5cb53c66eba1d1a8be7844f59900b1c48268ec9.zip chromium_src-e5cb53c66eba1d1a8be7844f59900b1c48268ec9.tar.gz chromium_src-e5cb53c66eba1d1a8be7844f59900b1c48268ec9.tar.bz2 |
Revert 121429 - Session restore: save and restore HTTP body for POST requests.
BUG=104293
TEST=GlueSerializeTest.(RemoveFormData|FilePathsFromHistoryState), SessionServiceTest.(Keep|Remove)PostData, SessionServiceTest.CompressAndDecompressData
Review URL: http://codereview.chromium.org/8952017
TBR=marja@chromium.org
Review URL: https://chromiumcodereview.appspot.com/9380003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@121435 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r-- | webkit/glue/glue_serialize.cc | 25 | ||||
-rw-r--r-- | webkit/glue/glue_serialize.h | 8 | ||||
-rw-r--r-- | webkit/glue/glue_serialize_unittest.cc | 59 |
3 files changed, 5 insertions, 87 deletions
diff --git a/webkit/glue/glue_serialize.cc b/webkit/glue/glue_serialize.cc index 04a4ac4..9ee14f9 100644 --- a/webkit/glue/glue_serialize.cc +++ b/webkit/glue/glue_serialize.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -498,29 +498,6 @@ WebHistoryItem HistoryItemFromString(const std::string& serialized_item) { return HistoryItemFromString(serialized_item, true, true); } -std::vector<FilePath> FilePathsFromHistoryState( - const std::string& content_state) { - std::vector<FilePath> to_return; - // TODO(darin): We should avoid using the WebKit API here, so that we do not - // need to have WebKit initialized before calling this method. - const WebHistoryItem& item = - HistoryItemFromString(content_state, true, true); - if (item.isNull()) { - // Couldn't parse the string. - return to_return; - } - const WebHTTPBody& http_body = item.httpBody(); - if (!http_body.isNull()) { - WebHTTPBody::Element element; - for (size_t i = 0; i < http_body.elementCount(); ++i) { - http_body.elementAt(i, element); - if (element.type == WebHTTPBody::Element::TypeFile) - to_return.push_back(WebStringToFilePath(element.filePath)); - } - } - return to_return; -} - // For testing purposes only. void HistoryItemToVersionedString(const WebHistoryItem& item, int version, std::string* serialized_item) { diff --git a/webkit/glue/glue_serialize.h b/webkit/glue/glue_serialize.h index 8d8ad2e..6e4c575 100644 --- a/webkit/glue/glue_serialize.h +++ b/webkit/glue/glue_serialize.h @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // @@ -11,8 +11,6 @@ #define WEBKIT_GLUE_GLUE_SERIALIZE_H_ #include <string> - -#include "base/file_path.h" #include "third_party/WebKit/Source/WebKit/chromium/public/WebHistoryItem.h" #include "webkit/glue/webkit_glue_export.h" @@ -24,10 +22,6 @@ WEBKIT_GLUE_EXPORT std::string HistoryItemToString( WEBKIT_GLUE_EXPORT WebKit::WebHistoryItem HistoryItemFromString( const std::string& serialized_item); -// Reads file paths from the HTTP body of a serialized WebHistoryItem. -WEBKIT_GLUE_EXPORT std::vector<FilePath> FilePathsFromHistoryState( - const std::string& content_state); - // For testing purposes only. WEBKIT_GLUE_EXPORT void HistoryItemToVersionedString( const WebKit::WebHistoryItem& item, diff --git a/webkit/glue/glue_serialize_unittest.cc b/webkit/glue/glue_serialize_unittest.cc index 1d88c8d..54a3540 100644 --- a/webkit/glue/glue_serialize_unittest.cc +++ b/webkit/glue/glue_serialize_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -11,7 +11,6 @@ #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebPoint.h" #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" #include "webkit/glue/glue_serialize.h" -#include "webkit/glue/webkit_glue.h" #include "webkit/glue/web_io_operators.h" using WebKit::WebData; @@ -84,13 +83,6 @@ class GlueSerializeTest : public testing::Test { // Checks that a == b. void HistoryItemExpectEqual(const WebHistoryItem& a, const WebHistoryItem& b) { - HistoryItemExpectBaseDataEqual(a, b); - HistoryItemExpectFormDataEqual(a, b); - HistoryItemExpectChildrenEqual(a, b); - } - - void HistoryItemExpectBaseDataEqual(const WebHistoryItem& a, - const WebHistoryItem& b) { EXPECT_EQ(string16(a.urlString()), string16(b.urlString())); EXPECT_EQ(string16(a.originalURLString()), string16(b.originalURLString())); EXPECT_EQ(string16(a.target()), string16(b.target())); @@ -109,10 +101,8 @@ class GlueSerializeTest : public testing::Test { EXPECT_EQ(a_docstate.size(), b_docstate.size()); for (size_t i = 0, c = a_docstate.size(); i < c; ++i) EXPECT_EQ(string16(a_docstate[i]), string16(b_docstate[i])); - } - void HistoryItemExpectFormDataEqual(const WebHistoryItem& a, - const WebHistoryItem& b) { + // Form Data const WebHTTPBody& a_body = a.httpBody(); const WebHTTPBody& b_body = b.httpBody(); EXPECT_EQ(!a_body.isNull(), !b_body.isNull()); @@ -131,10 +121,8 @@ class GlueSerializeTest : public testing::Test { } } EXPECT_EQ(string16(a.httpContentType()), string16(b.httpContentType())); - } - void HistoryItemExpectChildrenEqual(const WebHistoryItem& a, - const WebHistoryItem& b) { + // Children const WebVector<WebHistoryItem>& a_children = a.children(); const WebVector<WebHistoryItem>& b_children = b.children(); EXPECT_EQ(a_children.size(), b_children.size()); @@ -211,45 +199,4 @@ TEST_F(GlueSerializeTest, BadMessagesTest) { } } -TEST_F(GlueSerializeTest, RemoveFormData) { - const WebHistoryItem& item1 = MakeHistoryItem(true, true); - std::string serialized_item = webkit_glue::HistoryItemToString(item1); - serialized_item = - webkit_glue::RemoveFormDataFromHistoryState(serialized_item); - const WebHistoryItem& item2 = - webkit_glue::HistoryItemFromString(serialized_item); - - ASSERT_FALSE(item1.isNull()); - ASSERT_FALSE(item2.isNull()); - - HistoryItemExpectBaseDataEqual(item1, item2); - HistoryItemExpectChildrenEqual(item1, item2); - - // Form data was removed. - const WebHTTPBody& body1 = item1.httpBody(); - const WebHTTPBody& body2 = item2.httpBody(); - EXPECT_FALSE(body1.isNull()); - EXPECT_TRUE(body2.isNull()); -} - -TEST_F(GlueSerializeTest, FilePathsFromHistoryState) { - WebHistoryItem item = MakeHistoryItem(false, true); - - // Append file paths to item. - FilePath file_path1(FILE_PATH_LITERAL("file.txt")); - FilePath file_path2(FILE_PATH_LITERAL("another_file")); - WebHTTPBody http_body; - http_body.initialize(); - http_body.appendFile(webkit_glue::FilePathToWebString(file_path1)); - http_body.appendFile(webkit_glue::FilePathToWebString(file_path2)); - item.setHTTPBody(http_body); - - std::string serialized_item = webkit_glue::HistoryItemToString(item); - const std::vector<FilePath>& file_paths = - webkit_glue::FilePathsFromHistoryState(serialized_item); - ASSERT_EQ(2U, file_paths.size()); - EXPECT_EQ(file_path1, file_paths[0]); - EXPECT_EQ(file_path2, file_paths[1]); -} - } // namespace |