OLD | NEW |
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 <sys/stat.h> | 5 #include <sys/stat.h> |
6 #include <sys/types.h> | 6 #include <sys/types.h> |
7 #include <unistd.h> | 7 #include <unistd.h> |
8 #include <algorithm> | 8 #include <algorithm> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 #include <gtest/gtest.h> | 11 #include <gtest/gtest.h> |
12 #include "update_engine/bzip_extent_writer.h" | 12 #include "update_engine/bzip_extent_writer.h" |
13 #include "update_engine/test_utils.h" | 13 #include "update_engine/test_utils.h" |
14 #include "update_engine/utils.h" | 14 #include "update_engine/utils.h" |
15 | 15 |
16 using std::min; | 16 using std::min; |
17 using std::string; | 17 using std::string; |
18 using std::vector; | 18 using std::vector; |
19 | 19 |
20 namespace chromeos_update_engine { | 20 namespace chromeos_update_engine { |
21 | 21 |
22 namespace { | 22 namespace { |
23 const char kPathTemplate[] = "./BzipExtentWriterTest-file.XXXXXX"; | 23 const char kPathTemplate[] = "./BzipExtentWriterTest-file.XXXXXX"; |
24 const uint32 kBlockSize = 4096; | 24 const uint32_t kBlockSize = 4096; |
25 } | 25 } |
26 | 26 |
27 class BzipExtentWriterTest : public ::testing::Test { | 27 class BzipExtentWriterTest : public ::testing::Test { |
28 protected: | 28 protected: |
29 virtual void SetUp() { | 29 virtual void SetUp() { |
30 memcpy(path_, kPathTemplate, sizeof(kPathTemplate)); | 30 memcpy(path_, kPathTemplate, sizeof(kPathTemplate)); |
31 fd_ = mkstemp(path_); | 31 fd_ = mkstemp(path_); |
32 ASSERT_GE(fd_, 0); | 32 ASSERT_GE(fd_, 0); |
33 } | 33 } |
34 virtual void TearDown() { | 34 virtual void TearDown() { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 ssize_t bytes_read = pread(fd(), &output[0], output.size(), 0); | 112 ssize_t bytes_read = pread(fd(), &output[0], output.size(), 0); |
113 EXPECT_EQ(kDecompressedLength, bytes_read); | 113 EXPECT_EQ(kDecompressedLength, bytes_read); |
114 output.resize(kDecompressedLength); | 114 output.resize(kDecompressedLength); |
115 ExpectVectorsEq(decompressed_data, output); | 115 ExpectVectorsEq(decompressed_data, output); |
116 | 116 |
117 unlink(kDecompressedPath.c_str()); | 117 unlink(kDecompressedPath.c_str()); |
118 unlink(kCompressedPath.c_str()); | 118 unlink(kCompressedPath.c_str()); |
119 } | 119 } |
120 | 120 |
121 } // namespace chromeos_update_engine | 121 } // namespace chromeos_update_engine |
OLD | NEW |