Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 27 void EchoDxDiagNode(const DxDiagNode& d, | 27 void EchoDxDiagNode(const DxDiagNode& d, |
| 28 const EchoDxDiagNodeCallback& callback) override { | 28 const EchoDxDiagNodeCallback& callback) override { |
| 29 callback.Run(d); | 29 callback.Run(d); |
| 30 } | 30 } |
| 31 | 31 |
| 32 void EchoGpuDevice(const GPUInfo::GPUDevice& g, | 32 void EchoGpuDevice(const GPUInfo::GPUDevice& g, |
| 33 const EchoGpuDeviceCallback& callback) override { | 33 const EchoGpuDeviceCallback& callback) override { |
| 34 callback.Run(g); | 34 callback.Run(g); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void EchoGpuInfo(const GPUInfo& g, | |
| 38 const EchoGpuInfoCallback& callback) override { | |
| 39 callback.Run(g); | |
| 40 } | |
| 41 | |
| 37 void EchoMailbox(const Mailbox& m, | 42 void EchoMailbox(const Mailbox& m, |
| 38 const EchoMailboxCallback& callback) override { | 43 const EchoMailboxCallback& callback) override { |
| 39 callback.Run(m); | 44 callback.Run(m); |
| 40 } | 45 } |
| 41 | 46 |
| 42 void EchoMailboxHolder(const MailboxHolder& r, | 47 void EchoMailboxHolder(const MailboxHolder& r, |
| 43 const EchoMailboxHolderCallback& callback) override { | 48 const EchoMailboxHolderCallback& callback) override { |
| 44 callback.Run(r); | 49 callback.Run(r); |
| 45 } | 50 } |
| 46 | 51 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 gpu::GPUInfo::GPUDevice output; | 111 gpu::GPUInfo::GPUDevice output; |
| 107 proxy->EchoGpuDevice(input, &output); | 112 proxy->EchoGpuDevice(input, &output); |
| 108 | 113 |
| 109 EXPECT_EQ(vendor_id, output.vendor_id); | 114 EXPECT_EQ(vendor_id, output.vendor_id); |
| 110 EXPECT_EQ(device_id, output.device_id); | 115 EXPECT_EQ(device_id, output.device_id); |
| 111 EXPECT_FALSE(output.active); | 116 EXPECT_FALSE(output.active); |
| 112 EXPECT_TRUE(vendor_string.compare(output.vendor_string) == 0); | 117 EXPECT_TRUE(vendor_string.compare(output.vendor_string) == 0); |
| 113 EXPECT_TRUE(device_string.compare(output.device_string) == 0); | 118 EXPECT_TRUE(device_string.compare(output.device_string) == 0); |
| 114 } | 119 } |
| 115 | 120 |
| 121 TEST_F(StructTraitsTest, GpuInfo) { | |
| 122 gpu::GPUInfo input; | |
| 123 | |
| 124 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | |
| 125 gpu::GPUInfo output; | |
| 126 proxy->EchoGpuInfo(input, &output); | |
|
Fady Samuel
2016/08/08 19:06:21
This test is incomplete. Please update the test to
Alex Z.
2016/08/10 19:27:53
Done.
| |
| 127 | |
| 128 // Verify that output is equal to the expected | |
| 129 // This code is copied from gpu/config/gpu_info_unittest.cc | |
| 130 EXPECT_EQ(output.initialization_time.ToInternalValue(), 0); | |
| 131 EXPECT_EQ(output.gpu.vendor_id, 0u); | |
| 132 EXPECT_EQ(output.gpu.device_id, 0u); | |
| 133 EXPECT_EQ(output.secondary_gpus.size(), 0u); | |
| 134 EXPECT_EQ(output.driver_vendor, ""); | |
| 135 EXPECT_EQ(output.driver_version, ""); | |
| 136 EXPECT_EQ(output.driver_date, ""); | |
| 137 EXPECT_EQ(output.pixel_shader_version, ""); | |
| 138 EXPECT_EQ(output.vertex_shader_version, ""); | |
| 139 EXPECT_EQ(output.max_msaa_samples, ""); | |
| 140 EXPECT_EQ(output.gl_version, ""); | |
| 141 EXPECT_EQ(output.gl_vendor, ""); | |
| 142 EXPECT_EQ(output.gl_renderer, ""); | |
| 143 EXPECT_EQ(output.gl_extensions, ""); | |
| 144 EXPECT_EQ(output.gl_ws_vendor, ""); | |
| 145 EXPECT_EQ(output.gl_ws_version, ""); | |
| 146 EXPECT_EQ(output.gl_ws_extensions, ""); | |
| 147 EXPECT_EQ(output.can_lose_context, false); | |
| 148 EXPECT_EQ(output.basic_info_state, kCollectInfoNone); | |
| 149 EXPECT_EQ(output.context_info_state, kCollectInfoNone); | |
| 150 #if defined(OS_WIN) | |
| 151 EXPECT_EQ(output.dx_diagnostics_info_state, kCollectInfoNone); | |
| 152 #endif | |
| 153 EXPECT_EQ(output.video_decode_accelerator_capabilities.flags, 0u); | |
| 154 EXPECT_EQ( | |
| 155 output.video_decode_accelerator_capabilities.supported_profiles.size(), | |
| 156 0u); | |
| 157 EXPECT_EQ(output.video_encode_accelerator_supported_profiles.size(), 0u); | |
| 158 } | |
| 159 | |
| 116 TEST_F(StructTraitsTest, Mailbox) { | 160 TEST_F(StructTraitsTest, Mailbox) { |
| 117 const int8_t mailbox_name[GL_MAILBOX_SIZE_CHROMIUM] = { | 161 const int8_t mailbox_name[GL_MAILBOX_SIZE_CHROMIUM] = { |
| 118 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, | 162 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, |
| 119 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, 8, 7, | 163 8, 7, 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, 8, 7, |
| 120 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, 8, 7}; | 164 6, 5, 4, 3, 2, 1, 9, 7, 5, 3, 1, 2, 4, 6, 8, 0, 0, 9, 8, 7}; |
| 121 gpu::Mailbox input; | 165 gpu::Mailbox input; |
| 122 input.SetName(mailbox_name); | 166 input.SetName(mailbox_name); |
| 123 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 167 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| 124 gpu::Mailbox output; | 168 gpu::Mailbox output; |
| 125 proxy->EchoMailbox(input, &output); | 169 proxy->EchoMailbox(input, &output); |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 228 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 272 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| 229 gpu::VideoEncodeAcceleratorSupportedProfile output; | 273 gpu::VideoEncodeAcceleratorSupportedProfile output; |
| 230 proxy->EchoVideoEncodeAcceleratorSupportedProfile(input, &output); | 274 proxy->EchoVideoEncodeAcceleratorSupportedProfile(input, &output); |
| 231 EXPECT_EQ(profile, output.profile); | 275 EXPECT_EQ(profile, output.profile); |
| 232 EXPECT_EQ(max_resolution, output.max_resolution); | 276 EXPECT_EQ(max_resolution, output.max_resolution); |
| 233 EXPECT_EQ(max_framerate_numerator, output.max_framerate_numerator); | 277 EXPECT_EQ(max_framerate_numerator, output.max_framerate_numerator); |
| 234 EXPECT_EQ(max_framerate_denominator, output.max_framerate_denominator); | 278 EXPECT_EQ(max_framerate_denominator, output.max_framerate_denominator); |
| 235 } | 279 } |
| 236 | 280 |
| 237 } // namespace gpu | 281 } // namespace gpu |
| OLD | NEW |