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" |
8 #include "content/common/gpu/gpu_channel.h" | 9 #include "content/common/gpu/gpu_channel.h" |
9 #include "content/common/gpu/gpu_channel_manager.h" | 10 #include "content/common/gpu/gpu_channel_manager.h" |
10 #include "content/common/gpu/gpu_channel_test_common.h" | 11 #include "content/common/gpu/gpu_channel_test_common.h" |
11 #include "content/common/gpu/gpu_messages.h" | 12 #include "content/common/gpu/gpu_messages.h" |
12 #include "ipc/ipc_test_sink.h" | 13 #include "ipc/ipc_test_sink.h" |
13 | 14 |
14 namespace content { | 15 namespace content { |
15 | 16 |
16 class GpuChannelTest : public GpuChannelTestCommon { | 17 class GpuChannelTest : public GpuChannelTestCommon { |
17 public: | 18 public: |
18 GpuChannelTest() : GpuChannelTestCommon() {} | 19 GpuChannelTest() : GpuChannelTestCommon() {} |
19 ~GpuChannelTest() override {} | 20 ~GpuChannelTest() override {} |
20 | 21 |
21 GpuChannel* CreateChannel(int32_t client_id, | 22 GpuChannel* CreateChannel(int32_t client_id, |
22 bool allow_view_command_buffers, | 23 bool allow_view_command_buffers, |
23 bool allow_real_time_streams) { | 24 bool allow_real_time_streams) { |
24 DCHECK(channel_manager()); | 25 DCHECK(channel_manager()); |
25 uint64_t kClientTracingId = 1; | 26 uint64_t kClientTracingId = 1; |
26 GpuMsg_EstablishChannel_Params params; | 27 EstablishChannelParams params; |
27 params.client_id = client_id; | 28 params.client_id = client_id; |
28 params.client_tracing_id = kClientTracingId; | 29 params.client_tracing_id = kClientTracingId; |
29 params.preempts = false; | 30 params.preempts = false; |
30 params.allow_view_command_buffers = allow_view_command_buffers; | 31 params.allow_view_command_buffers = allow_view_command_buffers; |
31 params.allow_real_time_streams = allow_real_time_streams; | 32 params.allow_real_time_streams = allow_real_time_streams; |
32 EXPECT_TRUE( | 33 channel_manager()->EstablishChannel(params); |
33 channel_manager()->OnMessageReceived(GpuMsg_EstablishChannel(params))); | |
34 sink()->ClearMessages(); | 34 sink()->ClearMessages(); |
35 return channel_manager()->LookupChannel(client_id); | 35 return channel_manager()->LookupChannel(client_id); |
36 } | 36 } |
37 | 37 |
38 void HandleMessage(GpuChannel* channel, IPC::Message* msg) { | 38 void HandleMessage(GpuChannel* channel, IPC::Message* msg) { |
39 channel->HandleMessageForTesting(*msg); | 39 channel->HandleMessageForTesting(*msg); |
40 | 40 |
41 if (msg->is_sync()) { | 41 if (msg->is_sync()) { |
42 const IPC::Message* reply_msg = sink()->GetMessageAt(0); | 42 const IPC::Message* reply_msg = sink()->GetMessageAt(0); |
43 ASSERT_TRUE(reply_msg); | 43 ASSERT_TRUE(reply_msg); |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 HandleMessage(channel, | 325 HandleMessage(channel, |
326 new GpuChannelMsg_CreateOffscreenCommandBuffer( | 326 new GpuChannelMsg_CreateOffscreenCommandBuffer( |
327 gfx::Size(1, 1), init_params, kRouteId, &succeeded)); | 327 gfx::Size(1, 1), init_params, kRouteId, &succeeded)); |
328 EXPECT_TRUE(succeeded); | 328 EXPECT_TRUE(succeeded); |
329 | 329 |
330 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); | 330 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); |
331 EXPECT_TRUE(stub); | 331 EXPECT_TRUE(stub); |
332 } | 332 } |
333 | 333 |
334 } // namespace content | 334 } // namespace content |
OLD | NEW |