| 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 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" | 5 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 532 EXPECT_CALL(*classifier_, CancelPendingClassification()); | 532 EXPECT_CALL(*classifier_, CancelPendingClassification()); |
| 533 EXPECT_CALL(*classifier_, BeginClassification(Pointee(page_text), _)); | 533 EXPECT_CALL(*classifier_, BeginClassification(Pointee(page_text), _)); |
| 534 PageCaptured(&page_text, false); | 534 PageCaptured(&page_text, false); |
| 535 Mock::VerifyAndClearExpectations(classifier_); | 535 Mock::VerifyAndClearExpectations(classifier_); |
| 536 } | 536 } |
| 537 | 537 |
| 538 // The delegate will cancel pending classification on destruction. | 538 // The delegate will cancel pending classification on destruction. |
| 539 EXPECT_CALL(*classifier_, CancelPendingClassification()); | 539 EXPECT_CALL(*classifier_, CancelPendingClassification()); |
| 540 } | 540 } |
| 541 | 541 |
| 542 // Test flakes with LSAN enabled. See http://crbug.com/373155. |
| 543 #if defined(LEAK_SANITIZER) |
| 544 #define MAYBE_IgnorePreliminaryCapture DISABLED_IgnorePreliminaryCapture |
| 545 #else |
| 546 #define MAYBE_IgnorePreliminaryCapture IgnorePreliminaryCapture |
| 547 #endif |
| 542 IN_PROC_BROWSER_TEST_F(PhishingClassifierDelegateTest, | 548 IN_PROC_BROWSER_TEST_F(PhishingClassifierDelegateTest, |
| 543 IgnorePreliminaryCapture) { | 549 MAYBE_IgnorePreliminaryCapture) { |
| 544 // Tests that preliminary PageCaptured notifications are ignored. | 550 // Tests that preliminary PageCaptured notifications are ignored. |
| 545 MockScorer scorer; | 551 MockScorer scorer; |
| 546 delegate_->SetPhishingScorer(&scorer); | 552 delegate_->SetPhishingScorer(&scorer); |
| 547 ASSERT_TRUE(classifier_->is_ready()); | 553 ASSERT_TRUE(classifier_->is_ready()); |
| 548 | 554 |
| 549 EXPECT_CALL(*classifier_, CancelPendingClassification()); | 555 EXPECT_CALL(*classifier_, CancelPendingClassification()); |
| 550 GURL url = LoadHtml("host.com", "<html><body>phish</body></html>"); | 556 GURL url = LoadHtml("host.com", "<html><body>phish</body></html>"); |
| 551 Mock::VerifyAndClearExpectations(classifier_); | 557 Mock::VerifyAndClearExpectations(classifier_); |
| 552 OnStartPhishingDetection(url); | 558 OnStartPhishingDetection(url); |
| 553 base::string16 page_text = ASCIIToUTF16("phish"); | 559 base::string16 page_text = ASCIIToUTF16("phish"); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 RunClassificationDone(verdict); | 637 RunClassificationDone(verdict); |
| 632 ASSERT_TRUE(intercepting_filter_->verdict()); | 638 ASSERT_TRUE(intercepting_filter_->verdict()); |
| 633 EXPECT_EQ(verdict.SerializeAsString(), | 639 EXPECT_EQ(verdict.SerializeAsString(), |
| 634 intercepting_filter_->verdict()->SerializeAsString()); | 640 intercepting_filter_->verdict()->SerializeAsString()); |
| 635 | 641 |
| 636 // The delegate will cancel pending classification on destruction. | 642 // The delegate will cancel pending classification on destruction. |
| 637 EXPECT_CALL(*classifier_, CancelPendingClassification()); | 643 EXPECT_CALL(*classifier_, CancelPendingClassification()); |
| 638 } | 644 } |
| 639 | 645 |
| 640 } // namespace safe_browsing | 646 } // namespace safe_browsing |
| OLD | NEW |