| 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 // If we set a new scorer while a classification is going on the | 433 // If we set a new scorer while a classification is going on the |
| 434 // classification should be cancelled. | 434 // classification should be cancelled. |
| 435 EXPECT_CALL(*classifier_, CancelPendingClassification()); | 435 EXPECT_CALL(*classifier_, CancelPendingClassification()); |
| 436 delegate_->SetPhishingScorer(&scorer); | 436 delegate_->SetPhishingScorer(&scorer); |
| 437 Mock::VerifyAndClearExpectations(classifier_); | 437 Mock::VerifyAndClearExpectations(classifier_); |
| 438 | 438 |
| 439 // The delegate will cancel pending classification on destruction. | 439 // The delegate will cancel pending classification on destruction. |
| 440 EXPECT_CALL(*classifier_, CancelPendingClassification()); | 440 EXPECT_CALL(*classifier_, CancelPendingClassification()); |
| 441 } | 441 } |
| 442 | 442 |
| 443 IN_PROC_BROWSER_TEST_F(PhishingClassifierDelegateTest, NoScorer_Ref) { | 443 // Flaky: crbug.com/435719 |
| 444 #if defined(LEAK_SANITIZER) |
| 445 #define MAYBE_NoScorer_Ref DISABLED_NoScorer_Ref |
| 446 #else |
| 447 #define MAYBE_NoScorer_Ref NoScorer_Ref |
| 448 #endif |
| 449 |
| 450 IN_PROC_BROWSER_TEST_F(PhishingClassifierDelegateTest, MAYBE_NoScorer_Ref) { |
| 444 // Similar to the last test, but navigates within the page before | 451 // Similar to the last test, but navigates within the page before |
| 445 // setting the scorer. | 452 // setting the scorer. |
| 446 ASSERT_FALSE(classifier_->is_ready()); | 453 ASSERT_FALSE(classifier_->is_ready()); |
| 447 | 454 |
| 448 // Queue up a pending classification, cancel it, then queue up another one. | 455 // Queue up a pending classification, cancel it, then queue up another one. |
| 449 GURL url = LoadHtml("host.com", "dummy"); | 456 GURL url = LoadHtml("host.com", "dummy"); |
| 450 base::string16 page_text = ASCIIToUTF16("dummy"); | 457 base::string16 page_text = ASCIIToUTF16("dummy"); |
| 451 OnStartPhishingDetection(url); | 458 OnStartPhishingDetection(url); |
| 452 PageCaptured(&page_text, false); | 459 PageCaptured(&page_text, false); |
| 453 | 460 |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 RunClassificationDone(verdict); | 651 RunClassificationDone(verdict); |
| 645 ASSERT_TRUE(intercepting_filter_->verdict()); | 652 ASSERT_TRUE(intercepting_filter_->verdict()); |
| 646 EXPECT_EQ(verdict.SerializeAsString(), | 653 EXPECT_EQ(verdict.SerializeAsString(), |
| 647 intercepting_filter_->verdict()->SerializeAsString()); | 654 intercepting_filter_->verdict()->SerializeAsString()); |
| 648 | 655 |
| 649 // The delegate will cancel pending classification on destruction. | 656 // The delegate will cancel pending classification on destruction. |
| 650 EXPECT_CALL(*classifier_, CancelPendingClassification()); | 657 EXPECT_CALL(*classifier_, CancelPendingClassification()); |
| 651 } | 658 } |
| 652 | 659 |
| 653 } // namespace safe_browsing | 660 } // namespace safe_browsing |
| OLD | NEW |