Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(176)

Side by Side Diff: media/base/test_data_util.cc

Issue 2922323003: JDA unittest: don't require the test file in /media/test/data/. (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « media/base/test_data_util.h ('k') | media/gpu/jpeg_decode_accelerator_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « media/base/test_data_util.h ('k') | media/gpu/jpeg_decode_accelerator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698