| 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 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 385 void JpegDecodeAcceleratorTestEnvironment::TearDown() { | 385 void JpegDecodeAcceleratorTestEnvironment::TearDown() { |
| 386 base::DeleteFile(test_1280x720_jpeg_file_, false); | 386 base::DeleteFile(test_1280x720_jpeg_file_, false); |
| 387 base::DeleteFile(test_640x368_jpeg_file_, false); | 387 base::DeleteFile(test_640x368_jpeg_file_, false); |
| 388 base::DeleteFile(test_640x360_jpeg_file_, false); | 388 base::DeleteFile(test_640x360_jpeg_file_, false); |
| 389 } | 389 } |
| 390 | 390 |
| 391 bool JpegDecodeAcceleratorTestEnvironment::CreateTestJpegImage( | 391 bool JpegDecodeAcceleratorTestEnvironment::CreateTestJpegImage( |
| 392 int width, | 392 int width, |
| 393 int height, | 393 int height, |
| 394 base::FilePath* filename) { | 394 base::FilePath* filename) { |
| 395 const int kBytesPerPixel = 3; | 395 const int kBytesPerPixel = 4; |
| 396 const int kJpegQuality = 100; | 396 const int kJpegQuality = 100; |
| 397 std::vector<unsigned char> input_buffer(width * height * kBytesPerPixel); | 397 std::vector<unsigned char> input_buffer(width * height * kBytesPerPixel); |
| 398 std::vector<unsigned char> encoded; | 398 std::vector<unsigned char> encoded; |
| 399 if (!gfx::JPEGCodec::Encode(&input_buffer[0], gfx::JPEGCodec::FORMAT_RGB, | 399 if (!gfx::JPEGCodec::Encode(&input_buffer[0], gfx::JPEGCodec::FORMAT_RGBA, |
| 400 width, height, width * kBytesPerPixel, | 400 width, height, width * kBytesPerPixel, |
| 401 kJpegQuality, &encoded)) { | 401 kJpegQuality, &encoded)) { |
| 402 return false; | 402 return false; |
| 403 } | 403 } |
| 404 | 404 |
| 405 LOG_ASSERT(base::CreateTemporaryFile(filename)); | 405 LOG_ASSERT(base::CreateTemporaryFile(filename)); |
| 406 EXPECT_TRUE(base::AppendToFile( | 406 EXPECT_TRUE(base::AppendToFile( |
| 407 *filename, reinterpret_cast<char*>(&encoded[0]), encoded.size())); | 407 *filename, reinterpret_cast<char*>(&encoded[0]), encoded.size())); |
| 408 return true; | 408 return true; |
| 409 } | 409 } |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 583 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 583 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 584 media::VaapiWrapper::PreSandboxInitialization(); | 584 media::VaapiWrapper::PreSandboxInitialization(); |
| 585 #endif | 585 #endif |
| 586 | 586 |
| 587 media::g_env = reinterpret_cast<media::JpegDecodeAcceleratorTestEnvironment*>( | 587 media::g_env = reinterpret_cast<media::JpegDecodeAcceleratorTestEnvironment*>( |
| 588 testing::AddGlobalTestEnvironment( | 588 testing::AddGlobalTestEnvironment( |
| 589 new media::JpegDecodeAcceleratorTestEnvironment(jpeg_filenames))); | 589 new media::JpegDecodeAcceleratorTestEnvironment(jpeg_filenames))); |
| 590 | 590 |
| 591 return RUN_ALL_TESTS(); | 591 return RUN_ALL_TESTS(); |
| 592 } | 592 } |
| OLD | NEW |