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

Side by Side Diff: media/renderers/video_renderer_impl_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 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 <utility> 5 #include <utility>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/debug/stack_trace.h" 10 #include "base/debug/stack_trace.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 // 159 //
160 // Syntax: 160 // Syntax:
161 // nn - Queue a decoder buffer with timestamp nn * 1000us 161 // nn - Queue a decoder buffer with timestamp nn * 1000us
162 // abort - Queue an aborted read 162 // abort - Queue an aborted read
163 // error - Queue a decoder error 163 // error - Queue a decoder error
164 // 164 //
165 // Examples: 165 // Examples:
166 // A clip that is four frames long: "0 10 20 30" 166 // A clip that is four frames long: "0 10 20 30"
167 // A clip that has a decode error: "60 70 error" 167 // A clip that has a decode error: "60 70 error"
168 void QueueFrames(const std::string& str) { 168 void QueueFrames(const std::string& str) {
169 for (const std::string& token : 169 std::vector<std::string> tokens;
170 base::SplitString(str, " ", base::TRIM_WHITESPACE, 170 base::SplitString(str, ' ', &tokens);
171 base::SPLIT_WANT_ALL)) { 171 for (size_t i = 0; i < tokens.size(); ++i) {
172 if (token == "abort") { 172 if (tokens[i] == "abort") {
173 scoped_refptr<VideoFrame> null_frame; 173 scoped_refptr<VideoFrame> null_frame;
174 decode_results_.push_back( 174 decode_results_.push_back(
175 std::make_pair(VideoDecoder::kAborted, null_frame)); 175 std::make_pair(VideoDecoder::kAborted, null_frame));
176 continue; 176 continue;
177 } 177 }
178 178
179 if (token == "error") { 179 if (tokens[i] == "error") {
180 scoped_refptr<VideoFrame> null_frame; 180 scoped_refptr<VideoFrame> null_frame;
181 decode_results_.push_back( 181 decode_results_.push_back(
182 std::make_pair(VideoDecoder::kDecodeError, null_frame)); 182 std::make_pair(VideoDecoder::kDecodeError, null_frame));
183 continue; 183 continue;
184 } 184 }
185 185
186 int timestamp_in_ms = 0; 186 int timestamp_in_ms = 0;
187 if (base::StringToInt(token, &timestamp_in_ms)) { 187 if (base::StringToInt(tokens[i], &timestamp_in_ms)) {
188 gfx::Size natural_size = TestVideoConfig::NormalCodedSize(); 188 gfx::Size natural_size = TestVideoConfig::NormalCodedSize();
189 scoped_refptr<VideoFrame> frame = VideoFrame::CreateFrame( 189 scoped_refptr<VideoFrame> frame = VideoFrame::CreateFrame(
190 PIXEL_FORMAT_YV12, natural_size, gfx::Rect(natural_size), 190 PIXEL_FORMAT_YV12, natural_size, gfx::Rect(natural_size),
191 natural_size, base::TimeDelta::FromMilliseconds(timestamp_in_ms)); 191 natural_size, base::TimeDelta::FromMilliseconds(timestamp_in_ms));
192 decode_results_.push_back(std::make_pair(VideoDecoder::kOk, frame)); 192 decode_results_.push_back(std::make_pair(VideoDecoder::kOk, frame));
193 continue; 193 continue;
194 } 194 }
195 195
196 CHECK(false) << "Unrecognized decoder buffer token: " << token; 196 CHECK(false) << "Unrecognized decoder buffer token: " << tokens[i];
197 } 197 }
198 } 198 }
199 199
200 bool IsReadPending() { 200 bool IsReadPending() {
201 return !decode_cb_.is_null(); 201 return !decode_cb_.is_null();
202 } 202 }
203 203
204 void WaitForError(PipelineStatus expected) { 204 void WaitForError(PipelineStatus expected) {
205 SCOPED_TRACE(base::StringPrintf("WaitForError(%d)", expected)); 205 SCOPED_TRACE(base::StringPrintf("WaitForError(%d)", expected));
206 error_event_.RunAndWaitForStatus(expected); 206 error_event_.RunAndWaitForStatus(expected);
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 } 748 }
749 749
750 INSTANTIATE_TEST_CASE_P(OldVideoRenderer, 750 INSTANTIATE_TEST_CASE_P(OldVideoRenderer,
751 VideoRendererImplTest, 751 VideoRendererImplTest,
752 testing::Values(false)); 752 testing::Values(false));
753 INSTANTIATE_TEST_CASE_P(NewVideoRenderer, 753 INSTANTIATE_TEST_CASE_P(NewVideoRenderer,
754 VideoRendererImplTest, 754 VideoRendererImplTest,
755 testing::Values(true)); 755 testing::Values(true));
756 756
757 } // namespace media 757 } // namespace media
OLDNEW
« no previous file with comments | « media/formats/mp4/track_run_iterator_unittest.cc ('k') | remoting/protocol/negotiating_host_authenticator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698