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

Side by Side Diff: content/common/gpu/media/video_decode_accelerator_unittest.cc

Issue 1278973003: Revert of Update SplitString calls to new form (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 4 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
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 // The bulk of this file is support code; sorry about that. Here's an overview 5 // The bulk of this file is support code; sorry about that. Here's an overview
6 // to hopefully help readers of this code: 6 // to hopefully help readers of this code:
7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or
8 // Win/EGL. 8 // Win/EGL.
9 // - ClientState is an enum for the state of the decode client used by the test. 9 // - ClientState is an enum for the state of the decode client used by the test.
10 // - ClientStateNotification is a barrier abstraction that allows the test code 10 // - ClientStateNotification is a barrier abstraction that allows the test code
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 const gfx::Size kThumbnailSize(160, 120); 173 const gfx::Size kThumbnailSize(160, 120);
174 const int kMD5StringLength = 32; 174 const int kMD5StringLength = 32;
175 175
176 // Read in golden MD5s for the thumbnailed rendering of this video 176 // Read in golden MD5s for the thumbnailed rendering of this video
177 void ReadGoldenThumbnailMD5s(const TestVideoFile* video_file, 177 void ReadGoldenThumbnailMD5s(const TestVideoFile* video_file,
178 std::vector<std::string>* md5_strings) { 178 std::vector<std::string>* md5_strings) {
179 base::FilePath filepath(video_file->file_name); 179 base::FilePath filepath(video_file->file_name);
180 filepath = filepath.AddExtension(FILE_PATH_LITERAL(".md5")); 180 filepath = filepath.AddExtension(FILE_PATH_LITERAL(".md5"));
181 std::string all_md5s; 181 std::string all_md5s;
182 base::ReadFileToString(filepath, &all_md5s); 182 base::ReadFileToString(filepath, &all_md5s);
183 *md5_strings = base::SplitString( 183 base::SplitString(all_md5s, '\n', md5_strings);
184 all_md5s, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
185 // Check these are legitimate MD5s. 184 // Check these are legitimate MD5s.
186 for (const std::string& md5_string : *md5_strings) { 185 for (std::vector<std::string>::iterator md5_string = md5_strings->begin();
186 md5_string != md5_strings->end(); ++md5_string) {
187 // Ignore the empty string added by SplitString 187 // Ignore the empty string added by SplitString
188 if (!md5_string.length()) 188 if (!md5_string->length())
189 continue; 189 continue;
190 // Ignore comments 190 // Ignore comments
191 if (md5_string.at(0) == '#') 191 if (md5_string->at(0) == '#')
192 continue; 192 continue;
193 193
194 CHECK_EQ(static_cast<int>(md5_string.length()), 194 CHECK_EQ(static_cast<int>(md5_string->length()),
195 kMD5StringLength) << md5_string; 195 kMD5StringLength) << *md5_string;
196 bool hex_only = std::count_if(md5_string.begin(), 196 bool hex_only = std::count_if(md5_string->begin(),
197 md5_string.end(), isxdigit) == 197 md5_string->end(), isxdigit) ==
198 kMD5StringLength; 198 kMD5StringLength;
199 CHECK(hex_only) << md5_string; 199 CHECK(hex_only) << *md5_string;
200 } 200 }
201 CHECK_GE(md5_strings->size(), 1U) << " MD5 checksum file (" 201 CHECK_GE(md5_strings->size(), 1U) << " MD5 checksum file ("
202 << filepath.MaybeAsASCII() 202 << filepath.MaybeAsASCII()
203 << ") missing or empty."; 203 << ") missing or empty.";
204 } 204 }
205 205
206 // State of the GLRenderingVDAClient below. Order matters here as the test 206 // State of the GLRenderingVDAClient below. Order matters here as the test
207 // makes assumptions about it. 207 // makes assumptions about it.
208 enum ClientState { 208 enum ClientState {
209 CS_CREATED = 0, 209 CS_CREATED = 0,
(...skipping 844 matching lines...) Expand 10 before | Expand all | Expand 10 after
1054 FROM_HERE, base::Bind(&RenderingHelper::UnInitialize, 1054 FROM_HERE, base::Bind(&RenderingHelper::UnInitialize,
1055 base::Unretained(&rendering_helper_), &done)); 1055 base::Unretained(&rendering_helper_), &done));
1056 done.Wait(); 1056 done.Wait();
1057 1057
1058 rendering_helper_.TearDown(); 1058 rendering_helper_.TearDown();
1059 } 1059 }
1060 1060
1061 void VideoDecodeAcceleratorTest::ParseAndReadTestVideoData( 1061 void VideoDecodeAcceleratorTest::ParseAndReadTestVideoData(
1062 base::FilePath::StringType data, 1062 base::FilePath::StringType data,
1063 std::vector<TestVideoFile*>* test_video_files) { 1063 std::vector<TestVideoFile*>* test_video_files) {
1064 std::vector<base::FilePath::StringType> entries = base::SplitString( 1064 std::vector<base::FilePath::StringType> entries;
1065 data, base::FilePath::StringType(1, ';'), 1065 base::SplitString(data, ';', &entries);
1066 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
1067 CHECK_GE(entries.size(), 1U) << data; 1066 CHECK_GE(entries.size(), 1U) << data;
1068 for (size_t index = 0; index < entries.size(); ++index) { 1067 for (size_t index = 0; index < entries.size(); ++index) {
1069 std::vector<base::FilePath::StringType> fields = base::SplitString( 1068 std::vector<base::FilePath::StringType> fields;
1070 entries[index], base::FilePath::StringType(1, ':'), 1069 base::SplitString(entries[index], ':', &fields);
1071 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
1072 CHECK_GE(fields.size(), 1U) << entries[index]; 1070 CHECK_GE(fields.size(), 1U) << entries[index];
1073 CHECK_LE(fields.size(), 8U) << entries[index]; 1071 CHECK_LE(fields.size(), 8U) << entries[index];
1074 TestVideoFile* video_file = new TestVideoFile(fields[0]); 1072 TestVideoFile* video_file = new TestVideoFile(fields[0]);
1075 if (!fields[1].empty()) 1073 if (!fields[1].empty())
1076 CHECK(base::StringToInt(fields[1], &video_file->width)); 1074 CHECK(base::StringToInt(fields[1], &video_file->width));
1077 if (!fields[2].empty()) 1075 if (!fields[2].empty())
1078 CHECK(base::StringToInt(fields[2], &video_file->height)); 1076 CHECK(base::StringToInt(fields[2], &video_file->height));
1079 if (!fields[3].empty()) 1077 if (!fields[3].empty())
1080 CHECK(base::StringToInt(fields[3], &video_file->num_frames)); 1078 CHECK(base::StringToInt(fields[3], &video_file->num_frames));
1081 if (!fields[4].empty()) 1079 if (!fields[4].empty())
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 content::VaapiWrapper::PreSandboxInitialization(); 1640 content::VaapiWrapper::PreSandboxInitialization();
1643 #endif 1641 #endif
1644 1642
1645 content::g_env = 1643 content::g_env =
1646 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>( 1644 reinterpret_cast<content::VideoDecodeAcceleratorTestEnvironment*>(
1647 testing::AddGlobalTestEnvironment( 1645 testing::AddGlobalTestEnvironment(
1648 new content::VideoDecodeAcceleratorTestEnvironment())); 1646 new content::VideoDecodeAcceleratorTestEnvironment()));
1649 1647
1650 return RUN_ALL_TESTS(); 1648 return RUN_ALL_TESTS();
1651 } 1649 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698