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_classifier.h" | 10 #include "chrome/renderer/safe_browsing/phishing_classifier.h" |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 | 13 |
14 #include "base/bind.h" | 14 #include "base/bind.h" |
15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
16 #include "base/string16.h" | 16 #include "base/strings/string16.h" |
17 #include "base/strings/utf_string_conversions.h" | 17 #include "base/strings/utf_string_conversions.h" |
18 #include "chrome/common/safe_browsing/client_model.pb.h" | 18 #include "chrome/common/safe_browsing/client_model.pb.h" |
19 #include "chrome/common/safe_browsing/csd.pb.h" | 19 #include "chrome/common/safe_browsing/csd.pb.h" |
20 #include "chrome/renderer/safe_browsing/features.h" | 20 #include "chrome/renderer/safe_browsing/features.h" |
21 #include "chrome/renderer/safe_browsing/mock_feature_extractor_clock.h" | 21 #include "chrome/renderer/safe_browsing/mock_feature_extractor_clock.h" |
22 #include "chrome/renderer/safe_browsing/murmurhash3_util.h" | 22 #include "chrome/renderer/safe_browsing/murmurhash3_util.h" |
23 #include "chrome/renderer/safe_browsing/scorer.h" | 23 #include "chrome/renderer/safe_browsing/scorer.h" |
24 #include "content/public/test/render_view_fake_resources_test.h" | 24 #include "content/public/test/render_view_fake_resources_test.h" |
25 #include "crypto/sha2.h" | 25 #include "crypto/sha2.h" |
26 #include "testing/gmock/include/gmock/gmock.h" | 26 #include "testing/gmock/include/gmock/gmock.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 // Now set the scorer. | 202 // Now set the scorer. |
203 classifier_->set_phishing_scorer(scorer_.get()); | 203 classifier_->set_phishing_scorer(scorer_.get()); |
204 EXPECT_TRUE(classifier_->is_ready()); | 204 EXPECT_TRUE(classifier_->is_ready()); |
205 | 205 |
206 // Set a NULL scorer, which turns detection back off. | 206 // Set a NULL scorer, which turns detection back off. |
207 classifier_->set_phishing_scorer(NULL); | 207 classifier_->set_phishing_scorer(NULL); |
208 EXPECT_FALSE(classifier_->is_ready()); | 208 EXPECT_FALSE(classifier_->is_ready()); |
209 } | 209 } |
210 | 210 |
211 } // namespace safe_browsing | 211 } // namespace safe_browsing |
OLD | NEW |