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

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

Issue 1548133002: Switch to standard integer types in chrome/browser/, part 3 of 4. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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/browser/safe_browsing/download_protection_service.h" 5 #include "chrome/browser/safe_browsing/download_protection_service.h"
6 6
7 #include <stddef.h>
7 #include <stdint.h> 8 #include <stdint.h>
8 #include <map> 9 #include <map>
9 #include <string> 10 #include <string>
10 11
11 #include "base/base_paths.h" 12 #include "base/base_paths.h"
12 #include "base/bind.h" 13 #include "base/bind.h"
13 #include "base/callback.h" 14 #include "base/callback.h"
14 #include "base/command_line.h" 15 #include "base/command_line.h"
15 #include "base/files/file_path.h" 16 #include "base/files/file_path.h"
16 #include "base/files/file_util.h" 17 #include "base/files/file_util.h"
17 #include "base/files/scoped_temp_dir.h" 18 #include "base/files/scoped_temp_dir.h"
19 #include "base/macros.h"
18 #include "base/memory/ref_counted.h" 20 #include "base/memory/ref_counted.h"
19 #include "base/memory/scoped_ptr.h" 21 #include "base/memory/scoped_ptr.h"
20 #include "base/message_loop/message_loop.h" 22 #include "base/message_loop/message_loop.h"
21 #include "base/path_service.h" 23 #include "base/path_service.h"
22 #include "base/prefs/pref_service.h" 24 #include "base/prefs/pref_service.h"
23 #include "base/run_loop.h" 25 #include "base/run_loop.h"
24 #include "base/strings/string_number_conversions.h" 26 #include "base/strings/string_number_conversions.h"
25 #include "base/threading/sequenced_worker_pool.h" 27 #include "base/threading/sequenced_worker_pool.h"
26 #include "chrome/browser/history/history_service_factory.h" 28 #include "chrome/browser/history/history_service_factory.h"
27 #include "chrome/browser/safe_browsing/database_manager.h" 29 #include "chrome/browser/safe_browsing/database_manager.h"
(...skipping 1873 matching lines...) Expand 10 before | Expand all | Expand 10 after
1901 } 1903 }
1902 1904
1903 // ------------ class DownloadProtectionServiceFlagTest ---------------- 1905 // ------------ class DownloadProtectionServiceFlagTest ----------------
1904 class DownloadProtectionServiceFlagTest : public DownloadProtectionServiceTest { 1906 class DownloadProtectionServiceFlagTest : public DownloadProtectionServiceTest {
1905 protected: 1907 protected:
1906 DownloadProtectionServiceFlagTest() 1908 DownloadProtectionServiceFlagTest()
1907 // Matches unsigned.exe within zipfile_one_unsigned_binary.zip 1909 // Matches unsigned.exe within zipfile_one_unsigned_binary.zip
1908 : blacklisted_hash_hex_("1e954d9ce0389e2ba7447216f21761f98d1e6540c2abecdbe cff570e36c493db") {} 1910 : blacklisted_hash_hex_("1e954d9ce0389e2ba7447216f21761f98d1e6540c2abecdbe cff570e36c493db") {}
1909 1911
1910 void SetUp() override { 1912 void SetUp() override {
1911 std::vector<uint8> bytes; 1913 std::vector<uint8_t> bytes;
1912 ASSERT_TRUE(base::HexStringToBytes(blacklisted_hash_hex_, &bytes) && 1914 ASSERT_TRUE(base::HexStringToBytes(blacklisted_hash_hex_, &bytes) &&
1913 bytes.size() == 32); 1915 bytes.size() == 32);
1914 blacklisted_hash_ = std::string(bytes.begin(), bytes.end()); 1916 blacklisted_hash_ = std::string(bytes.begin(), bytes.end());
1915 1917
1916 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 1918 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
1917 switches::kSbManualDownloadBlacklist, 1919 switches::kSbManualDownloadBlacklist,
1918 blacklisted_hash_hex_); 1920 blacklisted_hash_hex_);
1919 1921
1920 DownloadProtectionServiceTest::SetUp(); 1922 DownloadProtectionServiceTest::SetUp();
1921 } 1923 }
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
1999 &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback, 2001 &item, base::Bind(&DownloadProtectionServiceTest::CheckDoneCallback,
2000 base::Unretained(this))); 2002 base::Unretained(this)));
2001 MessageLoop::current()->Run(); 2003 MessageLoop::current()->Run();
2002 2004
2003 EXPECT_FALSE(HasClientDownloadRequest()); 2005 EXPECT_FALSE(HasClientDownloadRequest());
2004 // Overriden by flag: 2006 // Overriden by flag:
2005 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS)); 2007 EXPECT_TRUE(IsResult(DownloadProtectionService::DANGEROUS));
2006 } 2008 }
2007 2009
2008 } // namespace safe_browsing 2010 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698