Chromium Code Reviews| 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 <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 31 base::FilePath GetTestDataFilePath(const std::string& name) { | 31 base::FilePath GetTestDataFilePath(const std::string& name) { |
| 32 base::FilePath file_path; | 32 base::FilePath file_path; |
| 33 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path)); | 33 CHECK(PathService::Get(base::DIR_SOURCE_ROOT, &file_path)); |
| 34 return file_path.Append(GetTestDataPath()).AppendASCII(name); | 34 return file_path.Append(GetTestDataPath()).AppendASCII(name); |
| 35 } | 35 } |
| 36 | 36 |
| 37 base::FilePath GetTestDataPath() { | 37 base::FilePath GetTestDataPath() { |
| 38 return base::FilePath(kTestDataPath); | 38 return base::FilePath(kTestDataPath); |
| 39 } | 39 } |
| 40 | 40 |
| 41 base::FilePath GetOriginalOrTestDataFilePath(const std::string& name) { | |
|
wuchengli
2017/06/08 02:44:32
It doesn't look like this class needs to provide t
mojahsu1
2017/06/12 07:29:44
Done.
| |
| 42 base::FilePath original_file_path = base::FilePath(name); | |
| 43 | |
| 44 if (PathExists(original_file_path)) | |
| 45 return original_file_path; | |
| 46 | |
| 47 return GetTestDataFilePath(name); | |
| 48 } | |
| 49 | |
| 41 std::string GetURLQueryString(const base::StringPairs& query_params) { | 50 std::string GetURLQueryString(const base::StringPairs& query_params) { |
| 42 std::string query = ""; | 51 std::string query = ""; |
| 43 base::StringPairs::const_iterator itr = query_params.begin(); | 52 base::StringPairs::const_iterator itr = query_params.begin(); |
| 44 for (; itr != query_params.end(); ++itr) { | 53 for (; itr != query_params.end(); ++itr) { |
| 45 if (itr != query_params.begin()) | 54 if (itr != query_params.begin()) |
| 46 query.append("&"); | 55 query.append("&"); |
| 47 query.append(itr->first + "=" + itr->second); | 56 query.append(itr->first + "=" + itr->second); |
| 48 } | 57 } |
| 49 return query; | 58 return query; |
| 50 } | 59 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 std::vector<uint8_t> key_vector; | 99 std::vector<uint8_t> key_vector; |
| 91 bool result = | 100 bool result = |
| 92 LookupTestKeyVector(std::vector<uint8_t>(key_id.begin(), key_id.end()), | 101 LookupTestKeyVector(std::vector<uint8_t>(key_id.begin(), key_id.end()), |
| 93 allow_rotation, &key_vector); | 102 allow_rotation, &key_vector); |
| 94 if (result) | 103 if (result) |
| 95 *key = std::string(key_vector.begin(), key_vector.end()); | 104 *key = std::string(key_vector.begin(), key_vector.end()); |
| 96 return result; | 105 return result; |
| 97 } | 106 } |
| 98 | 107 |
| 99 } // namespace media | 108 } // namespace media |
| OLD | NEW |