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 // Note that although this is not a "browser" test, it runs as part of | 5 // Note that although this is not a "browser" test, it runs as part of |
6 // browser_tests. This is because WebKit does not work properly if it is | 6 // browser_tests. This is because WebKit does not work properly if it is |
7 // shutdown and re-initialized. Since browser_tests runs each test in a | 7 // shutdown and re-initialized. Since browser_tests runs each test in a |
8 // new process, this avoids the problem. | 8 // new process, this avoids the problem. |
9 | 9 |
10 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" | 10 #include "chrome/renderer/safe_browsing/phishing_dom_feature_extractor.h" |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/callback.h" | 13 #include "base/callback.h" |
14 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/message_loop.h" | 16 #include "base/message_loop.h" |
17 #include "base/time.h" | 17 #include "base/time.h" |
18 #include "chrome/renderer/safe_browsing/features.h" | 18 #include "chrome/renderer/safe_browsing/features.h" |
19 #include "chrome/renderer/safe_browsing/mock_feature_extractor_clock.h" | 19 #include "chrome/renderer/safe_browsing/mock_feature_extractor_clock.h" |
20 #include "chrome/renderer/safe_browsing/test_utils.h" | 20 #include "chrome/renderer/safe_browsing/test_utils.h" |
21 #include "content/public/test/render_view_fake_resources_test.h" | 21 #include "content/public/test/render_view_fake_resources_test.h" |
22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
23 #include "third_party/WebKit/Source/Platform/chromium/public/WebString.h" | 23 #include "third_party/WebKit/public/platform/WebString.h" |
24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 24 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" | 25 #include "third_party/WebKit/Source/WebKit/chromium/public/WebScriptSource.h" |
26 | 26 |
27 using ::testing::DoAll; | 27 using ::testing::DoAll; |
28 using ::testing::Invoke; | 28 using ::testing::Invoke; |
29 using ::testing::Return; | 29 using ::testing::Return; |
30 | 30 |
31 namespace safe_browsing { | 31 namespace safe_browsing { |
32 | 32 |
33 class PhishingDOMFeatureExtractorTest | 33 class PhishingDOMFeatureExtractorTest |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
394 expected_features.AddBooleanFeature(features::kPageHasForms); | 394 expected_features.AddBooleanFeature(features::kPageHasForms); |
395 expected_features.AddBooleanFeature(features::kPageHasPswdInputs); | 395 expected_features.AddBooleanFeature(features::kPageHasPswdInputs); |
396 | 396 |
397 FeatureMap features; | 397 FeatureMap features; |
398 LoadURL("http://host.com/"); | 398 LoadURL("http://host.com/"); |
399 ASSERT_TRUE(ExtractFeatures(&features)); | 399 ASSERT_TRUE(ExtractFeatures(&features)); |
400 ExpectFeatureMapsAreEqual(features, expected_features); | 400 ExpectFeatureMapsAreEqual(features, expected_features); |
401 } | 401 } |
402 | 402 |
403 } // namespace safe_browsing | 403 } // namespace safe_browsing |
OLD | NEW |