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

Side by Side Diff: chrome/browser/safe_browsing/safe_browsing_service_browsertest.cc

Issue 2886043002: Refrain from sending hit report when user is in incognito mode (Closed)
Patch Set: fixed comment typo Created 3 years, 7 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 // This test creates a safebrowsing service using test safebrowsing database 5 // This test creates a safebrowsing service using test safebrowsing database
6 // and a test protocol manager. It is used to test logics in safebrowsing 6 // and a test protocol manager. It is used to test logics in safebrowsing
7 // service. 7 // service.
8 8
9 #include "chrome/browser/safe_browsing/safe_browsing_service.h" 9 #include "chrome/browser/safe_browsing/safe_browsing_service.h"
10 10
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 config.url_prefix = url_prefix; 145 config.url_prefix = url_prefix;
146 // Makes sure the auto update is not triggered. The tests will force the 146 // Makes sure the auto update is not triggered. The tests will force the
147 // update when needed. 147 // update when needed.
148 config.disable_auto_update = true; 148 config.disable_auto_update = true;
149 config.client_name = "browser_tests"; 149 config.client_name = "browser_tests";
150 factory->SetTestProtocolConfig(config); 150 factory->SetTestProtocolConfig(config);
151 } 151 }
152 152
153 class FakeSafeBrowsingUIManager : public TestSafeBrowsingUIManager { 153 class FakeSafeBrowsingUIManager : public TestSafeBrowsingUIManager {
154 public: 154 public:
155 void MaybeReportSafeBrowsingHit( 155 void MaybeReportSafeBrowsingHit(const safe_browsing::HitReport& hit_report,
156 const safe_browsing::HitReport& hit_report) override { 156 content::WebContents* web_contents) override {
157 EXPECT_FALSE(got_hit_report_); 157 EXPECT_FALSE(got_hit_report_);
158 got_hit_report_ = true; 158 got_hit_report_ = true;
159 hit_report_ = hit_report; 159 hit_report_ = hit_report;
160 SafeBrowsingUIManager::MaybeReportSafeBrowsingHit(hit_report); 160 SafeBrowsingUIManager::MaybeReportSafeBrowsingHit(hit_report, web_contents);
161 } 161 }
162 162
163 bool got_hit_report_ = false; 163 bool got_hit_report_ = false;
164 safe_browsing::HitReport hit_report_; 164 safe_browsing::HitReport hit_report_;
165 165
166 private: 166 private:
167 ~FakeSafeBrowsingUIManager() override {} 167 ~FakeSafeBrowsingUIManager() override {}
168 }; 168 };
169 169
170 // A SafeBrowingDatabase class that allows us to inject the malicious URLs. 170 // A SafeBrowingDatabase class that allows us to inject the malicious URLs.
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 } 2347 }
2348 2348
2349 INSTANTIATE_TEST_CASE_P( 2349 INSTANTIATE_TEST_CASE_P(
2350 MaybeSetMetadata, 2350 MaybeSetMetadata,
2351 V4SafeBrowsingServiceMetadataTest, 2351 V4SafeBrowsingServiceMetadataTest,
2352 testing::Values(ThreatPatternType::NONE, 2352 testing::Values(ThreatPatternType::NONE,
2353 ThreatPatternType::MALWARE_LANDING, 2353 ThreatPatternType::MALWARE_LANDING,
2354 ThreatPatternType::MALWARE_DISTRIBUTION)); 2354 ThreatPatternType::MALWARE_DISTRIBUTION));
2355 2355
2356 } // namespace safe_browsing 2356 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698