OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/common/safe_browsing/binary_feature_extractor.h" | 5 #include "chrome/common/safe_browsing/binary_feature_extractor.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <string.h> | 8 #include <string.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/base_paths.h" | 12 #include "base/base_paths.h" |
13 #include "base/files/file.h" | 13 #include "base/files/file.h" |
14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "chrome/common/safe_browsing/csd.pb.h" | 16 #include "components/safe_browsing/csd.pb.h" |
17 #include "crypto/sha2.h" | 17 #include "crypto/sha2.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
19 | 19 |
20 namespace safe_browsing { | 20 namespace safe_browsing { |
21 | 21 |
22 class BinaryFeatureExtractorTest : public testing::Test { | 22 class BinaryFeatureExtractorTest : public testing::Test { |
23 protected: | 23 protected: |
24 BinaryFeatureExtractorTest() : extractor_(new BinaryFeatureExtractor()) {} | 24 BinaryFeatureExtractorTest() : extractor_(new BinaryFeatureExtractor()) {} |
25 | 25 |
26 void SetUp() override { | 26 void SetUp() override { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 0x33, 0xa7, 0x70, 0xf3, 0x6b, 0x85, 0xbf, 0xce, 0x9d, 0x5c}; | 97 0x33, 0xa7, 0x70, 0xf3, 0x6b, 0x85, 0xbf, 0xce, 0x9d, 0x5c}; |
98 | 98 |
99 const int kDataLen = kBlockSize + 1; | 99 const int kDataLen = kBlockSize + 1; |
100 std::unique_ptr<char[]> data(new char[kDataLen]); | 100 std::unique_ptr<char[]> data(new char[kDataLen]); |
101 memset(data.get(), 71, kDataLen); | 101 memset(data.get(), 71, kDataLen); |
102 WriteFileToHash(data.get(), kDataLen); | 102 WriteFileToHash(data.get(), kDataLen); |
103 ExpectFileDigestEq(kDigest); | 103 ExpectFileDigestEq(kDigest); |
104 } | 104 } |
105 | 105 |
106 } // namespace safe_browsing | 106 } // namespace safe_browsing |
OLD | NEW |