OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // This has to be included first. | 5 // This has to be included first. |
6 // See http://code.google.com/p/googletest/issues/detail?id=371 | 6 // See http://code.google.com/p/googletest/issues/detail?id=371 |
7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
8 | 8 |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
352 image_data_640x368_black_.reset( | 352 image_data_640x368_black_.reset( |
353 new TestImageFile(test_640x368_jpeg_file_.value())); | 353 new TestImageFile(test_640x368_jpeg_file_.value())); |
354 ASSERT_NO_FATAL_FAILURE(ReadTestJpegImage(test_640x368_jpeg_file_, | 354 ASSERT_NO_FATAL_FAILURE(ReadTestJpegImage(test_640x368_jpeg_file_, |
355 image_data_640x368_black_.get())); | 355 image_data_640x368_black_.get())); |
356 | 356 |
357 image_data_640x360_black_.reset( | 357 image_data_640x360_black_.reset( |
358 new TestImageFile(test_640x360_jpeg_file_.value())); | 358 new TestImageFile(test_640x360_jpeg_file_.value())); |
359 ASSERT_NO_FATAL_FAILURE(ReadTestJpegImage(test_640x360_jpeg_file_, | 359 ASSERT_NO_FATAL_FAILURE(ReadTestJpegImage(test_640x360_jpeg_file_, |
360 image_data_640x360_black_.get())); | 360 image_data_640x360_black_.get())); |
361 | 361 |
362 base::FilePath default_jpeg_file = GetTestDataFilePath(kDefaultJpegFilename); | 362 base::FilePath default_jpeg_file = |
| 363 GetOriginalOrTestDataFilePath(kDefaultJpegFilename); |
363 image_data_1280x720_default_.reset(new TestImageFile(kDefaultJpegFilename)); | 364 image_data_1280x720_default_.reset(new TestImageFile(kDefaultJpegFilename)); |
364 ASSERT_NO_FATAL_FAILURE( | 365 ASSERT_NO_FATAL_FAILURE( |
365 ReadTestJpegImage(default_jpeg_file, image_data_1280x720_default_.get())); | 366 ReadTestJpegImage(default_jpeg_file, image_data_1280x720_default_.get())); |
366 | 367 |
367 image_data_invalid_.reset(new TestImageFile("failure.jpg")); | 368 image_data_invalid_.reset(new TestImageFile("failure.jpg")); |
368 image_data_invalid_->data_str.resize(100, 0); | 369 image_data_invalid_->data_str.resize(100, 0); |
369 image_data_invalid_->visible_size.SetSize(1280, 720); | 370 image_data_invalid_->visible_size.SetSize(1280, 720); |
370 image_data_invalid_->output_size = VideoFrame::AllocationSize( | 371 image_data_invalid_->output_size = VideoFrame::AllocationSize( |
371 PIXEL_FORMAT_I420, image_data_invalid_->visible_size); | 372 PIXEL_FORMAT_I420, image_data_invalid_->visible_size); |
372 | 373 |
373 // |user_jpeg_filenames_| may include many files and use ';' as delimiter. | 374 // |user_jpeg_filenames_| may include many files and use ';' as delimiter. |
374 std::vector<base::FilePath::StringType> filenames = base::SplitString( | 375 std::vector<base::FilePath::StringType> filenames = base::SplitString( |
375 user_jpeg_filenames_, base::FilePath::StringType(1, ';'), | 376 user_jpeg_filenames_, base::FilePath::StringType(1, ';'), |
376 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 377 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
377 for (const auto& filename : filenames) { | 378 for (const auto& filename : filenames) { |
378 base::FilePath input_file = GetTestDataFilePath(filename); | 379 base::FilePath input_file = GetOriginalOrTestDataFilePath(filename); |
379 auto image_data = base::MakeUnique<TestImageFile>(filename); | 380 auto image_data = base::MakeUnique<TestImageFile>(filename); |
380 ASSERT_NO_FATAL_FAILURE(ReadTestJpegImage(input_file, image_data.get())); | 381 ASSERT_NO_FATAL_FAILURE(ReadTestJpegImage(input_file, image_data.get())); |
381 image_data_user_.push_back(std::move(image_data)); | 382 image_data_user_.push_back(std::move(image_data)); |
382 } | 383 } |
383 } | 384 } |
384 | 385 |
385 void JpegDecodeAcceleratorTestEnvironment::TearDown() { | 386 void JpegDecodeAcceleratorTestEnvironment::TearDown() { |
386 base::DeleteFile(test_1280x720_jpeg_file_, false); | 387 base::DeleteFile(test_1280x720_jpeg_file_, false); |
387 base::DeleteFile(test_640x368_jpeg_file_, false); | 388 base::DeleteFile(test_640x368_jpeg_file_, false); |
388 base::DeleteFile(test_640x360_jpeg_file_, false); | 389 base::DeleteFile(test_640x360_jpeg_file_, false); |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 584 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
584 media::VaapiWrapper::PreSandboxInitialization(); | 585 media::VaapiWrapper::PreSandboxInitialization(); |
585 #endif | 586 #endif |
586 | 587 |
587 media::g_env = reinterpret_cast<media::JpegDecodeAcceleratorTestEnvironment*>( | 588 media::g_env = reinterpret_cast<media::JpegDecodeAcceleratorTestEnvironment*>( |
588 testing::AddGlobalTestEnvironment( | 589 testing::AddGlobalTestEnvironment( |
589 new media::JpegDecodeAcceleratorTestEnvironment(jpeg_filenames))); | 590 new media::JpegDecodeAcceleratorTestEnvironment(jpeg_filenames))); |
590 | 591 |
591 return RUN_ALL_TESTS(); | 592 return RUN_ALL_TESTS(); |
592 } | 593 } |
OLD | NEW |