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

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

Issue 1160293004: Add tests for Android GL driver version extraction. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 6 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 | « no previous file | no next file » | 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) 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" 10 #include "ui/gl/gl_implementation.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 EXPECT_EQ(test_values_.pixel_shader_version, 144 EXPECT_EQ(test_values_.pixel_shader_version,
145 gpu_info.pixel_shader_version); 145 gpu_info.pixel_shader_version);
146 EXPECT_EQ(test_values_.vertex_shader_version, 146 EXPECT_EQ(test_values_.vertex_shader_version,
147 gpu_info.vertex_shader_version); 147 gpu_info.vertex_shader_version);
148 EXPECT_EQ(test_values_.gl_version, gpu_info.gl_version); 148 EXPECT_EQ(test_values_.gl_version, gpu_info.gl_version);
149 EXPECT_EQ(test_values_.gl_renderer, gpu_info.gl_renderer); 149 EXPECT_EQ(test_values_.gl_renderer, gpu_info.gl_renderer);
150 EXPECT_EQ(test_values_.gl_vendor, gpu_info.gl_vendor); 150 EXPECT_EQ(test_values_.gl_vendor, gpu_info.gl_vendor);
151 EXPECT_EQ(test_values_.gl_extensions, gpu_info.gl_extensions); 151 EXPECT_EQ(test_values_.gl_extensions, gpu_info.gl_extensions);
152 } 152 }
153 153
154 class CollectDriverInfoGLTest : public testing::Test {
155 public:
156 CollectDriverInfoGLTest() {}
157 ~CollectDriverInfoGLTest() override {}
158
159 void SetUp() override {
160 }
161 void TearDown() override {
162 }
163 };
164
165 TEST_F(CollectDriverInfoGLTest, CollectDriverInfoGL) {
166 const struct {
167 const char* gl_renderer;
168 const char* gl_vendor;
169 const char* gl_version;
170 const char* expected_driver_version;
171 } tests[] = {
no sievers 2015/06/03 20:28:13 nit: s/tests/kTestStrings or so
172 #if defined(OS_ANDROID)
no sievers 2015/06/03 20:28:13 nit: I'd ifdef out the whole test thingie and put
173 {"Adreno (TM) 320", "Qualcomm", "OpenGL ES 2.0 V@14.0 AU@04.02 (CL@3206)",
174 "14.0"},
175 {"Adreno (TM) 420", "Qualcomm", "OpenGL ES 3.0 V@84.0 AU@ (CL@)", "84.0"},
176 {"PowerVR Rogue G6430", "Imagination Technologies",
177 "OpenGL ES 3.1 build 1.4@3283119", "1.4"},
178 {"Mali-T604", "ARM", "OpenGL ES 3.1", "0"},
179 {"NVIDIA Tegra", "NVIDIA Corporation", "OpenGL ES 3.1 NVIDIA 343.00",
180 "343.00"},
no sievers 2015/06/03 20:28:14 Can you also update the comment in gpu_info_collec
181 {"NVIDIA Tegra 3", "NVIDIA Corporation", "OpenGL ES 2.0 14.01003",
182 "14.01003"},
183 #endif
184 {NULL, NULL, NULL, NULL}
185 };
186
187 GPUInfo gpu_info;
188 for (int i = 0; tests[i].gl_renderer != NULL; ++i) {
189 gpu_info.gl_renderer = tests[i].gl_renderer;
190 gpu_info.gl_vendor = tests[i].gl_vendor;
191 gpu_info.gl_version = tests[i].gl_version;
192 EXPECT_EQ(CollectDriverInfoGL(&gpu_info), kCollectInfoSuccess);
193 EXPECT_EQ(gpu_info.driver_version, tests[i].expected_driver_version);
194 }
195 }
196
154 } // namespace gpu 197 } // namespace gpu
155 198
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698