| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // Note that although this is not a "browser" test, it runs as part of | 5 // Note that although this is not a "browser" test, it runs as part of |
| 6 // browser_tests. This is because WebKit does not work properly if it is | 6 // browser_tests. This is because WebKit does not work properly if it is |
| 7 // shutdown and re-initialized. Since browser_tests runs each test in a | 7 // shutdown and re-initialized. Since browser_tests runs each test in a |
| 8 // new process, this avoids the problem. | 8 // new process, this avoids the problem. |
| 9 | 9 |
| 10 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" | 10 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 "/\"></iframe>" | 387 "/\"></iframe>" |
| 388 "<iframe src=\"http://host3.com:"); | 388 "<iframe src=\"http://host3.com:"); |
| 389 html += port; | 389 html += port; |
| 390 html += std::string("/\"></iframe></body></html>"); | 390 html += std::string("/\"></iframe></body></html>"); |
| 391 | 391 |
| 392 LoadHtml("host.com", html); | 392 LoadHtml("host.com", html); |
| 393 ASSERT_TRUE(ExtractFeatures(&features)); | 393 ASSERT_TRUE(ExtractFeatures(&features)); |
| 394 ExpectFeatureMapsAreEqual(features, expected_features); | 394 ExpectFeatureMapsAreEqual(features, expected_features); |
| 395 } | 395 } |
| 396 | 396 |
| 397 IN_PROC_BROWSER_TEST_F(PhishingDOMFeatureExtractorTest, Continuation) { | 397 // Test flakes with LSAN enabled. See http://crbug.com/373155. |
| 398 #if defined(LEAK_SANITIZER) |
| 399 #define MAYBE_Continuation DISABLED_Continuation |
| 400 #else |
| 401 #define MAYBE_Continuation Continuation |
| 402 #endif |
| 403 IN_PROC_BROWSER_TEST_F(PhishingDOMFeatureExtractorTest, MAYBE_Continuation) { |
| 398 // For this test, we'll cause the feature extraction to run multiple | 404 // For this test, we'll cause the feature extraction to run multiple |
| 399 // iterations by incrementing the clock. | 405 // iterations by incrementing the clock. |
| 400 | 406 |
| 401 // This page has a total of 50 elements. For the external forms feature to | 407 // This page has a total of 50 elements. For the external forms feature to |
| 402 // be computed correctly, the extractor has to examine the whole document. | 408 // be computed correctly, the extractor has to examine the whole document. |
| 403 // Note: the empty HEAD is important -- WebKit will synthesize a HEAD if | 409 // Note: the empty HEAD is important -- WebKit will synthesize a HEAD if |
| 404 // there isn't one present, which can be confusing for the element counts. | 410 // there isn't one present, which can be confusing for the element counts. |
| 405 std::string response = "<html><head></head><body>" | 411 std::string response = "<html><head></head><body>" |
| 406 "<form action=\"ondomain\"></form>"; | 412 "<form action=\"ondomain\"></form>"; |
| 407 for (int i = 0; i < 45; ++i) { | 413 for (int i = 0; i < 45; ++i) { |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 LoadHtml( | 518 LoadHtml( |
| 513 "host.com", | 519 "host.com", |
| 514 "<html><head></head><body>" | 520 "<html><head></head><body>" |
| 515 "<iframe src=\"frame.html\" id=\"frame1\"></iframe>" | 521 "<iframe src=\"frame.html\" id=\"frame1\"></iframe>" |
| 516 "<form></form></body></html>"); | 522 "<form></form></body></html>"); |
| 517 ASSERT_TRUE(ExtractFeatures(&features)); | 523 ASSERT_TRUE(ExtractFeatures(&features)); |
| 518 ExpectFeatureMapsAreEqual(features, expected_features); | 524 ExpectFeatureMapsAreEqual(features, expected_features); |
| 519 } | 525 } |
| 520 | 526 |
| 521 } // namespace safe_browsing | 527 } // namespace safe_browsing |
| OLD | NEW |