OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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: this test uses RenderViewFakeResourcesTest in order to set up a | 5 // Note: this test uses RenderViewFakeResourcesTest in order to set up a |
6 // real RenderThread to hold the phishing Scorer object. | 6 // real RenderThread to hold the phishing Scorer object. |
7 | 7 |
8 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" | 8 #include "chrome/renderer/safe_browsing/phishing_classifier_delegate.h" |
9 | 9 |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
215 OnStartPhishingDetection(delegate, GURL("http://host.com/#foo2")); | 215 OnStartPhishingDetection(delegate, GURL("http://host.com/#foo2")); |
216 page_text = ASCIIToUTF16("dummy"); | 216 page_text = ASCIIToUTF16("dummy"); |
217 EXPECT_CALL(*classifier, CancelPendingClassification()); | 217 EXPECT_CALL(*classifier, CancelPendingClassification()); |
218 delegate->PageCaptured(&page_text, false); | 218 delegate->PageCaptured(&page_text, false); |
219 Mock::VerifyAndClearExpectations(classifier); | 219 Mock::VerifyAndClearExpectations(classifier); |
220 | 220 |
221 // The delegate will cancel pending classification on destruction. | 221 // The delegate will cancel pending classification on destruction. |
222 EXPECT_CALL(*classifier, CancelPendingClassification()); | 222 EXPECT_CALL(*classifier, CancelPendingClassification()); |
223 } | 223 } |
224 | 224 |
225 TEST_F(PhishingClassifierDelegateTest, NoScorer) { | 225 TEST_F(PhishingClassifierDelegateTest, DISABLED_NoScorer) { |
226 // For this test, we'll create the delegate with no scorer available yet. | 226 // For this test, we'll create the delegate with no scorer available yet. |
227 MockPhishingClassifier* classifier = | 227 MockPhishingClassifier* classifier = |
228 new StrictMock<MockPhishingClassifier>(view()); | 228 new StrictMock<MockPhishingClassifier>(view()); |
229 PhishingClassifierDelegate* delegate = | 229 PhishingClassifierDelegate* delegate = |
230 PhishingClassifierDelegate::Create(view(), classifier); | 230 PhishingClassifierDelegate::Create(view(), classifier); |
231 ASSERT_FALSE(classifier->is_ready()); | 231 ASSERT_FALSE(classifier->is_ready()); |
232 | 232 |
233 // Queue up a pending classification, cancel it, then queue up another one. | 233 // Queue up a pending classification, cancel it, then queue up another one. |
234 LoadURL("http://host.com/"); | 234 LoadURL("http://host.com/"); |
235 string16 page_text = ASCIIToUTF16("dummy"); | 235 string16 page_text = ASCIIToUTF16("dummy"); |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 verdict.set_is_phishing(false); // Send IPC even if site is not phishing. | 463 verdict.set_is_phishing(false); // Send IPC even if site is not phishing. |
464 RunClassificationDone(delegate, verdict); | 464 RunClassificationDone(delegate, verdict); |
465 ASSERT_TRUE(verdict_.get()); | 465 ASSERT_TRUE(verdict_.get()); |
466 EXPECT_EQ(verdict.SerializeAsString(), verdict_->SerializeAsString()); | 466 EXPECT_EQ(verdict.SerializeAsString(), verdict_->SerializeAsString()); |
467 | 467 |
468 // The delegate will cancel pending classification on destruction. | 468 // The delegate will cancel pending classification on destruction. |
469 EXPECT_CALL(*classifier, CancelPendingClassification()); | 469 EXPECT_CALL(*classifier, CancelPendingClassification()); |
470 } | 470 } |
471 | 471 |
472 } // namespace safe_browsing | 472 } // namespace safe_browsing |
OLD | NEW |