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 "components/metrics/compression_utils.h" | 5 #include "components/compression/compression_utils.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace metrics { | 13 namespace compression { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 // The data to be compressed by gzip. This is the hex representation of "hello | 17 // The data to be compressed by gzip. This is the hex representation of "hello |
18 // world". | 18 // world". |
19 const uint8 kData[] = | 19 const uint8 kData[] = |
20 {0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, | 20 {0x68, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x77, 0x6f, |
21 0x72, 0x6c, 0x64}; | 21 0x72, 0x6c, 0x64}; |
22 | 22 |
23 // This is the string representation of gzip compressed string above. It was | 23 // This is the string representation of gzip compressed string above. It was |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 reinterpret_cast<const char*>(kCompressedData), | 80 reinterpret_cast<const char*>(kCompressedData), |
81 arraysize(kCompressedData)); | 81 arraysize(kCompressedData)); |
82 | 82 |
83 std::string data(original_data); | 83 std::string data(original_data); |
84 EXPECT_TRUE(GzipCompress(data, &data)); | 84 EXPECT_TRUE(GzipCompress(data, &data)); |
85 EXPECT_EQ(golden_compressed_data, data); | 85 EXPECT_EQ(golden_compressed_data, data); |
86 EXPECT_TRUE(GzipUncompress(data, &data)); | 86 EXPECT_TRUE(GzipUncompress(data, &data)); |
87 EXPECT_EQ(original_data, data); | 87 EXPECT_EQ(original_data, data); |
88 } | 88 } |
89 | 89 |
90 } // namespace metrics | 90 } // namespace compression |
OLD | NEW |