| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 | 7 |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 bool InitColumnReaderFromBytes( | 23 bool InitColumnReaderFromBytes( |
| 24 PmpColumnReader* const reader, | 24 PmpColumnReader* const reader, |
| 25 const std::vector<char>& data, | 25 const std::vector<char>& data, |
| 26 const PmpFieldType expected_type) { | 26 const PmpFieldType expected_type) { |
| 27 base::ScopedTempDir temp_dir; | 27 base::ScopedTempDir temp_dir; |
| 28 if (!temp_dir.CreateUniqueTempDir()) | 28 if (!temp_dir.CreateUniqueTempDir()) |
| 29 return false; | 29 return false; |
| 30 | 30 |
| 31 base::FilePath temp_path; | 31 base::FilePath temp_path; |
| 32 if (!base::CreateTemporaryFileInDir(temp_dir.path(), &temp_path)) | 32 if (!base::CreateTemporaryFileInDir(temp_dir.GetPath(), &temp_path)) |
| 33 return false; | 33 return false; |
| 34 | 34 |
| 35 // Explicit conversion from signed to unsigned. | 35 // Explicit conversion from signed to unsigned. |
| 36 size_t bytes_written = base::WriteFile(temp_path, &data[0], data.size()); | 36 size_t bytes_written = base::WriteFile(temp_path, &data[0], data.size()); |
| 37 if (bytes_written != data.size()) | 37 if (bytes_written != data.size()) |
| 38 return false; | 38 return false; |
| 39 | 39 |
| 40 base::File file(temp_path, base::File::FLAG_OPEN | base::File::FLAG_READ); | 40 base::File file(temp_path, base::File::FLAG_OPEN | base::File::FLAG_READ); |
| 41 if (!file.IsValid()) | 41 if (!file.IsValid()) |
| 42 return false; | 42 return false; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 TEST(PmpColumnReaderTest, PrimitiveParsing) { | 199 TEST(PmpColumnReaderTest, PrimitiveParsing) { |
| 200 TestPrimitive<uint32_t>(PMP_TYPE_UINT32); | 200 TestPrimitive<uint32_t>(PMP_TYPE_UINT32); |
| 201 TestPrimitive<double>(PMP_TYPE_DOUBLE64); | 201 TestPrimitive<double>(PMP_TYPE_DOUBLE64); |
| 202 TestPrimitive<uint8_t>(PMP_TYPE_UINT8); | 202 TestPrimitive<uint8_t>(PMP_TYPE_UINT8); |
| 203 TestPrimitive<uint64_t>(PMP_TYPE_UINT64); | 203 TestPrimitive<uint64_t>(PMP_TYPE_UINT64); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace | 206 } // namespace |
| 207 | 207 |
| 208 } // namespace picasa | 208 } // namespace picasa |
| OLD | NEW |