| 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/memory/shared_memory.h" | 7 #include "base/memory/shared_memory.h" |
| 8 #include "base/test/test_message_loop.h" | 8 #include "base/test/test_message_loop.h" |
| 9 #include "gpu/ipc/common/gpu_messages.h" | 9 #include "gpu/ipc/common/gpu_messages.h" |
| 10 #include "gpu/ipc/service/gpu_channel.h" | 10 #include "gpu/ipc/service/gpu_channel.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 return channel_manager()->LookupChannel(client_id); | 49 return channel_manager()->LookupChannel(client_id); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void HandleMessage(GpuChannel* channel, IPC::Message* msg) { | 52 void HandleMessage(GpuChannel* channel, IPC::Message* msg) { |
| 53 TestGpuChannel* test_channel = static_cast<TestGpuChannel*>(channel); | 53 TestGpuChannel* test_channel = static_cast<TestGpuChannel*>(channel); |
| 54 | 54 |
| 55 // Some IPCs (such as GpuCommandBufferMsg_Initialize) will generate more | 55 // Some IPCs (such as GpuCommandBufferMsg_Initialize) will generate more |
| 56 // delayed responses, drop those if they exist. | 56 // delayed responses, drop those if they exist. |
| 57 test_channel->sink()->ClearMessages(); | 57 test_channel->sink()->ClearMessages(); |
| 58 | 58 |
| 59 test_channel->HandleMessageForTesting(*msg); | 59 test_channel->HandleMessage(*msg); |
| 60 if (msg->is_sync()) { | 60 if (msg->is_sync()) { |
| 61 const IPC::Message* reply_msg = test_channel->sink()->GetMessageAt(0); | 61 const IPC::Message* reply_msg = test_channel->sink()->GetMessageAt(0); |
| 62 CHECK(reply_msg); | 62 CHECK(reply_msg); |
| 63 CHECK(!reply_msg->is_reply_error()); | 63 CHECK(!reply_msg->is_reply_error()); |
| 64 | 64 |
| 65 CHECK(IPC::SyncMessage::IsMessageReplyTo( | 65 CHECK(IPC::SyncMessage::IsMessageReplyTo( |
| 66 *reply_msg, IPC::SyncMessage::GetMessageId(*msg))); | 66 *reply_msg, IPC::SyncMessage::GetMessageId(*msg))); |
| 67 | 67 |
| 68 IPC::MessageReplyDeserializer* deserializer = | 68 IPC::MessageReplyDeserializer* deserializer = |
| 69 static_cast<IPC::SyncMessage*>(msg)->GetReplyDeserializer(); | 69 static_cast<IPC::SyncMessage*>(msg)->GetReplyDeserializer(); |
| (...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 EXPECT_TRUE(channel->LookupCommandBuffer(kSharedRouteId)); | 402 EXPECT_TRUE(channel->LookupCommandBuffer(kSharedRouteId)); |
| 403 | 403 |
| 404 // Destroy the command buffers we initialized before destoying GL. | 404 // Destroy the command buffers we initialized before destoying GL. |
| 405 HandleMessage(channel, | 405 HandleMessage(channel, |
| 406 new GpuChannelMsg_DestroyCommandBuffer(kFriendlyRouteId)); | 406 new GpuChannelMsg_DestroyCommandBuffer(kFriendlyRouteId)); |
| 407 HandleMessage(channel, | 407 HandleMessage(channel, |
| 408 new GpuChannelMsg_DestroyCommandBuffer(kSharedRouteId)); | 408 new GpuChannelMsg_DestroyCommandBuffer(kSharedRouteId)); |
| 409 } | 409 } |
| 410 | 410 |
| 411 } // namespace gpu | 411 } // namespace gpu |
| OLD | NEW |