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

Side by Side Diff: gpu/config/gpu_info_collector_unittest.cc

Issue 135213003: Ensure GL initialization only happens once, and provide common init path (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: initgl: rebase Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/memory/scoped_ptr.h" 5 #include "base/memory/scoped_ptr.h"
6 #include "gpu/config/gpu_info.h" 6 #include "gpu/config/gpu_info.h"
7 #include "gpu/config/gpu_info_collector.h" 7 #include "gpu/config/gpu_info_collector.h"
8 #include "testing/gmock/include/gmock/gmock.h" 8 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/gl/gl_implementation.h"
11 #include "ui/gl/gl_mock.h" 10 #include "ui/gl/gl_mock.h"
12 11
13 using ::gfx::MockGLInterface; 12 using ::gfx::MockGLInterface;
14 using ::testing::Return; 13 using ::testing::Return;
15 14
16 namespace gpu { 15 namespace gpu {
17 16
18 class GPUInfoCollectorTest : public testing::Test { 17 class GPUInfoCollectorTest : public testing::Test {
19 public: 18 public:
20 GPUInfoCollectorTest() {} 19 GPUInfoCollectorTest() {}
21 virtual ~GPUInfoCollectorTest() { } 20 virtual ~GPUInfoCollectorTest() { }
22 21
23 virtual void SetUp() { 22 virtual void SetUp() {
24 // TODO(kbr): make this setup robust in the case where
25 // GLSurface::InitializeOneOff() has already been called by
26 // another unit test. http://crbug.com/100285
27 gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress);
28 gfx::InitializeStaticGLBindings(gfx::kGLImplementationMockGL);
29 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); 23 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
30 ::gfx::MockGLInterface::SetGLInterface(gl_.get()); 24 ::gfx::MockGLInterface::SetGLInterface(gl_.get());
31 #if defined(OS_WIN) 25 #if defined(OS_WIN)
32 const uint32 vendor_id = 0x10de; 26 const uint32 vendor_id = 0x10de;
33 const uint32 device_id = 0x0658; 27 const uint32 device_id = 0x0658;
34 const char* driver_vendor = ""; // not implemented 28 const char* driver_vendor = ""; // not implemented
35 const char* driver_version = ""; 29 const char* driver_version = "";
36 const char* shader_version = "1.40"; 30 const char* shader_version = "1.40";
37 const char* gl_version = "3.1"; 31 const char* gl_version = "3.1";
38 const char* gl_renderer = "Quadro FX 380/PCI/SSE2"; 32 const char* gl_renderer = "Quadro FX 380/PCI/SSE2";
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 172
179 TEST_F(GPUInfoCollectorTest, DISABLED_GLExtensionsGL) { 173 TEST_F(GPUInfoCollectorTest, DISABLED_GLExtensionsGL) {
180 GPUInfo gpu_info; 174 GPUInfo gpu_info;
181 CollectGraphicsInfoGL(&gpu_info); 175 CollectGraphicsInfoGL(&gpu_info);
182 EXPECT_EQ(test_values_.gl_extensions, 176 EXPECT_EQ(test_values_.gl_extensions,
183 gpu_info.gl_extensions); 177 gpu_info.gl_extensions);
184 } 178 }
185 179
186 } // namespace gpu 180 } // namespace gpu
187 181
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698