OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h" | 5 #include "media/gpu/ipc/service/gpu_jpeg_decode_accelerator.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/test/scoped_task_environment.h" | 9 #include "base/test/scoped_task_environment.h" |
10 #include "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 const scoped_refptr<media::VideoFrame>&)); | 38 const scoped_refptr<media::VideoFrame>&)); |
39 MOCK_METHOD0(IsSupported, bool()); | 39 MOCK_METHOD0(IsSupported, bool()); |
40 }; | 40 }; |
41 | 41 |
42 // Test fixture for the unit that is created via the constructor of | 42 // Test fixture for the unit that is created via the constructor of |
43 // class GpuJpegDecodeAccelerator. Uses a FakeJpegDecodeAccelerator to | 43 // class GpuJpegDecodeAccelerator. Uses a FakeJpegDecodeAccelerator to |
44 // simulate the actual decoding without the need for special hardware. | 44 // simulate the actual decoding without the need for special hardware. |
45 class GpuJpegDecodeAcceleratorTest : public ::testing::Test { | 45 class GpuJpegDecodeAcceleratorTest : public ::testing::Test { |
46 public: | 46 public: |
47 GpuJpegDecodeAcceleratorTest() : io_thread_("io") {} | 47 GpuJpegDecodeAcceleratorTest() : io_thread_("io") {} |
48 ~GpuJpegDecodeAcceleratorTest() override{}; | 48 ~GpuJpegDecodeAcceleratorTest() override {} |
49 | 49 |
50 void SetUp() override { | 50 void SetUp() override { |
51 output_frame_memory_.CreateAndMapAnonymous(kOutputFrameSizeInBytes); | 51 output_frame_memory_.CreateAndMapAnonymous(kOutputFrameSizeInBytes); |
52 io_thread_.Start(); | 52 io_thread_.Start(); |
53 std::vector<GpuJpegDecodeAcceleratorFactoryProvider::CreateAcceleratorCB> | 53 std::vector<GpuJpegDecodeAcceleratorFactoryProvider::CreateAcceleratorCB> |
54 accelerator_factory_functions; | 54 accelerator_factory_functions; |
55 accelerator_factory_functions.push_back( | 55 accelerator_factory_functions.push_back( |
56 base::Bind(&GpuJpegDecodeAcceleratorTest::GetMockJpegDecodeAccelerator, | 56 base::Bind(&GpuJpegDecodeAcceleratorTest::GetMockJpegDecodeAccelerator, |
57 base::Unretained(this))); | 57 base::Unretained(this))); |
58 system_under_test_ = base::MakeUnique<GpuJpegDecodeAccelerator>( | 58 system_under_test_ = base::MakeUnique<GpuJpegDecodeAccelerator>( |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 EXPECT_CALL(*decoder_ptr, Decode(_, _)); | 123 EXPECT_CALL(*decoder_ptr, Decode(_, _)); |
124 io_task_runner->PostTaskAndReply( | 124 io_task_runner->PostTaskAndReply( |
125 FROM_HERE, | 125 FROM_HERE, |
126 base::Bind(&GpuJpegDecodeAcceleratorTest::SendStubFrame, | 126 base::Bind(&GpuJpegDecodeAcceleratorTest::SendStubFrame, |
127 base::Unretained(this), message_filter, kArbitraryRouteId), | 127 base::Unretained(this), message_filter, kArbitraryRouteId), |
128 run_loop2.QuitClosure()); | 128 run_loop2.QuitClosure()); |
129 run_loop2.Run(); | 129 run_loop2.Run(); |
130 } | 130 } |
131 | 131 |
132 } // namespace media | 132 } // namespace media |
OLD | NEW |