| OLD | NEW |
| 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 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 | 296 |
| 297 // These non-scripting attributes should remain intact. | 297 // These non-scripting attributes should remain intact. |
| 298 EXPECT_NE(WTF::kNotFound, mhtml.Find("class=")); | 298 EXPECT_NE(WTF::kNotFound, mhtml.Find("class=")); |
| 299 EXPECT_NE(WTF::kNotFound, mhtml.Find("id=")); | 299 EXPECT_NE(WTF::kNotFound, mhtml.Find("id=")); |
| 300 | 300 |
| 301 // srcdoc attribute of frame element should be replaced with src attribute. | 301 // srcdoc attribute of frame element should be replaced with src attribute. |
| 302 EXPECT_EQ(WTF::kNotFound, mhtml.Find("srcdoc=")); | 302 EXPECT_EQ(WTF::kNotFound, mhtml.Find("srcdoc=")); |
| 303 EXPECT_NE(WTF::kNotFound, mhtml.Find("src=")); | 303 EXPECT_NE(WTF::kNotFound, mhtml.Find("src=")); |
| 304 } | 304 } |
| 305 | 305 |
| 306 TEST_F(WebFrameSerializerSanitizationTest, RemoveOtherAttributes) { |
| 307 String mhtml = |
| 308 GenerateMHTMLFromHtml("http://www.test.com", "remove_attributes.html"); |
| 309 EXPECT_EQ(WTF::kNotFound, mhtml.Find("ping=")); |
| 310 } |
| 311 |
| 306 TEST_F(WebFrameSerializerSanitizationTest, DisableFormElements) { | 312 TEST_F(WebFrameSerializerSanitizationTest, DisableFormElements) { |
| 307 String mhtml = GenerateMHTMLFromHtml("http://www.test.com", "form.html"); | 313 String mhtml = GenerateMHTMLFromHtml("http://www.test.com", "form.html"); |
| 308 | 314 |
| 309 const char kDisabledAttr[] = "disabled=3D\"\""; | 315 const char kDisabledAttr[] = "disabled=3D\"\""; |
| 310 int matches = | 316 int matches = |
| 311 MatchSubstring(mhtml, kDisabledAttr, arraysize(kDisabledAttr) - 1); | 317 MatchSubstring(mhtml, kDisabledAttr, arraysize(kDisabledAttr) - 1); |
| 312 EXPECT_EQ(21, matches); | 318 EXPECT_EQ(21, matches); |
| 313 } | 319 } |
| 314 | 320 |
| 315 TEST_F(WebFrameSerializerSanitizationTest, RemoveHiddenElements) { | 321 TEST_F(WebFrameSerializerSanitizationTest, RemoveHiddenElements) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 mhtml.Find("<meta http-equiv=3D\"Content-Security-Policy")); | 448 mhtml.Find("<meta http-equiv=3D\"Content-Security-Policy")); |
| 443 EXPECT_NE(WTF::kNotFound, mhtml.Find("<meta name=3D\"description")); | 449 EXPECT_NE(WTF::kNotFound, mhtml.Find("<meta name=3D\"description")); |
| 444 EXPECT_NE(WTF::kNotFound, mhtml.Find("<meta http-equiv=3D\"refresh")); | 450 EXPECT_NE(WTF::kNotFound, mhtml.Find("<meta http-equiv=3D\"refresh")); |
| 445 | 451 |
| 446 // If an element is removed, its children should also be skipped. | 452 // If an element is removed, its children should also be skipped. |
| 447 EXPECT_EQ(WTF::kNotFound, mhtml.Find("<select")); | 453 EXPECT_EQ(WTF::kNotFound, mhtml.Find("<select")); |
| 448 EXPECT_EQ(WTF::kNotFound, mhtml.Find("<option")); | 454 EXPECT_EQ(WTF::kNotFound, mhtml.Find("<option")); |
| 449 } | 455 } |
| 450 | 456 |
| 451 } // namespace blink | 457 } // namespace blink |
| OLD | NEW |