| 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 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 webView()->resize(WebSize(500, 500)); | 361 webView()->resize(WebSize(500, 500)); |
| 362 setRemovePopupOverlay(false); | 362 setRemovePopupOverlay(false); |
| 363 String mhtml = generateMHTMLParts("http://www.test.com", "popup.html"); | 363 String mhtml = generateMHTMLParts("http://www.test.com", "popup.html"); |
| 364 EXPECT_NE(WTF::kNotFound, mhtml.find("class=3D\"overlay")); | 364 EXPECT_NE(WTF::kNotFound, mhtml.find("class=3D\"overlay")); |
| 365 EXPECT_NE(WTF::kNotFound, mhtml.find("class=3D\"modal")); | 365 EXPECT_NE(WTF::kNotFound, mhtml.find("class=3D\"modal")); |
| 366 } | 366 } |
| 367 | 367 |
| 368 TEST_F(WebFrameSerializerSanitizationTest, RemoveElements) { | 368 TEST_F(WebFrameSerializerSanitizationTest, RemoveElements) { |
| 369 String mhtml = | 369 String mhtml = |
| 370 generateMHTMLParts("http://www.test.com", "remove_elements.html"); | 370 generateMHTMLParts("http://www.test.com", "remove_elements.html"); |
| 371 LOG(ERROR) << mhtml; |
| 371 | 372 |
| 372 EXPECT_EQ(WTF::kNotFound, mhtml.find("<script")); | 373 EXPECT_EQ(WTF::kNotFound, mhtml.find("<script")); |
| 373 EXPECT_EQ(WTF::kNotFound, mhtml.find("<noscript")); | 374 EXPECT_EQ(WTF::kNotFound, mhtml.find("<noscript")); |
| 374 | 375 |
| 376 // Only the meta element containing "Content-Security-Policy" is removed. |
| 377 // Other meta elements should be preserved. |
| 378 EXPECT_EQ(WTF::kNotFound, |
| 379 mhtml.find("<meta http-equiv=3D\"Content-Security-Policy")); |
| 380 EXPECT_NE(WTF::kNotFound, mhtml.find("<meta name=3D\"description")); |
| 381 EXPECT_NE(WTF::kNotFound, mhtml.find("<meta http-equiv=3D\"refresh")); |
| 382 |
| 375 // If an element is removed, its children should also be skipped. | 383 // If an element is removed, its children should also be skipped. |
| 376 EXPECT_EQ(WTF::kNotFound, mhtml.find("<select")); | 384 EXPECT_EQ(WTF::kNotFound, mhtml.find("<select")); |
| 377 EXPECT_EQ(WTF::kNotFound, mhtml.find("<option")); | 385 EXPECT_EQ(WTF::kNotFound, mhtml.find("<option")); |
| 378 } | 386 } |
| 379 | 387 |
| 380 } // namespace blink | 388 } // namespace blink |
| OLD | NEW |