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 "base/base_paths.h" | 10 #include "base/base_paths.h" |
11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
12 #include "base/files/scoped_temp_dir.h" | 12 #include "base/files/scoped_temp_dir.h" |
| 13 #include "base/memory/scoped_ptr.h" |
13 #include "base/path_service.h" | 14 #include "base/path_service.h" |
14 #include "chrome/common/safe_browsing/csd.pb.h" | 15 #include "chrome/common/safe_browsing/csd.pb.h" |
15 #include "crypto/sha2.h" | 16 #include "crypto/sha2.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 | 18 |
18 namespace safe_browsing { | 19 namespace safe_browsing { |
19 | 20 |
20 class BinaryFeatureExtractorTest : public testing::Test { | 21 class BinaryFeatureExtractorTest : public testing::Test { |
21 protected: | 22 protected: |
22 BinaryFeatureExtractorTest() : extractor_(new BinaryFeatureExtractor()) {} | 23 BinaryFeatureExtractorTest() : extractor_(new BinaryFeatureExtractor()) {} |
(...skipping 72 matching lines...) Loading... |
95 0x33, 0xa7, 0x70, 0xf3, 0x6b, 0x85, 0xbf, 0xce, 0x9d, 0x5c}; | 96 0x33, 0xa7, 0x70, 0xf3, 0x6b, 0x85, 0xbf, 0xce, 0x9d, 0x5c}; |
96 | 97 |
97 const int kDataLen = kBlockSize + 1; | 98 const int kDataLen = kBlockSize + 1; |
98 scoped_ptr<char[]> data(new char[kDataLen]); | 99 scoped_ptr<char[]> data(new char[kDataLen]); |
99 memset(data.get(), 71, kDataLen); | 100 memset(data.get(), 71, kDataLen); |
100 WriteFileToHash(data.get(), kDataLen); | 101 WriteFileToHash(data.get(), kDataLen); |
101 ExpectFileDigestEq(kDigest); | 102 ExpectFileDigestEq(kDigest); |
102 } | 103 } |
103 | 104 |
104 } // namespace safe_browsing | 105 } // namespace safe_browsing |
OLD | NEW |