| 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> |
| 11 #include <string.h> | 11 #include <string.h> |
| 12 | 12 |
| 13 #include <memory> | 13 #include <memory> |
| 14 | 14 |
| 15 #include "base/at_exit.h" | 15 #include "base/at_exit.h" |
| 16 #include "base/bind.h" | 16 #include "base/bind.h" |
| 17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
| 18 #include "base/files/file_util.h" | 18 #include "base/files/file_util.h" |
| 19 #include "base/logging.h" | 19 #include "base/logging.h" |
| 20 #include "base/macros.h" | 20 #include "base/macros.h" |
| 21 #include "base/memory/scoped_vector.h" | 21 #include "base/memory/scoped_vector.h" |
| 22 #include "base/path_service.h" | 22 #include "base/path_service.h" |
| 23 #include "base/strings/string_piece.h" | 23 #include "base/strings/string_piece.h" |
| 24 #include "base/strings/string_split.h" | 24 #include "base/strings/string_split.h" |
| 25 #include "base/thread_task_runner_handle.h" | 25 #include "base/thread_task_runner_handle.h" |
| 26 #include "build/build_config.h" | 26 #include "build/build_config.h" |
| 27 #include "content/common/gpu/media/video_accelerator_unittest_helpers.h" | |
| 28 #include "media/base/test_data_util.h" | 27 #include "media/base/test_data_util.h" |
| 29 #include "media/filters/jpeg_parser.h" | 28 #include "media/filters/jpeg_parser.h" |
| 29 #include "media/gpu/video_accelerator_unittest_helpers.h" |
| 30 #include "media/video/jpeg_decode_accelerator.h" | 30 #include "media/video/jpeg_decode_accelerator.h" |
| 31 #include "third_party/libyuv/include/libyuv.h" | 31 #include "third_party/libyuv/include/libyuv.h" |
| 32 #include "ui/gfx/codec/jpeg_codec.h" | 32 #include "ui/gfx/codec/jpeg_codec.h" |
| 33 | 33 |
| 34 #if defined(OS_CHROMEOS) | 34 #if defined(OS_CHROMEOS) |
| 35 #if defined(USE_V4L2_CODEC) | 35 #if defined(USE_V4L2_CODEC) |
| 36 #include "content/common/gpu/media/v4l2_device.h" | 36 #include "media/gpu/v4l2_device.h" |
| 37 #include "content/common/gpu/media/v4l2_jpeg_decode_accelerator.h" | 37 #include "media/gpu/v4l2_jpeg_decode_accelerator.h" |
| 38 #endif | 38 #endif |
| 39 #if defined(ARCH_CPU_X86_FAMILY) | 39 #if defined(ARCH_CPU_X86_FAMILY) |
| 40 #include "content/common/gpu/media/vaapi_jpeg_decode_accelerator.h" | 40 #include "media/gpu/vaapi_jpeg_decode_accelerator.h" |
| 41 #include "content/common/gpu/media/vaapi_wrapper.h" | 41 #include "media/gpu/vaapi_wrapper.h" |
| 42 #endif | 42 #endif |
| 43 #endif | 43 #endif |
| 44 | 44 |
| 45 using media::JpegDecodeAccelerator; | 45 using media::JpegDecodeAccelerator; |
| 46 | 46 |
| 47 namespace content { | 47 namespace media { |
| 48 namespace { | 48 namespace { |
| 49 | 49 |
| 50 // Default test image file. | 50 // Default test image file. |
| 51 const base::FilePath::CharType* kDefaultJpegFilename = | 51 const base::FilePath::CharType* kDefaultJpegFilename = |
| 52 FILE_PATH_LITERAL("peach_pi-1280x720.jpg"); | 52 FILE_PATH_LITERAL("peach_pi-1280x720.jpg"); |
| 53 // Decide to save decode results to files or not. Output files will be saved | 53 // Decide to save decode results to files or not. Output files will be saved |
| 54 // in the same directory with unittest. File name is like input file but | 54 // in the same directory with unittest. File name is like input file but |
| 55 // changing the extension to "yuv". | 55 // changing the extension to "yuv". |
| 56 bool g_save_to_file = false; | 56 bool g_save_to_file = false; |
| 57 // Threshold for mean absolute difference of hardware and software decode. | 57 // Threshold for mean absolute difference of hardware and software decode. |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // Mapped memory of output buffer from hardware decoder. | 123 // Mapped memory of output buffer from hardware decoder. |
| 124 std::unique_ptr<base::SharedMemory> hw_out_shm_; | 124 std::unique_ptr<base::SharedMemory> hw_out_shm_; |
| 125 // Mapped memory of output buffer from software decoder. | 125 // Mapped memory of output buffer from software decoder. |
| 126 std::unique_ptr<base::SharedMemory> sw_out_shm_; | 126 std::unique_ptr<base::SharedMemory> sw_out_shm_; |
| 127 | 127 |
| 128 DISALLOW_COPY_AND_ASSIGN(JpegClient); | 128 DISALLOW_COPY_AND_ASSIGN(JpegClient); |
| 129 }; | 129 }; |
| 130 | 130 |
| 131 JpegClient::JpegClient(const std::vector<TestImageFile*>& test_image_files, | 131 JpegClient::JpegClient(const std::vector<TestImageFile*>& test_image_files, |
| 132 ClientStateNotification<ClientState>* note) | 132 ClientStateNotification<ClientState>* note) |
| 133 : test_image_files_(test_image_files), state_(CS_CREATED), note_(note) { | 133 : test_image_files_(test_image_files), state_(CS_CREATED), note_(note) {} |
| 134 } | |
| 135 | 134 |
| 136 JpegClient::~JpegClient() { | 135 JpegClient::~JpegClient() {} |
| 137 } | |
| 138 | 136 |
| 139 void JpegClient::CreateJpegDecoder() { | 137 void JpegClient::CreateJpegDecoder() { |
| 140 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 138 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 141 decoder_.reset( | 139 decoder_.reset( |
| 142 new VaapiJpegDecodeAccelerator(base::ThreadTaskRunnerHandle::Get())); | 140 new VaapiJpegDecodeAccelerator(base::ThreadTaskRunnerHandle::Get())); |
| 143 #elif defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) | 141 #elif defined(OS_CHROMEOS) && defined(USE_V4L2_CODEC) |
| 144 scoped_refptr<V4L2Device> device = | 142 scoped_refptr<V4L2Device> device = |
| 145 V4L2Device::Create(V4L2Device::kJpegDecoder); | 143 V4L2Device::Create(V4L2Device::kJpegDecoder); |
| 146 if (!device.get()) { | 144 if (!device.get()) { |
| 147 LOG(ERROR) << "V4L2Device::Create failed"; | 145 LOG(ERROR) << "V4L2Device::Create failed"; |
| (...skipping 24 matching lines...) Expand all Loading... |
| 172 } | 170 } |
| 173 if (g_save_to_file) { | 171 if (g_save_to_file) { |
| 174 SaveToFile(bitstream_buffer_id); | 172 SaveToFile(bitstream_buffer_id); |
| 175 } | 173 } |
| 176 | 174 |
| 177 double difference = GetMeanAbsoluteDifference(bitstream_buffer_id); | 175 double difference = GetMeanAbsoluteDifference(bitstream_buffer_id); |
| 178 if (difference <= kDecodeSimilarityThreshold) { | 176 if (difference <= kDecodeSimilarityThreshold) { |
| 179 SetState(CS_DECODE_PASS); | 177 SetState(CS_DECODE_PASS); |
| 180 } else { | 178 } else { |
| 181 LOG(ERROR) << "The mean absolute difference between software and hardware " | 179 LOG(ERROR) << "The mean absolute difference between software and hardware " |
| 182 "decode is " << difference; | 180 "decode is " |
| 181 << difference; |
| 183 SetState(CS_ERROR); | 182 SetState(CS_ERROR); |
| 184 } | 183 } |
| 185 } | 184 } |
| 186 | 185 |
| 187 void JpegClient::NotifyError(int32_t bitstream_buffer_id, | 186 void JpegClient::NotifyError(int32_t bitstream_buffer_id, |
| 188 JpegDecodeAccelerator::Error error) { | 187 JpegDecodeAccelerator::Error error) { |
| 189 LOG(ERROR) << "Notifying of error " << error << " for buffer id " | 188 LOG(ERROR) << "Notifying of error " << error << " for buffer id " |
| 190 << bitstream_buffer_id; | 189 << bitstream_buffer_id; |
| 191 SetState(CS_ERROR); | 190 SetState(CS_ERROR); |
| 192 } | 191 } |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 TestImageFile* image_file = test_image_files_[bitstream_buffer_id]; | 248 TestImageFile* image_file = test_image_files_[bitstream_buffer_id]; |
| 250 | 249 |
| 251 PrepareMemory(bitstream_buffer_id); | 250 PrepareMemory(bitstream_buffer_id); |
| 252 | 251 |
| 253 base::SharedMemoryHandle dup_handle; | 252 base::SharedMemoryHandle dup_handle; |
| 254 dup_handle = base::SharedMemory::DuplicateHandle(in_shm_->handle()); | 253 dup_handle = base::SharedMemory::DuplicateHandle(in_shm_->handle()); |
| 255 media::BitstreamBuffer bitstream_buffer(bitstream_buffer_id, dup_handle, | 254 media::BitstreamBuffer bitstream_buffer(bitstream_buffer_id, dup_handle, |
| 256 image_file->data_str.size()); | 255 image_file->data_str.size()); |
| 257 scoped_refptr<media::VideoFrame> out_frame_ = | 256 scoped_refptr<media::VideoFrame> out_frame_ = |
| 258 media::VideoFrame::WrapExternalSharedMemory( | 257 media::VideoFrame::WrapExternalSharedMemory( |
| 259 media::PIXEL_FORMAT_I420, | 258 media::PIXEL_FORMAT_I420, image_file->visible_size, |
| 260 image_file->visible_size, | 259 gfx::Rect(image_file->visible_size), image_file->visible_size, |
| 261 gfx::Rect(image_file->visible_size), | 260 static_cast<uint8_t*>(hw_out_shm_->memory()), image_file->output_size, |
| 262 image_file->visible_size, | 261 hw_out_shm_->handle(), 0, base::TimeDelta()); |
| 263 static_cast<uint8_t*>(hw_out_shm_->memory()), | |
| 264 image_file->output_size, | |
| 265 hw_out_shm_->handle(), | |
| 266 0, | |
| 267 base::TimeDelta()); | |
| 268 LOG_ASSERT(out_frame_.get()); | 262 LOG_ASSERT(out_frame_.get()); |
| 269 decoder_->Decode(bitstream_buffer, out_frame_); | 263 decoder_->Decode(bitstream_buffer, out_frame_); |
| 270 } | 264 } |
| 271 | 265 |
| 272 bool JpegClient::GetSoftwareDecodeResult(int32_t bitstream_buffer_id) { | 266 bool JpegClient::GetSoftwareDecodeResult(int32_t bitstream_buffer_id) { |
| 273 media::VideoPixelFormat format = media::PIXEL_FORMAT_I420; | 267 media::VideoPixelFormat format = media::PIXEL_FORMAT_I420; |
| 274 TestImageFile* image_file = test_image_files_[bitstream_buffer_id]; | 268 TestImageFile* image_file = test_image_files_[bitstream_buffer_id]; |
| 275 | 269 |
| 276 uint8_t* yplane = static_cast<uint8_t*>(sw_out_shm_->memory()); | 270 uint8_t* yplane = static_cast<uint8_t*>(sw_out_shm_->memory()); |
| 277 uint8_t* uplane = | 271 uint8_t* uplane = |
| 278 yplane + | 272 yplane + |
| 279 media::VideoFrame::PlaneSize(format, media::VideoFrame::kYPlane, | 273 media::VideoFrame::PlaneSize(format, media::VideoFrame::kYPlane, |
| 280 image_file->visible_size).GetArea(); | 274 image_file->visible_size) |
| 275 .GetArea(); |
| 281 uint8_t* vplane = | 276 uint8_t* vplane = |
| 282 uplane + | 277 uplane + |
| 283 media::VideoFrame::PlaneSize(format, media::VideoFrame::kUPlane, | 278 media::VideoFrame::PlaneSize(format, media::VideoFrame::kUPlane, |
| 284 image_file->visible_size).GetArea(); | 279 image_file->visible_size) |
| 280 .GetArea(); |
| 285 int yplane_stride = image_file->visible_size.width(); | 281 int yplane_stride = image_file->visible_size.width(); |
| 286 int uv_plane_stride = yplane_stride / 2; | 282 int uv_plane_stride = yplane_stride / 2; |
| 287 | 283 |
| 288 if (libyuv::ConvertToI420( | 284 if (libyuv::ConvertToI420( |
| 289 static_cast<uint8_t*>(in_shm_->memory()), | 285 static_cast<uint8_t*>(in_shm_->memory()), image_file->data_str.size(), |
| 290 image_file->data_str.size(), | 286 yplane, yplane_stride, uplane, uv_plane_stride, vplane, |
| 291 yplane, | 287 uv_plane_stride, 0, 0, image_file->visible_size.width(), |
| 292 yplane_stride, | 288 image_file->visible_size.height(), image_file->visible_size.width(), |
| 293 uplane, | 289 image_file->visible_size.height(), libyuv::kRotate0, |
| 294 uv_plane_stride, | |
| 295 vplane, | |
| 296 uv_plane_stride, | |
| 297 0, | |
| 298 0, | |
| 299 image_file->visible_size.width(), | |
| 300 image_file->visible_size.height(), | |
| 301 image_file->visible_size.width(), | |
| 302 image_file->visible_size.height(), | |
| 303 libyuv::kRotate0, | |
| 304 libyuv::FOURCC_MJPG) != 0) { | 290 libyuv::FOURCC_MJPG) != 0) { |
| 305 LOG(ERROR) << "Software decode " << image_file->filename << " failed."; | 291 LOG(ERROR) << "Software decode " << image_file->filename << " failed."; |
| 306 return false; | 292 return false; |
| 307 } | 293 } |
| 308 return true; | 294 return true; |
| 309 } | 295 } |
| 310 | 296 |
| 311 class JpegDecodeAcceleratorTestEnvironment : public ::testing::Environment { | 297 class JpegDecodeAcceleratorTestEnvironment : public ::testing::Environment { |
| 312 public: | 298 public: |
| 313 JpegDecodeAcceleratorTestEnvironment( | 299 JpegDecodeAcceleratorTestEnvironment( |
| 314 const base::FilePath::CharType* jpeg_filenames) { | 300 const base::FilePath::CharType* jpeg_filenames) { |
| 315 user_jpeg_filenames_ = | 301 user_jpeg_filenames_ = |
| 316 jpeg_filenames ? jpeg_filenames: kDefaultJpegFilename; | 302 jpeg_filenames ? jpeg_filenames : kDefaultJpegFilename; |
| 317 } | 303 } |
| 318 void SetUp() override; | 304 void SetUp() override; |
| 319 void TearDown() override; | 305 void TearDown() override; |
| 320 | 306 |
| 321 // Create all black test image with |width| and |height| size. | 307 // Create all black test image with |width| and |height| size. |
| 322 bool CreateTestJpegImage(int width, int height, base::FilePath* filename); | 308 bool CreateTestJpegImage(int width, int height, base::FilePath* filename); |
| 323 | 309 |
| 324 // Read image from |filename| to |image_data|. | 310 // Read image from |filename| to |image_data|. |
| 325 void ReadTestJpegImage(base::FilePath& filename, TestImageFile* image_data); | 311 void ReadTestJpegImage(base::FilePath& filename, TestImageFile* image_data); |
| 326 | 312 |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 return false; | 400 return false; |
| 415 } | 401 } |
| 416 | 402 |
| 417 LOG_ASSERT(base::CreateTemporaryFile(filename)); | 403 LOG_ASSERT(base::CreateTemporaryFile(filename)); |
| 418 EXPECT_TRUE(base::AppendToFile( | 404 EXPECT_TRUE(base::AppendToFile( |
| 419 *filename, reinterpret_cast<char*>(&encoded[0]), encoded.size())); | 405 *filename, reinterpret_cast<char*>(&encoded[0]), encoded.size())); |
| 420 return true; | 406 return true; |
| 421 } | 407 } |
| 422 | 408 |
| 423 void JpegDecodeAcceleratorTestEnvironment::ReadTestJpegImage( | 409 void JpegDecodeAcceleratorTestEnvironment::ReadTestJpegImage( |
| 424 base::FilePath& input_file, TestImageFile* image_data) { | 410 base::FilePath& input_file, |
| 411 TestImageFile* image_data) { |
| 425 ASSERT_TRUE(base::ReadFileToString(input_file, &image_data->data_str)); | 412 ASSERT_TRUE(base::ReadFileToString(input_file, &image_data->data_str)); |
| 426 | 413 |
| 427 ASSERT_TRUE(media::ParseJpegPicture( | 414 ASSERT_TRUE(media::ParseJpegPicture( |
| 428 reinterpret_cast<const uint8_t*>(image_data->data_str.data()), | 415 reinterpret_cast<const uint8_t*>(image_data->data_str.data()), |
| 429 image_data->data_str.size(), | 416 image_data->data_str.size(), &image_data->parse_result)); |
| 430 &image_data->parse_result)); | |
| 431 image_data->visible_size.SetSize( | 417 image_data->visible_size.SetSize( |
| 432 image_data->parse_result.frame_header.visible_width, | 418 image_data->parse_result.frame_header.visible_width, |
| 433 image_data->parse_result.frame_header.visible_height); | 419 image_data->parse_result.frame_header.visible_height); |
| 434 image_data->output_size = media::VideoFrame::AllocationSize( | 420 image_data->output_size = media::VideoFrame::AllocationSize( |
| 435 media::PIXEL_FORMAT_I420, image_data->visible_size); | 421 media::PIXEL_FORMAT_I420, image_data->visible_size); |
| 436 } | 422 } |
| 437 | 423 |
| 438 class JpegDecodeAcceleratorTest : public ::testing::Test { | 424 class JpegDecodeAcceleratorTest : public ::testing::Test { |
| 439 protected: | 425 protected: |
| 440 JpegDecodeAcceleratorTest() {} | 426 JpegDecodeAcceleratorTest() {} |
| (...skipping 23 matching lines...) Expand all Loading... |
| 464 decoder_thread.task_runner()->PostTask( | 450 decoder_thread.task_runner()->PostTask( |
| 465 FROM_HERE, base::Bind(&JpegClient::CreateJpegDecoder, | 451 FROM_HERE, base::Bind(&JpegClient::CreateJpegDecoder, |
| 466 base::Unretained(clients.back()))); | 452 base::Unretained(clients.back()))); |
| 467 ASSERT_EQ(notes[i]->Wait(), CS_INITIALIZED); | 453 ASSERT_EQ(notes[i]->Wait(), CS_INITIALIZED); |
| 468 } | 454 } |
| 469 | 455 |
| 470 for (size_t index = 0; index < test_image_files_.size(); index++) { | 456 for (size_t index = 0; index < test_image_files_.size(); index++) { |
| 471 for (size_t i = 0; i < num_concurrent_decoders; i++) { | 457 for (size_t i = 0; i < num_concurrent_decoders; i++) { |
| 472 decoder_thread.task_runner()->PostTask( | 458 decoder_thread.task_runner()->PostTask( |
| 473 FROM_HERE, base::Bind(&JpegClient::StartDecode, | 459 FROM_HERE, base::Bind(&JpegClient::StartDecode, |
| 474 base::Unretained(clients[i]), | 460 base::Unretained(clients[i]), index)); |
| 475 index)); | |
| 476 } | 461 } |
| 477 for (size_t i = 0; i < num_concurrent_decoders; i++) { | 462 for (size_t i = 0; i < num_concurrent_decoders; i++) { |
| 478 ASSERT_EQ(notes[i]->Wait(), expected_status_[index]); | 463 ASSERT_EQ(notes[i]->Wait(), expected_status_[index]); |
| 479 } | 464 } |
| 480 } | 465 } |
| 481 | 466 |
| 482 for (size_t i = 0; i < num_concurrent_decoders; i++) { | 467 for (size_t i = 0; i < num_concurrent_decoders; i++) { |
| 483 decoder_thread.task_runner()->PostTask( | 468 decoder_thread.task_runner()->PostTask( |
| 484 FROM_HERE, base::Bind(&JpegClient::DestroyJpegDecoder, | 469 FROM_HERE, base::Bind(&JpegClient::DestroyJpegDecoder, |
| 485 base::Unretained(clients[i]))); | 470 base::Unretained(clients[i]))); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 537 | 522 |
| 538 TEST_F(JpegDecodeAcceleratorTest, KeepDecodeAfterFailure) { | 523 TEST_F(JpegDecodeAcceleratorTest, KeepDecodeAfterFailure) { |
| 539 test_image_files_.push_back(g_env->image_data_invalid_.get()); | 524 test_image_files_.push_back(g_env->image_data_invalid_.get()); |
| 540 test_image_files_.push_back(g_env->image_data_1280x720_default_.get()); | 525 test_image_files_.push_back(g_env->image_data_1280x720_default_.get()); |
| 541 expected_status_.push_back(CS_ERROR); | 526 expected_status_.push_back(CS_ERROR); |
| 542 expected_status_.push_back(CS_DECODE_PASS); | 527 expected_status_.push_back(CS_DECODE_PASS); |
| 543 TestDecode(1); | 528 TestDecode(1); |
| 544 } | 529 } |
| 545 | 530 |
| 546 } // namespace | 531 } // namespace |
| 547 } // namespace content | 532 } // namespace media |
| 548 | 533 |
| 549 int main(int argc, char** argv) { | 534 int main(int argc, char** argv) { |
| 550 testing::InitGoogleTest(&argc, argv); | 535 testing::InitGoogleTest(&argc, argv); |
| 551 base::CommandLine::Init(argc, argv); | 536 base::CommandLine::Init(argc, argv); |
| 552 base::ShadowingAtExitManager at_exit_manager; | 537 base::ShadowingAtExitManager at_exit_manager; |
| 553 | 538 |
| 554 // Needed to enable DVLOG through --vmodule. | 539 // Needed to enable DVLOG through --vmodule. |
| 555 logging::LoggingSettings settings; | 540 logging::LoggingSettings settings; |
| 556 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 541 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 557 LOG_ASSERT(logging::InitLogging(settings)); | 542 LOG_ASSERT(logging::InitLogging(settings)); |
| 558 | 543 |
| 559 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); | 544 const base::CommandLine* cmd_line = base::CommandLine::ForCurrentProcess(); |
| 560 DCHECK(cmd_line); | 545 DCHECK(cmd_line); |
| 561 | 546 |
| 562 const base::FilePath::CharType* jpeg_filenames = nullptr; | 547 const base::FilePath::CharType* jpeg_filenames = nullptr; |
| 563 base::CommandLine::SwitchMap switches = cmd_line->GetSwitches(); | 548 base::CommandLine::SwitchMap switches = cmd_line->GetSwitches(); |
| 564 for (base::CommandLine::SwitchMap::const_iterator it = switches.begin(); | 549 for (base::CommandLine::SwitchMap::const_iterator it = switches.begin(); |
| 565 it != switches.end(); ++it) { | 550 it != switches.end(); ++it) { |
| 566 // jpeg_filenames can include one or many files and use ';' as delimiter. | 551 // jpeg_filenames can include one or many files and use ';' as delimiter. |
| 567 if (it->first == "jpeg_filenames") { | 552 if (it->first == "jpeg_filenames") { |
| 568 jpeg_filenames = it->second.c_str(); | 553 jpeg_filenames = it->second.c_str(); |
| 569 continue; | 554 continue; |
| 570 } | 555 } |
| 571 if (it->first == "save_to_file") { | 556 if (it->first == "save_to_file") { |
| 572 content::g_save_to_file = true; | 557 media::g_save_to_file = true; |
| 573 continue; | 558 continue; |
| 574 } | 559 } |
| 575 if (it->first == "v" || it->first == "vmodule") | 560 if (it->first == "v" || it->first == "vmodule") |
| 576 continue; | 561 continue; |
| 577 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 562 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| 578 } | 563 } |
| 579 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) | 564 #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) |
| 580 content::VaapiWrapper::PreSandboxInitialization(); | 565 media::VaapiWrapper::PreSandboxInitialization(); |
| 581 #endif | 566 #endif |
| 582 | 567 |
| 583 content::g_env = | 568 media::g_env = reinterpret_cast<media::JpegDecodeAcceleratorTestEnvironment*>( |
| 584 reinterpret_cast<content::JpegDecodeAcceleratorTestEnvironment*>( | 569 testing::AddGlobalTestEnvironment( |
| 585 testing::AddGlobalTestEnvironment( | 570 new media::JpegDecodeAcceleratorTestEnvironment(jpeg_filenames))); |
| 586 new content::JpegDecodeAcceleratorTestEnvironment( | |
| 587 jpeg_filenames))); | |
| 588 | 571 |
| 589 return RUN_ALL_TESTS(); | 572 return RUN_ALL_TESTS(); |
| 590 } | 573 } |
| OLD | NEW |