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

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: ready for review 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 config.url_prefix = url_prefix; 144 config.url_prefix = url_prefix;
145 // Makes sure the auto update is not triggered. The tests will force the 145 // Makes sure the auto update is not triggered. The tests will force the
146 // update when needed. 146 // update when needed.
147 config.disable_auto_update = true; 147 config.disable_auto_update = true;
148 config.client_name = "browser_tests"; 148 config.client_name = "browser_tests";
149 factory->SetTestProtocolConfig(config); 149 factory->SetTestProtocolConfig(config);
150 } 150 }
151 151
152 class FakeSafeBrowsingUIManager : public TestSafeBrowsingUIManager { 152 class FakeSafeBrowsingUIManager : public TestSafeBrowsingUIManager {
153 public: 153 public:
154 void MaybeReportSafeBrowsingHit( 154 void MaybeReportSafeBrowsingHit(const safe_browsing::HitReport& hit_report,
155 const safe_browsing::HitReport& hit_report) override { 155 content::WebContents* web_contents) override {
156 EXPECT_FALSE(got_hit_report_); 156 EXPECT_FALSE(got_hit_report_);
157 got_hit_report_ = true; 157 got_hit_report_ = true;
158 hit_report_ = hit_report; 158 hit_report_ = hit_report;
159 SafeBrowsingUIManager::MaybeReportSafeBrowsingHit(hit_report); 159 SafeBrowsingUIManager::MaybeReportSafeBrowsingHit(hit_report, web_contents);
160 } 160 }
161 161
162 bool got_hit_report_ = false; 162 bool got_hit_report_ = false;
163 safe_browsing::HitReport hit_report_; 163 safe_browsing::HitReport hit_report_;
164 164
165 private: 165 private:
166 ~FakeSafeBrowsingUIManager() override {} 166 ~FakeSafeBrowsingUIManager() override {}
167 }; 167 };
168 168
169 // A SafeBrowingDatabase class that allows us to inject the malicious URLs. 169 // A SafeBrowingDatabase class that allows us to inject the malicious URLs.
(...skipping 2176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2346 } 2346 }
2347 2347
2348 INSTANTIATE_TEST_CASE_P( 2348 INSTANTIATE_TEST_CASE_P(
2349 MaybeSetMetadata, 2349 MaybeSetMetadata,
2350 V4SafeBrowsingServiceMetadataTest, 2350 V4SafeBrowsingServiceMetadataTest,
2351 testing::Values(ThreatPatternType::NONE, 2351 testing::Values(ThreatPatternType::NONE,
2352 ThreatPatternType::MALWARE_LANDING, 2352 ThreatPatternType::MALWARE_LANDING,
2353 ThreatPatternType::MALWARE_DISTRIBUTION)); 2353 ThreatPatternType::MALWARE_DISTRIBUTION));
2354 2354
2355 } // namespace safe_browsing 2355 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698