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

Side by Side Diff: chrome/common/safe_browsing/download_protection_util_unittest.cc

Issue 1257233004: [SafeBrowsing] Consolidate extension lookup logic and extension lists. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@double-zip
Patch Set: Fix Windows unit test build. Created 5 years, 4 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
(Empty)
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/common/safe_browsing/download_protection_util.h"
6
7 #include "base/files/file_path.h"
8 #include "testing/gtest/include/gtest/gtest.h"
9
10 namespace safe_browsing {
11 namespace download_protection_util {
12
13 TEST(DownloadProtectionUtilTest, KnownValues) {
14 EXPECT_EQ(0, GetSBClientDownloadExtensionValueForUMA(
15 base::FilePath(FILE_PATH_LITERAL("foo.exe"))));
16 EXPECT_EQ(9, GetSBClientDownloadExtensionValueForUMA(
17 base::FilePath(FILE_PATH_LITERAL("foo.dll"))));
18 EXPECT_EQ(29, GetSBClientDownloadExtensionValueForUMA(
19 base::FilePath(FILE_PATH_LITERAL("foo.jse"))));
20 EXPECT_EQ(18, GetSBClientDownloadExtensionValueForUMA(
21 base::FilePath(FILE_PATH_LITERAL("foo.111"))));
22 EXPECT_EQ(18, GetSBClientDownloadExtensionValueForUMA(
23 base::FilePath(FILE_PATH_LITERAL("foo.zzz"))));
24 EXPECT_TRUE(IsArchiveFile(base::FilePath(FILE_PATH_LITERAL("foo.zip"))));
25 EXPECT_FALSE(IsArchiveFile(base::FilePath(FILE_PATH_LITERAL("foo.ps1"))));
26 EXPECT_FALSE(
27 IsArchiveFile(base::FilePath(FILE_PATH_LITERAL("foo.unknownextension"))));
28 EXPECT_FALSE(
29 IsArchiveFile(base::FilePath(FILE_PATH_LITERAL("no_extension"))));
30 EXPECT_TRUE(IsSupportedBinaryFile(base::FilePath(FILE_PATH_LITERAL(".exe"))));
31 EXPECT_TRUE(
32 IsSupportedBinaryFile(base::FilePath(FILE_PATH_LITERAL("foo.msi"))));
33 EXPECT_FALSE(
34 IsSupportedBinaryFile(base::FilePath(FILE_PATH_LITERAL("foo.txt"))));
35 EXPECT_FALSE(IsSupportedBinaryFile(
36 base::FilePath(FILE_PATH_LITERAL("foo.unknownextension"))));
37 EXPECT_FALSE(
38 IsSupportedBinaryFile(base::FilePath(FILE_PATH_LITERAL("no_extension"))));
39 }
40
41 } // namespace download_protection_util
42 } // namespace safe_browsing
43
44
OLDNEW
« no previous file with comments | « chrome/common/safe_browsing/download_protection_util.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698