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 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 0U) | 317 0U) |
318 << "Stream byte size is not a product of calculated frame byte size"; | 318 << "Stream byte size is not a product of calculated frame byte size"; |
319 CHECK_GT(test_stream->num_frames, 0UL); | 319 CHECK_GT(test_stream->num_frames, 0UL); |
320 } | 320 } |
321 | 321 |
322 // Parse |data| into its constituent parts, set the various output fields | 322 // Parse |data| into its constituent parts, set the various output fields |
323 // accordingly, read in video stream, and store them to |test_streams|. | 323 // accordingly, read in video stream, and store them to |test_streams|. |
324 static void ParseAndReadTestStreamData(const base::FilePath::StringType& data, | 324 static void ParseAndReadTestStreamData(const base::FilePath::StringType& data, |
325 ScopedVector<TestStream>* test_streams) { | 325 ScopedVector<TestStream>* test_streams) { |
326 // Split the string to individual test stream data. | 326 // Split the string to individual test stream data. |
327 std::vector<base::FilePath::StringType> test_streams_data; | 327 std::vector<base::FilePath::StringType> test_streams_data = base::SplitString( |
328 base::SplitString(data, ';', &test_streams_data); | 328 data, base::FilePath::StringType(1, ';'), |
| 329 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
329 CHECK_GE(test_streams_data.size(), 1U) << data; | 330 CHECK_GE(test_streams_data.size(), 1U) << data; |
330 | 331 |
331 // Parse each test stream data and read the input file. | 332 // Parse each test stream data and read the input file. |
332 for (size_t index = 0; index < test_streams_data.size(); ++index) { | 333 for (size_t index = 0; index < test_streams_data.size(); ++index) { |
333 std::vector<base::FilePath::StringType> fields; | 334 std::vector<base::FilePath::StringType> fields = base::SplitString( |
334 base::SplitString(test_streams_data[index], ':', &fields); | 335 test_streams_data[index], base::FilePath::StringType(1, ':'), |
| 336 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
335 CHECK_GE(fields.size(), 4U) << data; | 337 CHECK_GE(fields.size(), 4U) << data; |
336 CHECK_LE(fields.size(), 9U) << data; | 338 CHECK_LE(fields.size(), 9U) << data; |
337 TestStream* test_stream = new TestStream(); | 339 TestStream* test_stream = new TestStream(); |
338 | 340 |
339 test_stream->in_filename = fields[0]; | 341 test_stream->in_filename = fields[0]; |
340 int width, height; | 342 int width, height; |
341 CHECK(base::StringToInt(fields[1], &width)); | 343 CHECK(base::StringToInt(fields[1], &width)); |
342 CHECK(base::StringToInt(fields[2], &height)); | 344 CHECK(base::StringToInt(fields[2], &height)); |
343 test_stream->visible_size = gfx::Size(width, height); | 345 test_stream->visible_size = gfx::Size(width, height); |
344 CHECK(!test_stream->visible_size.IsEmpty()); | 346 CHECK(!test_stream->visible_size.IsEmpty()); |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1518 | 1520 |
1519 content::g_env = | 1521 content::g_env = |
1520 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( | 1522 reinterpret_cast<content::VideoEncodeAcceleratorTestEnvironment*>( |
1521 testing::AddGlobalTestEnvironment( | 1523 testing::AddGlobalTestEnvironment( |
1522 new content::VideoEncodeAcceleratorTestEnvironment( | 1524 new content::VideoEncodeAcceleratorTestEnvironment( |
1523 test_stream_data.Pass(), log_path, run_at_fps, | 1525 test_stream_data.Pass(), log_path, run_at_fps, |
1524 needs_encode_latency))); | 1526 needs_encode_latency))); |
1525 | 1527 |
1526 return RUN_ALL_TESTS(); | 1528 return RUN_ALL_TESTS(); |
1527 } | 1529 } |
OLD | NEW |