| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <vector> | 6 #include <vector> |
| 7 | 7 |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/platform_file.h" | 10 #include "base/platform_file.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 const PmpFieldType expected_type) { | 23 const PmpFieldType expected_type) { |
| 24 base::ScopedTempDir temp_dir; | 24 base::ScopedTempDir temp_dir; |
| 25 if (!temp_dir.CreateUniqueTempDir()) | 25 if (!temp_dir.CreateUniqueTempDir()) |
| 26 return false; | 26 return false; |
| 27 | 27 |
| 28 base::FilePath temp_path; | 28 base::FilePath temp_path; |
| 29 if (!base::CreateTemporaryFileInDir(temp_dir.path(), &temp_path)) | 29 if (!base::CreateTemporaryFileInDir(temp_dir.path(), &temp_path)) |
| 30 return false; | 30 return false; |
| 31 | 31 |
| 32 // Explicit conversion from signed to unsigned. | 32 // Explicit conversion from signed to unsigned. |
| 33 size_t bytes_written = file_util::WriteFile(temp_path, &data[0], data.size()); | 33 size_t bytes_written = base::WriteFile(temp_path, &data[0], data.size()); |
| 34 if (bytes_written != data.size()) | 34 if (bytes_written != data.size()) |
| 35 return false; | 35 return false; |
| 36 | 36 |
| 37 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; | 37 int flags = base::PLATFORM_FILE_OPEN | base::PLATFORM_FILE_READ; |
| 38 base::PlatformFile platform_file = | 38 base::PlatformFile platform_file = |
| 39 base::CreatePlatformFile(temp_path, flags, NULL, NULL); | 39 base::CreatePlatformFile(temp_path, flags, NULL, NULL); |
| 40 if (platform_file == base::kInvalidPlatformFileValue) | 40 if (platform_file == base::kInvalidPlatformFileValue) |
| 41 return false; | 41 return false; |
| 42 | 42 |
| 43 bool read_success = reader->ReadFile(platform_file, expected_type); | 43 bool read_success = reader->ReadFile(platform_file, expected_type); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 TEST(PmpColumnReaderTest, PrimitiveParsing) { | 202 TEST(PmpColumnReaderTest, PrimitiveParsing) { |
| 203 TestPrimitive<uint32>(PMP_TYPE_UINT32); | 203 TestPrimitive<uint32>(PMP_TYPE_UINT32); |
| 204 TestPrimitive<double>(PMP_TYPE_DOUBLE64); | 204 TestPrimitive<double>(PMP_TYPE_DOUBLE64); |
| 205 TestPrimitive<uint8>(PMP_TYPE_UINT8); | 205 TestPrimitive<uint8>(PMP_TYPE_UINT8); |
| 206 TestPrimitive<uint64>(PMP_TYPE_UINT64); | 206 TestPrimitive<uint64>(PMP_TYPE_UINT64); |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace | 209 } // namespace |
| 210 | 210 |
| 211 } // namespace picasa | 211 } // namespace picasa |
| OLD | NEW |