Chromium Code Reviews| Index: gpu/ipc/common/struct_traits_unittest.cc |
| diff --git a/gpu/ipc/common/struct_traits_unittest.cc b/gpu/ipc/common/struct_traits_unittest.cc |
| index a589c05c609767e77b80e530bc50ffeb612f34d2..8cab89253b4d7a99167fbe91fed22f36e8434805 100644 |
| --- a/gpu/ipc/common/struct_traits_unittest.cc |
| +++ b/gpu/ipc/common/struct_traits_unittest.cc |
| @@ -24,6 +24,11 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService { |
| private: |
| // TraitsTestService: |
| + void EchoDxDiagNode(const DxDiagNode& d, |
| + const EchoDxDiagNodeCallback& callback) override { |
| + callback.Run(d); |
| + } |
| + |
| void EchoGpuDevice(const GPUInfo::GPUDevice& g, |
| const EchoGpuDeviceCallback& callback) override { |
| callback.Run(g); |
| @@ -44,6 +49,26 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService { |
| callback.Run(s); |
| } |
| + void EchoVideoDecodeAcceleratorSupportedProfile( |
| + const VideoDecodeAcceleratorSupportedProfile& v, |
| + const EchoVideoDecodeAcceleratorSupportedProfileCallback& callback) |
| + override { |
| + callback.Run(v); |
| + } |
| + |
| + void EchoVideoDecodeAcceleratorCapabilities( |
| + const VideoDecodeAcceleratorCapabilities& v, |
| + const EchoVideoDecodeAcceleratorCapabilitiesCallback& callback) override { |
| + callback.Run(v); |
| + } |
| + |
| + void EchoVideoEncodeAcceleratorSupportedProfile( |
| + const VideoEncodeAcceleratorSupportedProfile& v, |
| + const EchoVideoEncodeAcceleratorSupportedProfileCallback& callback) |
| + override { |
| + callback.Run(v); |
| + } |
| + |
| base::MessageLoop loop_; |
| mojo::BindingSet<TraitsTestService> traits_test_bindings_; |
| @@ -52,6 +77,18 @@ class StructTraitsTest : public testing::Test, public mojom::TraitsTestService { |
| } // namespace |
| +TEST_F(StructTraitsTest, DxDiagNode) { |
| + gpu::DxDiagNode input; |
| + input.values["abc"] = "123"; |
| + mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| + gpu::DxDiagNode output; |
| + proxy->EchoDxDiagNode(input, &output); |
| + |
| + gpu::DxDiagNode test_dx_diag_node; |
| + test_dx_diag_node.values["abc"] = "123"; |
| + EXPECT_EQ(test_dx_diag_node.values, output.values); |
| +} |
| + |
| TEST_F(StructTraitsTest, GPUDevice) { |
| gpu::GPUInfo::GPUDevice input; |
| // Using the values from gpu/config/gpu_info_collector_unittest.cc::nvidia_gpu |
| @@ -138,4 +175,63 @@ TEST_F(StructTraitsTest, SyncToken) { |
| EXPECT_EQ(verified_flush, output.verified_flush()); |
| } |
| +TEST_F(StructTraitsTest, VideoDecodeAcceleratorSupportedProfile) { |
| + const gpu::VideoCodecProfile profile = |
| + gpu::VideoCodecProfile::H264PROFILE_MAIN; |
| + const int32_t max_width = 1920; |
| + const int32_t max_height = 1080; |
| + const int32_t min_width = 640; |
| + const int32_t min_height = 480; |
| + const gfx::Size max_resolution(max_width, max_height); |
| + const gfx::Size min_resolution(min_width, min_height); |
| + |
| + gpu::VideoDecodeAcceleratorSupportedProfile input; |
| + input.profile = profile; |
| + input.max_resolution = max_resolution; |
| + input.min_resolution = min_resolution; |
| + input.encrypted_only = false; |
| + |
| + mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| + gpu::VideoDecodeAcceleratorSupportedProfile output; |
| + proxy->EchoVideoDecodeAcceleratorSupportedProfile(input, &output); |
| + EXPECT_EQ(profile, output.profile); |
| + EXPECT_EQ(max_resolution, output.max_resolution); |
| + EXPECT_EQ(min_resolution, output.min_resolution); |
| + EXPECT_FALSE(output.encrypted_only); |
| +} |
| + |
| +TEST_F(StructTraitsTest, VideoDecodeAcceleratorCapabilities) { |
| + const uint32_t flags = 1234; |
| + |
| + gpu::VideoDecodeAcceleratorCapabilities input; |
| + input.flags = flags; |
| + |
| + mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| + gpu::VideoDecodeAcceleratorCapabilities output; |
| + proxy->EchoVideoDecodeAcceleratorCapabilities(input, &output); |
| + EXPECT_EQ(flags, output.flags); |
| +} |
| + |
| +TEST_F(StructTraitsTest, VideoEncodeAcceleratorSupportedProfile) { |
| + const gpu::VideoCodecProfile profile = |
| + gpu::VideoCodecProfile::H264PROFILE_MAIN; |
| + const gfx::Size max_resolution(1920, 1080); |
| + uint32_t max_framerate_numerator = 144; |
|
Fady Samuel
2016/07/19 16:47:40
const
Alex Z.
2016/07/19 17:27:12
Done.
|
| + uint32_t max_framerate_denominator = 12; |
|
Fady Samuel
2016/07/19 16:47:40
const
Alex Z.
2016/07/19 17:27:12
Done.
|
| + |
| + gpu::VideoEncodeAcceleratorSupportedProfile input; |
| + input.profile = profile; |
| + input.max_resolution = max_resolution; |
| + input.max_framerate_numerator = max_framerate_numerator; |
| + input.max_framerate_denominator = max_framerate_denominator; |
| + |
| + mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| + gpu::VideoEncodeAcceleratorSupportedProfile output; |
| + proxy->EchoVideoEncodeAcceleratorSupportedProfile(input, &output); |
| + EXPECT_EQ(profile, output.profile); |
| + EXPECT_EQ(max_resolution, output.max_resolution); |
| + EXPECT_EQ(max_framerate_numerator, output.max_framerate_numerator); |
| + EXPECT_EQ(max_framerate_denominator, output.max_framerate_denominator); |
| +} |
| + |
| } // namespace gpu |