OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/utility/safe_browsing/mac/read_stream.h" | 5 #include "chrome/utility/safe_browsing/mac/read_stream.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 for (size_t i = 0; i < data_size; ++i) { | 70 for (size_t i = 0; i < data_size; ++i) { |
71 test_helper_.data[i] = i % 255; | 71 test_helper_.data[i] = i % 255; |
72 } | 72 } |
73 return base::WrapUnique( | 73 return base::WrapUnique( |
74 new MemoryReadStream(&test_helper_.data[0], data_size)); | 74 new MemoryReadStream(&test_helper_.data[0], data_size)); |
75 } | 75 } |
76 | 76 |
77 template <> | 77 template <> |
78 std::unique_ptr<ReadStream> ReadStreamTest<FileReadStreamTest>::CreateStream( | 78 std::unique_ptr<ReadStream> ReadStreamTest<FileReadStreamTest>::CreateStream( |
79 size_t data_size) { | 79 size_t data_size) { |
80 base::FilePath path = test_helper_.temp_dir.path().Append("stream"); | 80 base::FilePath path = test_helper_.temp_dir.GetPath().Append("stream"); |
81 test_helper_.file.Initialize(path, | 81 test_helper_.file.Initialize(path, |
82 base::File::FLAG_CREATE | base::File::FLAG_WRITE); | 82 base::File::FLAG_CREATE | base::File::FLAG_WRITE); |
83 if (!test_helper_.file.IsValid()) { | 83 if (!test_helper_.file.IsValid()) { |
84 ADD_FAILURE() << "Failed to create temp file"; | 84 ADD_FAILURE() << "Failed to create temp file"; |
85 return nullptr; | 85 return nullptr; |
86 } | 86 } |
87 | 87 |
88 for (size_t i = 0; i < data_size; ++i) { | 88 for (size_t i = 0; i < data_size; ++i) { |
89 char value = i % 255; | 89 char value = i % 255; |
90 EXPECT_EQ(1, test_helper_.file.WriteAtCurrentPos(&value, 1)); | 90 EXPECT_EQ(1, test_helper_.file.WriteAtCurrentPos(&value, 1)); |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 210 } |
211 | 211 |
212 { | 212 { |
213 EXPECT_EQ(100, stream->Seek(0, SEEK_END)); | 213 EXPECT_EQ(100, stream->Seek(0, SEEK_END)); |
214 EXPECT_EQ(100, stream->Seek(0, SEEK_CUR)); | 214 EXPECT_EQ(100, stream->Seek(0, SEEK_CUR)); |
215 } | 215 } |
216 } | 216 } |
217 | 217 |
218 } // namespace dmg | 218 } // namespace dmg |
219 } // namespace safe_browsing | 219 } // namespace safe_browsing |
OLD | NEW |