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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebPageSerializerTest.cpp

Issue 1502563004: Save-Page-As-Complete-Html: Each frame links to a distinct local file. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@no-url-deduping-for-frame-and-adding-save-item-id
Patch Set: Rebasing... Created 5 years 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 URLTestHelpers::registerMockedURLLoad(KURL(ParsedURLString, url), "pages erialization/awesome.png"); 80 URLTestHelpers::registerMockedURLLoad(KURL(ParsedURLString, url), "pages erialization/awesome.png");
81 } 81 }
82 82
83 String serializeFile(const String& url, const String& fileName) 83 String serializeFile(const String& url, const String& fileName)
84 { 84 {
85 KURL parsedURL(ParsedURLString, url); 85 KURL parsedURL(ParsedURLString, url);
86 URLTestHelpers::registerMockedURLLoad(parsedURL, fileName, "pageserializ ation/", "text/html"); 86 URLTestHelpers::registerMockedURLLoad(parsedURL, fileName, "pageserializ ation/", "text/html");
87 FrameTestHelpers::loadFrame(mainFrameImpl(), url.utf8().data()); 87 FrameTestHelpers::loadFrame(mainFrameImpl(), url.utf8().data());
88 std::vector<std::pair<WebURL, WebString>> urlsToLocalPaths; 88 std::vector<std::pair<WebURL, WebString>> urlsToLocalPaths;
89 urlsToLocalPaths.push_back(std::make_pair(parsedURL, WebString("local")) ); 89 urlsToLocalPaths.push_back(std::make_pair(parsedURL, WebString("local")) );
90 std::vector<std::pair<WebFrame*, WebString>> framesToLocalPaths;
90 SimpleWebPageSerializerClient serializerClient; 91 SimpleWebPageSerializerClient serializerClient;
91 WebPageSerializer::serialize(mainFrameImpl(), &serializerClient, urlsToL ocalPaths); 92 WebPageSerializer::serialize(
93 mainFrameImpl(), &serializerClient, urlsToLocalPaths, framesToLocalP aths);
92 return serializerClient.toString(); 94 return serializerClient.toString();
93 } 95 }
94 96
95 WebLocalFrameImpl* mainFrameImpl() 97 WebLocalFrameImpl* mainFrameImpl()
96 { 98 {
97 return m_helper.webViewImpl()->mainFrameImpl(); 99 return m_helper.webViewImpl()->mainFrameImpl();
98 } 100 }
99 101
100 private: 102 private:
101 FrameTestHelpers::WebViewHelper m_helper; 103 FrameTestHelpers::WebViewHelper m_helper;
(...skipping 28 matching lines...) Expand all
130 EXPECT_EQ(expectedHTML, actualHTML); 132 EXPECT_EQ(expectedHTML, actualHTML);
131 } 133 }
132 134
133 TEST_F(WebPageSerializerTest, FromUrlWithMinusMinus) 135 TEST_F(WebPageSerializerTest, FromUrlWithMinusMinus)
134 { 136 {
135 String actualHTML = serializeFile("http://www.test.com?--x--", "text_only_pa ge.html"); 137 String actualHTML = serializeFile("http://www.test.com?--x--", "text_only_pa ge.html");
136 EXPECT_EQ("<!-- saved from url=(0030)http://www.test.com/?-%2Dx-%2D -->", ac tualHTML.substring(1, 60)); 138 EXPECT_EQ("<!-- saved from url=(0030)http://www.test.com/?-%2Dx-%2D -->", ac tualHTML.substring(1, 60));
137 } 139 }
138 140
139 } // namespace blink 141 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698