| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "gpu/ipc/common/traits_test_service.mojom.h" | 8 #include "gpu/ipc/common/traits_test_service.mojom.h" |
| 9 #include "mojo/public/cpp/bindings/binding_set.h" | 9 #include "mojo/public/cpp/bindings/binding_set.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 callback.Run(v); | 67 callback.Run(v); |
| 68 } | 68 } |
| 69 | 69 |
| 70 void EchoVideoEncodeAcceleratorSupportedProfile( | 70 void EchoVideoEncodeAcceleratorSupportedProfile( |
| 71 const VideoEncodeAcceleratorSupportedProfile& v, | 71 const VideoEncodeAcceleratorSupportedProfile& v, |
| 72 const EchoVideoEncodeAcceleratorSupportedProfileCallback& callback) | 72 const EchoVideoEncodeAcceleratorSupportedProfileCallback& callback) |
| 73 override { | 73 override { |
| 74 callback.Run(v); | 74 callback.Run(v); |
| 75 } | 75 } |
| 76 | 76 |
| 77 void EchoGpuPreferences(const GpuPreferences& prefs, |
| 78 const EchoGpuPreferencesCallback& callback) override { |
| 79 callback.Run(prefs); |
| 80 } |
| 81 |
| 77 base::MessageLoop loop_; | 82 base::MessageLoop loop_; |
| 78 mojo::BindingSet<TraitsTestService> traits_test_bindings_; | 83 mojo::BindingSet<TraitsTestService> traits_test_bindings_; |
| 79 | 84 |
| 80 DISALLOW_COPY_AND_ASSIGN(StructTraitsTest); | 85 DISALLOW_COPY_AND_ASSIGN(StructTraitsTest); |
| 81 }; | 86 }; |
| 82 | 87 |
| 83 } // namespace | 88 } // namespace |
| 84 | 89 |
| 85 TEST_F(StructTraitsTest, DxDiagNode) { | 90 TEST_F(StructTraitsTest, DxDiagNode) { |
| 86 gpu::DxDiagNode input; | 91 gpu::DxDiagNode input; |
| (...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 421 |
| 417 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 422 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| 418 gpu::VideoEncodeAcceleratorSupportedProfile output; | 423 gpu::VideoEncodeAcceleratorSupportedProfile output; |
| 419 proxy->EchoVideoEncodeAcceleratorSupportedProfile(input, &output); | 424 proxy->EchoVideoEncodeAcceleratorSupportedProfile(input, &output); |
| 420 EXPECT_EQ(profile, output.profile); | 425 EXPECT_EQ(profile, output.profile); |
| 421 EXPECT_EQ(max_resolution, output.max_resolution); | 426 EXPECT_EQ(max_resolution, output.max_resolution); |
| 422 EXPECT_EQ(max_framerate_numerator, output.max_framerate_numerator); | 427 EXPECT_EQ(max_framerate_numerator, output.max_framerate_numerator); |
| 423 EXPECT_EQ(max_framerate_denominator, output.max_framerate_denominator); | 428 EXPECT_EQ(max_framerate_denominator, output.max_framerate_denominator); |
| 424 } | 429 } |
| 425 | 430 |
| 431 TEST_F(StructTraitsTest, GpuPreferences) { |
| 432 GpuPreferences prefs; |
| 433 prefs.single_process = true; |
| 434 prefs.in_process_gpu = true; |
| 435 prefs.ui_prioritize_in_gpu_process = true; |
| 436 #if defined(OS_WIN) |
| 437 const GpuPreferences::VpxDecodeVendors vendor = |
| 438 GpuPreferences::VPX_VENDOR_AMD; |
| 439 prefs.enable_accelerated_vpx_decode = vendor; |
| 440 #endif |
| 441 prefs.enable_gpu_driver_debug_logging = true; |
| 442 |
| 443 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| 444 GpuPreferences echo; |
| 445 proxy->EchoGpuPreferences(prefs, &echo); |
| 446 EXPECT_TRUE(echo.single_process); |
| 447 EXPECT_TRUE(echo.in_process_gpu); |
| 448 EXPECT_TRUE(echo.ui_prioritize_in_gpu_process); |
| 449 EXPECT_TRUE(echo.enable_gpu_driver_debug_logging); |
| 450 #if defined(OS_WIN) |
| 451 EXPECT_EQ(vendor, echo.enable_accelerated_vpx_decode); |
| 452 #endif |
| 453 } |
| 454 |
| 426 } // namespace gpu | 455 } // namespace gpu |
| OLD | NEW |