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 <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 : BrowserMessageFilter(SafeBrowsingMsgStart), | 89 : BrowserMessageFilter(SafeBrowsingMsgStart), |
90 waiting_message_loop_(NULL) { | 90 waiting_message_loop_(NULL) { |
91 } | 91 } |
92 | 92 |
93 const ClientPhishingRequest* verdict() const { return verdict_.get(); } | 93 const ClientPhishingRequest* verdict() const { return verdict_.get(); } |
94 bool OnMessageReceived(const IPC::Message& message) override { | 94 bool OnMessageReceived(const IPC::Message& message) override { |
95 bool handled = true; | 95 bool handled = true; |
96 IPC_BEGIN_MESSAGE_MAP(InterceptingMessageFilter, message) | 96 IPC_BEGIN_MESSAGE_MAP(InterceptingMessageFilter, message) |
97 IPC_MESSAGE_HANDLER(SafeBrowsingHostMsg_PhishingDetectionDone, | 97 IPC_MESSAGE_HANDLER(SafeBrowsingHostMsg_PhishingDetectionDone, |
98 OnPhishingDetectionDone) | 98 OnPhishingDetectionDone) |
99 IPC_MESSAGE_UNHANDLED(handled = false); | 99 IPC_MESSAGE_UNHANDLED(handled = false) |
100 IPC_END_MESSAGE_MAP() | 100 IPC_END_MESSAGE_MAP() |
101 return handled; | 101 return handled; |
102 } | 102 } |
103 | 103 |
104 void Reset() { | 104 void Reset() { |
105 run_loop_.reset(new base::RunLoop()); | 105 run_loop_.reset(new base::RunLoop()); |
106 waiting_message_loop_ = base::MessageLoop::current(); | 106 waiting_message_loop_ = base::MessageLoop::current(); |
107 quit_closure_ = run_loop_->QuitClosure(); | 107 quit_closure_ = run_loop_->QuitClosure(); |
108 } | 108 } |
109 | 109 |
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 RunClassificationDone(verdict); | 648 RunClassificationDone(verdict); |
649 ASSERT_TRUE(intercepting_filter_->verdict()); | 649 ASSERT_TRUE(intercepting_filter_->verdict()); |
650 EXPECT_EQ(verdict.SerializeAsString(), | 650 EXPECT_EQ(verdict.SerializeAsString(), |
651 intercepting_filter_->verdict()->SerializeAsString()); | 651 intercepting_filter_->verdict()->SerializeAsString()); |
652 | 652 |
653 // The delegate will cancel pending classification on destruction. | 653 // The delegate will cancel pending classification on destruction. |
654 EXPECT_CALL(*classifier_, CancelPendingClassification()); | 654 EXPECT_CALL(*classifier_, CancelPendingClassification()); |
655 } | 655 } |
656 | 656 |
657 } // namespace safe_browsing | 657 } // namespace safe_browsing |
OLD | NEW |