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

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

Issue 685553002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 1 month 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/browser/safe_browsing/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 base::Bind(&OnSafeBrowsingResult, 194 base::Bind(&OnSafeBrowsingResult,
195 base::Owned(check))); 195 base::Owned(check)));
196 } 196 }
197 197
198 class DownloadProtectionServiceTest : public testing::Test { 198 class DownloadProtectionServiceTest : public testing::Test {
199 protected: 199 protected:
200 DownloadProtectionServiceTest() 200 DownloadProtectionServiceTest()
201 : test_browser_thread_bundle_( 201 : test_browser_thread_bundle_(
202 content::TestBrowserThreadBundle::IO_MAINLOOP) { 202 content::TestBrowserThreadBundle::IO_MAINLOOP) {
203 } 203 }
204 virtual void SetUp() { 204 void SetUp() override {
205 #if defined(OS_MACOSX) 205 #if defined(OS_MACOSX)
206 field_trial_list_.reset(new base::FieldTrialList( 206 field_trial_list_.reset(new base::FieldTrialList(
207 new metrics::SHA1EntropyProvider("42"))); 207 new metrics::SHA1EntropyProvider("42")));
208 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial( 208 ASSERT_TRUE(base::FieldTrialList::CreateFieldTrial(
209 "SafeBrowsingOSXClientDownloadPings", 209 "SafeBrowsingOSXClientDownloadPings",
210 "Enabled")); 210 "Enabled"));
211 #endif 211 #endif
212 // Start real threads for the IO and File threads so that the DCHECKs 212 // Start real threads for the IO and File threads so that the DCHECKs
213 // to test that we're on the correct thread work. 213 // to test that we're on the correct thread work.
214 sb_service_ = new StrictMock<FakeSafeBrowsingService>(); 214 sb_service_ = new StrictMock<FakeSafeBrowsingService>();
215 sb_service_->Initialize(); 215 sb_service_->Initialize();
216 binary_feature_extractor_ = new StrictMock<MockBinaryFeatureExtractor>(); 216 binary_feature_extractor_ = new StrictMock<MockBinaryFeatureExtractor>();
217 download_service_ = sb_service_->download_protection_service(); 217 download_service_ = sb_service_->download_protection_service();
218 download_service_->binary_feature_extractor_ = binary_feature_extractor_; 218 download_service_->binary_feature_extractor_ = binary_feature_extractor_;
219 download_service_->SetEnabled(true); 219 download_service_->SetEnabled(true);
220 base::RunLoop().RunUntilIdle(); 220 base::RunLoop().RunUntilIdle();
221 has_result_ = false; 221 has_result_ = false;
222 222
223 base::FilePath source_path; 223 base::FilePath source_path;
224 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source_path)); 224 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &source_path));
225 testdata_path_ = source_path 225 testdata_path_ = source_path
226 .AppendASCII("chrome") 226 .AppendASCII("chrome")
227 .AppendASCII("test") 227 .AppendASCII("test")
228 .AppendASCII("data") 228 .AppendASCII("data")
229 .AppendASCII("safe_browsing") 229 .AppendASCII("safe_browsing")
230 .AppendASCII("download_protection"); 230 .AppendASCII("download_protection");
231 } 231 }
232 232
233 virtual void TearDown() { 233 void TearDown() override {
234 sb_service_->ShutDown(); 234 sb_service_->ShutDown();
235 // Flush all of the thread message loops to ensure that there are no 235 // Flush all of the thread message loops to ensure that there are no
236 // tasks currently running. 236 // tasks currently running.
237 FlushThreadMessageLoops(); 237 FlushThreadMessageLoops();
238 sb_service_ = NULL; 238 sb_service_ = NULL;
239 } 239 }
240 240
241 bool RequestContainsResource(const ClientDownloadRequest& request, 241 bool RequestContainsResource(const ClientDownloadRequest& request,
242 ClientDownloadRequest::ResourceType type, 242 ClientDownloadRequest::ResourceType type,
243 const std::string& url, 243 const std::string& url,
(...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after
1584 EXPECT_THAT(whitelist_strings, ElementsAre(cert_base + "/OU=unit")); 1584 EXPECT_THAT(whitelist_strings, ElementsAre(cert_base + "/OU=unit"));
1585 1585
1586 cert = ReadTestCertificate("test_c.pem"); 1586 cert = ReadTestCertificate("test_c.pem");
1587 ASSERT_TRUE(cert.get()); 1587 ASSERT_TRUE(cert.get());
1588 whitelist_strings.clear(); 1588 whitelist_strings.clear();
1589 GetCertificateWhitelistStrings( 1589 GetCertificateWhitelistStrings(
1590 *cert.get(), *issuer_cert.get(), &whitelist_strings); 1590 *cert.get(), *issuer_cert.get(), &whitelist_strings);
1591 EXPECT_THAT(whitelist_strings, ElementsAre()); 1591 EXPECT_THAT(whitelist_strings, ElementsAre());
1592 } 1592 }
1593 } // namespace safe_browsing 1593 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698