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

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

Issue 630603003: Replacing the OVERRIDE with override in chrome/renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased the patch Created 6 years, 2 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
OLDNEW
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.h" 5 #include "chrome/renderer/safe_browsing/phishing_classifier.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 44
45 class PhishingClassifierTest : public InProcessBrowserTest { 45 class PhishingClassifierTest : public InProcessBrowserTest {
46 protected: 46 protected:
47 PhishingClassifierTest() 47 PhishingClassifierTest()
48 : url_tld_token_net_(features::kUrlTldToken + std::string("net")), 48 : url_tld_token_net_(features::kUrlTldToken + std::string("net")),
49 page_link_domain_phishing_(features::kPageLinkDomain + 49 page_link_domain_phishing_(features::kPageLinkDomain +
50 std::string("phishing.com")), 50 std::string("phishing.com")),
51 page_term_login_(features::kPageTerm + std::string("login")) { 51 page_term_login_(features::kPageTerm + std::string("login")) {
52 } 52 }
53 53
54 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { 54 virtual void SetUpCommandLine(CommandLine* command_line) override {
55 command_line->AppendSwitch(switches::kSingleProcess); 55 command_line->AppendSwitch(switches::kSingleProcess);
56 #if defined(OS_WIN) 56 #if defined(OS_WIN)
57 // Don't want to try to create a GPU process. 57 // Don't want to try to create a GPU process.
58 command_line->AppendSwitch(switches::kDisableGpu); 58 command_line->AppendSwitch(switches::kDisableGpu);
59 #endif 59 #endif
60 } 60 }
61 61
62 virtual void SetUpOnMainThread() OVERRIDE { 62 virtual void SetUpOnMainThread() override {
63 // Construct a model to test with. We include one feature from each of 63 // Construct a model to test with. We include one feature from each of
64 // the feature extractors, which allows us to verify that they all ran. 64 // the feature extractors, which allows us to verify that they all ran.
65 ClientSideModel model; 65 ClientSideModel model;
66 66
67 model.add_hashes(crypto::SHA256HashString(url_tld_token_net_)); 67 model.add_hashes(crypto::SHA256HashString(url_tld_token_net_));
68 model.add_hashes(crypto::SHA256HashString(page_link_domain_phishing_)); 68 model.add_hashes(crypto::SHA256HashString(page_link_domain_phishing_));
69 model.add_hashes(crypto::SHA256HashString(page_term_login_)); 69 model.add_hashes(crypto::SHA256HashString(page_term_login_));
70 model.add_hashes(crypto::SHA256HashString("login")); 70 model.add_hashes(crypto::SHA256HashString("login"));
71 model.add_hashes(crypto::SHA256HashString(features::kUrlTldToken + 71 model.add_hashes(crypto::SHA256HashString(features::kUrlTldToken +
72 std::string("net"))); 72 std::string("net")));
(...skipping 25 matching lines...) Expand all
98 98
99 clock_ = new MockFeatureExtractorClock; 99 clock_ = new MockFeatureExtractorClock;
100 scorer_.reset(Scorer::Create(model.SerializeAsString())); 100 scorer_.reset(Scorer::Create(model.SerializeAsString()));
101 ASSERT_TRUE(scorer_.get()); 101 ASSERT_TRUE(scorer_.get());
102 102
103 classifier_.reset(new PhishingClassifier( 103 classifier_.reset(new PhishingClassifier(
104 content::RenderView::FromRoutingID(kRenderViewRoutingId), 104 content::RenderView::FromRoutingID(kRenderViewRoutingId),
105 clock_)); 105 clock_));
106 } 106 }
107 107
108 virtual void TearDownOnMainThread() OVERRIDE { 108 virtual void TearDownOnMainThread() override {
109 content::RunAllPendingInMessageLoop(); 109 content::RunAllPendingInMessageLoop();
110 } 110 }
111 111
112 // Helper method to start phishing classification and wait for it to 112 // Helper method to start phishing classification and wait for it to
113 // complete. Returns the true if the page is classified as phishy and 113 // complete. Returns the true if the page is classified as phishy and
114 // false otherwise. 114 // false otherwise.
115 bool RunPhishingClassifier(const base::string16* page_text, 115 bool RunPhishingClassifier(const base::string16* page_text,
116 float* phishy_score, 116 float* phishy_score,
117 FeatureMap* features) { 117 FeatureMap* features) {
118 ClientPhishingRequest verdict; 118 ClientPhishingRequest verdict;
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 // Now set the scorer. 296 // Now set the scorer.
297 classifier_->set_phishing_scorer(scorer_.get()); 297 classifier_->set_phishing_scorer(scorer_.get());
298 EXPECT_TRUE(classifier_->is_ready()); 298 EXPECT_TRUE(classifier_->is_ready());
299 299
300 // Set a NULL scorer, which turns detection back off. 300 // Set a NULL scorer, which turns detection back off.
301 classifier_->set_phishing_scorer(NULL); 301 classifier_->set_phishing_scorer(NULL);
302 EXPECT_FALSE(classifier_->is_ready()); 302 EXPECT_FALSE(classifier_->is_ready());
303 } 303 }
304 304
305 } // namespace safe_browsing 305 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « chrome/renderer/safe_browsing/malware_dom_details.h ('k') | chrome/renderer/safe_browsing/phishing_classifier_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698