| 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 #if defined(OS_WIN) | 65 #if defined(OS_WIN) |
| 66 const SurfaceHandle kFakeSurfaceHandle = | 66 const SurfaceHandle kFakeSurfaceHandle = |
| 67 reinterpret_cast<SurfaceHandle>(1); | 67 reinterpret_cast<SurfaceHandle>(1); |
| 68 #else | 68 #else |
| 69 const SurfaceHandle kFakeSurfaceHandle = 1; | 69 const SurfaceHandle kFakeSurfaceHandle = 1; |
| 70 #endif | 70 #endif |
| 71 | 71 |
| 72 TEST_F(GpuChannelTest, CreateViewCommandBufferAllowed) { | 72 TEST_F(GpuChannelTest, CreateViewCommandBufferAllowed) { |
| 73 // We need GL bindings to actually initialize command buffers. |
| 74 gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress); |
| 75 gfx::GLSurfaceTestSupport::InitializeOneOffWithMockBindings(); |
| 76 |
| 73 int32_t kClientId = 1; | 77 int32_t kClientId = 1; |
| 74 bool allow_view_command_buffers = true; | 78 bool allow_view_command_buffers = true; |
| 75 GpuChannel* channel = | 79 GpuChannel* channel = |
| 76 CreateChannel(kClientId, allow_view_command_buffers, false); | 80 CreateChannel(kClientId, allow_view_command_buffers, false); |
| 77 ASSERT_TRUE(channel); | 81 ASSERT_TRUE(channel); |
| 78 | 82 |
| 79 SurfaceHandle surface_handle = kFakeSurfaceHandle; | 83 SurfaceHandle surface_handle = kFakeSurfaceHandle; |
| 80 DCHECK_NE(surface_handle, kNullSurfaceHandle); | 84 DCHECK_NE(surface_handle, kNullSurfaceHandle); |
| 81 | 85 |
| 82 int32_t kRouteId = 1; | 86 int32_t kRouteId = 1; |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 473 EXPECT_TRUE(channel->LookupCommandBuffer(kSharedRouteId)); | 477 EXPECT_TRUE(channel->LookupCommandBuffer(kSharedRouteId)); |
| 474 | 478 |
| 475 // Destroy the command buffer we initialized before destoying GL. | 479 // Destroy the command buffer we initialized before destoying GL. |
| 476 HandleMessage(channel, | 480 HandleMessage(channel, |
| 477 new GpuChannelMsg_DestroyCommandBuffer(kSharedRouteId)); | 481 new GpuChannelMsg_DestroyCommandBuffer(kSharedRouteId)); |
| 478 gfx::MockGLInterface::SetGLInterface(nullptr); | 482 gfx::MockGLInterface::SetGLInterface(nullptr); |
| 479 gfx::ClearGLBindings(); | 483 gfx::ClearGLBindings(); |
| 480 } | 484 } |
| 481 | 485 |
| 482 } // namespace gpu | 486 } // namespace gpu |
| OLD | NEW |