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

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

Issue 2560693002: Disable form elements in MHTML (Closed)
Patch Set: Address feedback Created 4 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 213
214 // These non-scripting attributes should remain intact. 214 // These non-scripting attributes should remain intact.
215 EXPECT_NE(WTF::kNotFound, mhtml.find("class=")); 215 EXPECT_NE(WTF::kNotFound, mhtml.find("class="));
216 EXPECT_NE(WTF::kNotFound, mhtml.find("id=")); 216 EXPECT_NE(WTF::kNotFound, mhtml.find("id="));
217 217
218 // srcdoc attribute of frame element should be replaced with src attribute. 218 // srcdoc attribute of frame element should be replaced with src attribute.
219 EXPECT_EQ(WTF::kNotFound, mhtml.find("srcdoc=")); 219 EXPECT_EQ(WTF::kNotFound, mhtml.find("srcdoc="));
220 EXPECT_NE(WTF::kNotFound, mhtml.find("src=")); 220 EXPECT_NE(WTF::kNotFound, mhtml.find("src="));
221 } 221 }
222 222
223 TEST_F(WebFrameSerializerSanitizationTest, DisableFormElements) {
224 String mhtml = generateMHTMLParts("http://www.test.com", "form.html");
225
226 int matches = 0;
227 size_t start = 0;
228 while (true) {
229 const char kDisabledAttr[] = "disabled=3D\"\"";
230 size_t pos = mhtml.find(kDisabledAttr, start);
231 if (pos == WTF::kNotFound)
232 break;
233 matches++;
234 start = pos + arraysize(kDisabledAttr) - 1;
235 }
236 EXPECT_EQ(21, matches);
237 }
238
223 } // namespace blink 239 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698