Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: gpu/ipc/service/gpu_channel_unittest.cc

Issue 2629633003: Refactor GL bindings so there is no global GLApi or DriverGL. (Closed)
Patch Set: rebase Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « gpu/ipc/service/gpu_channel_manager.cc ('k') | gpu/ipc/service/gpu_command_buffer_stub.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
11 #include "gpu/ipc/service/gpu_channel_manager.h" 11 #include "gpu/ipc/service/gpu_channel_manager.h"
12 #include "gpu/ipc/service/gpu_channel_test_common.h" 12 #include "gpu/ipc/service/gpu_channel_test_common.h"
13 #include "ipc/ipc_test_sink.h" 13 #include "ipc/ipc_test_sink.h"
14 #include "ui/gl/gl_context_stub_with_extensions.h"
15 #include "ui/gl/gl_stub_api.h"
16 #include "ui/gl/gl_surface_stub.h" 14 #include "ui/gl/gl_surface_stub.h"
17 #include "ui/gl/init/gl_factory.h" 15 #include "ui/gl/init/gl_factory.h"
18 #include "ui/gl/test/gl_surface_test_support.h" 16 #include "ui/gl/test/gl_surface_test_support.h"
19 17
20 namespace gpu { 18 namespace gpu {
21 19
22 class GpuChannelTest : public GpuChannelTestCommon { 20 class GpuChannelTest : public GpuChannelTestCommon {
23 public: 21 public:
24 GpuChannelTest() : GpuChannelTestCommon() {} 22 GpuChannelTest() : GpuChannelTestCommon() {}
25 ~GpuChannelTest() override {} 23 ~GpuChannelTest() override {}
26 24
27 void SetUp() override { 25 void SetUp() override {
28 // We need GL bindings to actually initialize command buffers. 26 // We need GL bindings to actually initialize command buffers.
29 gl::GLSurfaceTestSupport::InitializeOneOffWithMockBindings(); 27 gl::GLSurfaceTestSupport::InitializeOneOffWithStubBindings();
30 gl::SetStubGLApi(&api_);
31 28
32 GpuChannelTestCommon::SetUp(); 29 GpuChannelTestCommon::SetUp();
33 } 30 }
34 31
35 void TearDown() override { 32 void TearDown() override {
36 GpuChannelTestCommon::TearDown(); 33 GpuChannelTestCommon::TearDown();
37 34
38 gl::init::ShutdownGL(); 35 gl::init::ShutdownGL();
39 } 36 }
40 37
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 base::SharedMemory shared_memory; 79 base::SharedMemory shared_memory;
83 shared_memory.CreateAnonymous(10); 80 shared_memory.CreateAnonymous(10);
84 base::SharedMemoryHandle shmem_handle; 81 base::SharedMemoryHandle shmem_handle;
85 shared_memory.ShareToProcess(base::GetCurrentProcessHandle(), 82 shared_memory.ShareToProcess(base::GetCurrentProcessHandle(),
86 &shmem_handle); 83 &shmem_handle);
87 return shmem_handle; 84 return shmem_handle;
88 } 85 }
89 86
90 private: 87 private:
91 base::TestMessageLoop message_loop_; 88 base::TestMessageLoop message_loop_;
92 gl::GLStubApi api_;
93 }; 89 };
94 90
95 #if defined(OS_WIN) 91 #if defined(OS_WIN)
96 const SurfaceHandle kFakeSurfaceHandle = reinterpret_cast<SurfaceHandle>(1); 92 const SurfaceHandle kFakeSurfaceHandle = reinterpret_cast<SurfaceHandle>(1);
97 #else 93 #else
98 const SurfaceHandle kFakeSurfaceHandle = 1; 94 const SurfaceHandle kFakeSurfaceHandle = 1;
99 #endif 95 #endif
100 96
101 TEST_F(GpuChannelTest, CreateViewCommandBufferAllowed) { 97 TEST_F(GpuChannelTest, CreateViewCommandBufferAllowed) {
102 int32_t kClientId = 1; 98 int32_t kClientId = 1;
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 EXPECT_TRUE(channel->LookupCommandBuffer(kSharedRouteId)); 398 EXPECT_TRUE(channel->LookupCommandBuffer(kSharedRouteId));
403 399
404 // Destroy the command buffers we initialized before destoying GL. 400 // Destroy the command buffers we initialized before destoying GL.
405 HandleMessage(channel, 401 HandleMessage(channel,
406 new GpuChannelMsg_DestroyCommandBuffer(kFriendlyRouteId)); 402 new GpuChannelMsg_DestroyCommandBuffer(kFriendlyRouteId));
407 HandleMessage(channel, 403 HandleMessage(channel,
408 new GpuChannelMsg_DestroyCommandBuffer(kSharedRouteId)); 404 new GpuChannelMsg_DestroyCommandBuffer(kSharedRouteId));
409 } 405 }
410 406
411 } // namespace gpu 407 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/ipc/service/gpu_channel_manager.cc ('k') | gpu/ipc/service/gpu_command_buffer_stub.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698