OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/base/test_data_util.h" | 5 #include "media/base/test_data_util.h" |
6 | 6 |
7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 #include "base/numerics/safe_conversions.h" | 9 #include "base/numerics/safe_conversions.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 if (itr != query_params.begin()) | 32 if (itr != query_params.begin()) |
33 query.append("&"); | 33 query.append("&"); |
34 query.append(itr->first + "=" + itr->second); | 34 query.append(itr->first + "=" + itr->second); |
35 } | 35 } |
36 return query; | 36 return query; |
37 } | 37 } |
38 | 38 |
39 scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name) { | 39 scoped_refptr<DecoderBuffer> ReadTestDataFile(const std::string& name) { |
40 base::FilePath file_path = GetTestDataFilePath(name); | 40 base::FilePath file_path = GetTestDataFilePath(name); |
41 | 41 |
42 int64 tmp = 0; | 42 int64_t tmp = 0; |
43 CHECK(base::GetFileSize(file_path, &tmp)) | 43 CHECK(base::GetFileSize(file_path, &tmp)) |
44 << "Failed to get file size for '" << name << "'"; | 44 << "Failed to get file size for '" << name << "'"; |
45 | 45 |
46 int file_size = base::checked_cast<int>(tmp); | 46 int file_size = base::checked_cast<int>(tmp); |
47 | 47 |
48 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(file_size)); | 48 scoped_refptr<DecoderBuffer> buffer(new DecoderBuffer(file_size)); |
49 CHECK_EQ(file_size, | 49 CHECK_EQ(file_size, |
50 base::ReadFile( | 50 base::ReadFile( |
51 file_path, reinterpret_cast<char*>(buffer->writable_data()), | 51 file_path, reinterpret_cast<char*>(buffer->writable_data()), |
52 file_size)) << "Failed to read '" << name << "'"; | 52 file_size)) << "Failed to read '" << name << "'"; |
53 | 53 |
54 return buffer; | 54 return buffer; |
55 } | 55 } |
56 | 56 |
57 } // namespace media | 57 } // namespace media |
OLD | NEW |