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_dom_feature_extractor.h" | 5 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 return client; | 205 return client; |
206 } | 206 } |
207 | 207 |
208 void AnotherExtractionDone(bool success) { | 208 void AnotherExtractionDone(bool success) { |
209 success_ = success; | 209 success_ = success; |
210 message_loop_->QuitClosure().Run(); | 210 message_loop_->QuitClosure().Run(); |
211 } | 211 } |
212 | 212 |
213 // Does the actual work of removing the iframe "frame1" from the document. | 213 // Does the actual work of removing the iframe "frame1" from the document. |
214 void RemoveIframe() { | 214 void RemoveIframe() { |
215 blink::WebFrame* main_frame = GetMainFrame(); | 215 blink::WebLocalFrame* main_frame = GetMainFrame(); |
216 ASSERT_TRUE(main_frame); | 216 ASSERT_TRUE(main_frame); |
217 main_frame->ExecuteScript(blink::WebString( | 217 main_frame->ExecuteScript(blink::WebString( |
218 "document.body.removeChild(document.getElementById('frame1'));")); | 218 "document.body.removeChild(document.getElementById('frame1'));")); |
219 } | 219 } |
220 | 220 |
221 MockFeatureExtractorClock clock_; | 221 MockFeatureExtractorClock clock_; |
222 bool success_; | 222 bool success_; |
223 std::unique_ptr<TestPhishingDOMFeatureExtractor> extractor_; | 223 std::unique_ptr<TestPhishingDOMFeatureExtractor> extractor_; |
224 scoped_refptr<content::MessageLoopRunner> message_loop_; | 224 scoped_refptr<content::MessageLoopRunner> message_loop_; |
225 base::WeakPtrFactory<PhishingDOMFeatureExtractorTest> weak_factory_; | 225 base::WeakPtrFactory<PhishingDOMFeatureExtractorTest> weak_factory_; |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 "<html><head></head><body>" | 569 "<html><head></head><body>" |
570 "<iframe src=\"" + | 570 "<iframe src=\"" + |
571 net::EscapeForHTML(iframe1_url.spec()) + | 571 net::EscapeForHTML(iframe1_url.spec()) + |
572 "\" id=\"frame1\"></iframe>" | 572 "\" id=\"frame1\"></iframe>" |
573 "<form></form></body></html>"); | 573 "<form></form></body></html>"); |
574 ExtractFeatures("host.com", html, &features); | 574 ExtractFeatures("host.com", html, &features); |
575 ExpectFeatureMapsAreEqual(features, expected_features); | 575 ExpectFeatureMapsAreEqual(features, expected_features); |
576 } | 576 } |
577 | 577 |
578 } // namespace safe_browsing | 578 } // namespace safe_browsing |
OLD | NEW |