OLD | NEW |
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 <inttypes.h> | 5 #include <inttypes.h> |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 0U) | 297 0U) |
298 << "Stream byte size is not a product of calculated frame byte size"; | 298 << "Stream byte size is not a product of calculated frame byte size"; |
299 CHECK_GT(test_stream->num_frames, 0UL); | 299 CHECK_GT(test_stream->num_frames, 0UL); |
300 } | 300 } |
301 | 301 |
302 // Parse |data| into its constituent parts, set the various output fields | 302 // Parse |data| into its constituent parts, set the various output fields |
303 // accordingly, read in video stream, and store them to |test_streams|. | 303 // accordingly, read in video stream, and store them to |test_streams|. |
304 static void ParseAndReadTestStreamData(const base::FilePath::StringType& data, | 304 static void ParseAndReadTestStreamData(const base::FilePath::StringType& data, |
305 ScopedVector<TestStream>* test_streams) { | 305 ScopedVector<TestStream>* test_streams) { |
306 // Split the string to individual test stream data. | 306 // Split the string to individual test stream data. |
307 std::vector<base::FilePath::StringType> test_streams_data; | 307 std::vector<base::FilePath::StringType> test_streams_data = base::SplitString( |
308 base::SplitString(data, ';', &test_streams_data); | 308 data, base::FilePath::StringType(1, ';'), |
| 309 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
309 CHECK_GE(test_streams_data.size(), 1U) << data; | 310 CHECK_GE(test_streams_data.size(), 1U) << data; |
310 | 311 |
311 // Parse each test stream data and read the input file. | 312 // Parse each test stream data and read the input file. |
312 for (size_t index = 0; index < test_streams_data.size(); ++index) { | 313 for (size_t index = 0; index < test_streams_data.size(); ++index) { |
313 std::vector<base::FilePath::StringType> fields; | 314 std::vector<base::FilePath::StringType> fields = base::SplitString( |
314 base::SplitString(test_streams_data[index], ':', &fields); | 315 test_streams_data[index], base::FilePath::StringType(1, ':'), |
| 316 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
315 CHECK_GE(fields.size(), 4U) << data; | 317 CHECK_GE(fields.size(), 4U) << data; |
316 CHECK_LE(fields.size(), 9U) << data; | 318 CHECK_LE(fields.size(), 9U) << data; |
317 TestStream* test_stream = new TestStream(); | 319 TestStream* test_stream = new TestStream(); |
318 | 320 |
319 test_stream->in_filename = fields[0]; | 321 test_stream->in_filename = fields[0]; |
320 int width, height; | 322 int width, height; |
321 CHECK(base::StringToInt(fields[1], &width)); | 323 CHECK(base::StringToInt(fields[1], &width)); |
322 CHECK(base::StringToInt(fields[2], &height)); | 324 CHECK(base::StringToInt(fields[2], &height)); |
323 test_stream->visible_size = gfx::Size(width, height); | 325 test_stream->visible_size = gfx::Size(width, height); |
324 CHECK(!test_stream->visible_size.IsEmpty()); | 326 CHECK(!test_stream->visible_size.IsEmpty()); |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1496 | 1498 |
1497 content::g_env = | 1499 content::g_env = |
1498 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( | 1500 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( |
1499 testing::AddGlobalTestEnvironment( | 1501 testing::AddGlobalTestEnvironment( |
1500 new content::VideoEncodeAcceleratorTestEnvironment( | 1502 new content::VideoEncodeAcceleratorTestEnvironment( |
1501 test_stream_data.Pass(), log_path, run_at_fps, | 1503 test_stream_data.Pass(), log_path, run_at_fps, |
1502 needs_encode_latency))); | 1504 needs_encode_latency))); |
1503 | 1505 |
1504 return RUN_ALL_TESTS(); | 1506 return RUN_ALL_TESTS(); |
1505 } | 1507 } |
OLD | NEW |