Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(852)

Side by Side Diff: chrome/renderer/safe_browsing/phishing_classifier_delegate_browsertest.cc

Issue 5978003: Make IPC::Channel::Listener:OnMessageReceived have a return value indicating ... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/scoped_ptr.h" 10 #include "base/scoped_ptr.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 52
53 MOCK_METHOD1(ComputeScore, double(const FeatureMap&)); 53 MOCK_METHOD1(ComputeScore, double(const FeatureMap&));
54 54
55 private: 55 private:
56 DISALLOW_COPY_AND_ASSIGN(MockScorer); 56 DISALLOW_COPY_AND_ASSIGN(MockScorer);
57 }; 57 };
58 } // namespace 58 } // namespace
59 59
60 class PhishingClassifierDelegateTest : public RenderViewFakeResourcesTest { 60 class PhishingClassifierDelegateTest : public RenderViewFakeResourcesTest {
61 protected: 61 protected:
62 void OnMessageReceived(const IPC::Message& message) { 62 bool OnMessageReceived(const IPC::Message& message) {
63 bool handled = true;
63 IPC_BEGIN_MESSAGE_MAP(PhishingClassifierDelegateTest, message) 64 IPC_BEGIN_MESSAGE_MAP(PhishingClassifierDelegateTest, message)
64 IPC_MESSAGE_HANDLER(ViewHostMsg_DetectedPhishingSite, 65 IPC_MESSAGE_HANDLER(ViewHostMsg_DetectedPhishingSite,
65 OnDetectedPhishingSite) 66 OnDetectedPhishingSite)
66 IPC_MESSAGE_UNHANDLED( 67 IPC_MESSAGE_UNHANDLED(
67 RenderViewFakeResourcesTest::OnMessageReceived(message)) 68 handled = RenderViewFakeResourcesTest::OnMessageReceived(message))
68 IPC_END_MESSAGE_MAP() 69 IPC_END_MESSAGE_MAP()
70 return handled;
69 } 71 }
70 72
71 void OnDetectedPhishingSite(GURL phishing_url, 73 void OnDetectedPhishingSite(GURL phishing_url,
72 double phishing_score, 74 double phishing_score,
73 SkBitmap thumbnail) { 75 SkBitmap thumbnail) {
74 detected_phishing_site_ = true; 76 detected_phishing_site_ = true;
75 detected_url_ = phishing_url; 77 detected_url_ = phishing_url;
76 detected_score_ = phishing_score; 78 detected_score_ = phishing_score;
77 detected_thumbnail_ = thumbnail; 79 detected_thumbnail_ = thumbnail;
78 message_loop_.Quit(); 80 message_loop_.Quit();
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 EXPECT_TRUE(detected_phishing_site_); 254 EXPECT_TRUE(detected_phishing_site_);
253 EXPECT_EQ(GURL("http://host.com/"), detected_url_); 255 EXPECT_EQ(GURL("http://host.com/"), detected_url_);
254 EXPECT_EQ(0.8, detected_score_); 256 EXPECT_EQ(0.8, detected_score_);
255 EXPECT_FALSE(detected_thumbnail_.isNull()); 257 EXPECT_FALSE(detected_thumbnail_.isNull());
256 258
257 // The delegate will cancel pending classification on destruction. 259 // The delegate will cancel pending classification on destruction.
258 EXPECT_CALL(*classifier, CancelPendingClassification()); 260 EXPECT_CALL(*classifier, CancelPendingClassification());
259 } 261 }
260 262
261 } // namespace safe_browsing 263 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/renderer/renderer_main_unittest.cc ('k') | chrome/renderer/safe_browsing/render_view_fake_resources_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698