| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 #include <stdint.h> | 5 #include <stdint.h> |
| 6 | 6 |
| 7 #include "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
| 8 #include "content/common/gpu/establish_channel_params.h" | |
| 9 #include "content/common/gpu/gpu_channel.h" | 8 #include "content/common/gpu/gpu_channel.h" |
| 10 #include "content/common/gpu/gpu_channel_manager.h" | 9 #include "content/common/gpu/gpu_channel_manager.h" |
| 11 #include "content/common/gpu/gpu_channel_test_common.h" | 10 #include "content/common/gpu/gpu_channel_test_common.h" |
| 12 #include "content/common/gpu/gpu_messages.h" | 11 #include "content/common/gpu/gpu_messages.h" |
| 13 #include "ipc/ipc_test_sink.h" | 12 #include "ipc/ipc_test_sink.h" |
| 14 | 13 |
| 15 namespace content { | 14 namespace content { |
| 16 | 15 |
| 17 class GpuChannelTest : public GpuChannelTestCommon { | 16 class GpuChannelTest : public GpuChannelTestCommon { |
| 18 public: | 17 public: |
| 19 GpuChannelTest() : GpuChannelTestCommon() {} | 18 GpuChannelTest() : GpuChannelTestCommon() {} |
| 20 ~GpuChannelTest() override {} | 19 ~GpuChannelTest() override {} |
| 21 | 20 |
| 22 GpuChannel* CreateChannel(int32_t client_id, | 21 GpuChannel* CreateChannel(int32_t client_id, |
| 23 bool allow_view_command_buffers, | 22 bool allow_view_command_buffers, |
| 24 bool allow_real_time_streams) { | 23 bool allow_real_time_streams) { |
| 25 DCHECK(channel_manager()); | 24 DCHECK(channel_manager()); |
| 26 uint64_t kClientTracingId = 1; | 25 uint64_t kClientTracingId = 1; |
| 27 EstablishChannelParams params; | 26 channel_manager()->EstablishChannel( |
| 28 params.client_id = client_id; | 27 client_id, kClientTracingId, false /* preempts */, |
| 29 params.client_tracing_id = kClientTracingId; | 28 allow_view_command_buffers, allow_real_time_streams); |
| 30 params.preempts = false; | |
| 31 params.allow_view_command_buffers = allow_view_command_buffers; | |
| 32 params.allow_real_time_streams = allow_real_time_streams; | |
| 33 channel_manager()->EstablishChannel(params); | |
| 34 return channel_manager()->LookupChannel(client_id); | 29 return channel_manager()->LookupChannel(client_id); |
| 35 } | 30 } |
| 36 | 31 |
| 37 void HandleMessage(GpuChannel* channel, IPC::Message* msg) { | 32 void HandleMessage(GpuChannel* channel, IPC::Message* msg) { |
| 38 TestGpuChannel* test_channel = static_cast<TestGpuChannel*>(channel); | 33 TestGpuChannel* test_channel = static_cast<TestGpuChannel*>(channel); |
| 39 test_channel->HandleMessageForTesting(*msg); | 34 test_channel->HandleMessageForTesting(*msg); |
| 40 | 35 |
| 41 if (msg->is_sync()) { | 36 if (msg->is_sync()) { |
| 42 const IPC::Message* reply_msg = test_channel->sink()->GetMessageAt(0); | 37 const IPC::Message* reply_msg = test_channel->sink()->GetMessageAt(0); |
| 43 ASSERT_TRUE(reply_msg); | 38 ASSERT_TRUE(reply_msg); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( | 282 HandleMessage(channel, new GpuChannelMsg_CreateCommandBuffer( |
| 288 gpu::kNullSurfaceHandle, gfx::Size(1, 1), | 283 gpu::kNullSurfaceHandle, gfx::Size(1, 1), |
| 289 init_params, kRouteId, &succeeded)); | 284 init_params, kRouteId, &succeeded)); |
| 290 EXPECT_TRUE(succeeded); | 285 EXPECT_TRUE(succeeded); |
| 291 | 286 |
| 292 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); | 287 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); |
| 293 EXPECT_TRUE(stub); | 288 EXPECT_TRUE(stub); |
| 294 } | 289 } |
| 295 | 290 |
| 296 } // namespace content | 291 } // namespace content |
| OLD | NEW |