Add ICU message format support
[chromium-blink-merge.git] / chrome / common / safe_browsing / download_protection_util_unittest.cc
blob8bb47fbc34f3c63c838ce770cd2553b1b824205d
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.
5 #include "chrome/common/safe_browsing/download_protection_util.h"
7 #include "base/files/file_path.h"
8 #include "testing/gtest/include/gtest/gtest.h"
10 namespace safe_browsing {
11 namespace download_protection_util {
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"))));
41 } // namespace download_protection_util
42 } // namespace safe_browsing