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

Unified Diff: ui/gl/gl_version_info_unittest.cc

Issue 2070313002: Parse GL_VERSION incorrectly when version string is without release_number (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test case Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/gl_version_info.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_version_info_unittest.cc
diff --git a/ui/gl/gl_version_info_unittest.cc b/ui/gl/gl_version_info_unittest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..82979920cd7239a1e344dbc77ba4ff31e92d6d8b
--- /dev/null
+++ b/ui/gl/gl_version_info_unittest.cc
@@ -0,0 +1,37 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
Zhenyao Mo 2016/06/20 16:20:15 nit: 2016
xinghua.cao 2016/06/21 10:06:31 Done.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gl/gl_version_info.h"
+
+namespace gl {
+
+class GLVersionInfoTest : public testing::Test {
Zhenyao Mo 2016/06/20 16:20:15 You don't have to declare this class if it's doing
xinghua.cao 2016/06/21 10:06:31 Done.
+
+};
+
+TEST_F(GLVersionInfoTest, MajorMinorVersionTest) {
+ const char* version_str[] = {"4.3 (Core Profile) Mesa 11.2.0",
+ "4.5.0 NVIDIA 364.19",
Zhenyao Mo 2016/06/20 16:20:15 nit: 4 space only indent.
xinghua.cao 2016/06/21 10:06:31 Done.
+ "OpenGL ES 2.0 (ANGLE 2.1.0.cd1b12260360)",
+ "2.1 INTEL-10.6.33"};
+ const char* renderer_str[] = {NULL, NULL, NULL, NULL};
+ const char* extensions_str[] = {"extensions", "extensions",
+ "extensions", "extensions"};
+ unsigned expected_major_minor[] = {4, 3, 4, 5, 2, 0, 2, 1};
Zhenyao Mo 2016/06/20 16:20:15 Maybe just split into expected_major and expected_
xinghua.cao 2016/06/21 10:06:31 Done.
+ for (unsigned i = 0; i < arraysize(version_str); i++) {
+ struct GLVersionInfo* version_info =
Zhenyao Mo 2016/06/20 16:20:15 use scoped_ptr
xinghua.cao 2016/06/21 10:06:31 I am not sure where "scoped_ptr" is declared and d
+ new GLVersionInfo(version_str[i], renderer_str[i], extensions_str[i]);
+ unsigned major, minor;
+ bool is_es, is_es2, is_es3;
+ version_info->ParseVersionString(version_str[i], &major, &minor,
+ &is_es, &is_es2, &is_es3);
+ EXPECT_EQ(major, expected_major_minor[2 * i]);
+ EXPECT_EQ(minor, expected_major_minor[2 * i + 1]);
+ delete version_info;
+ version_info = NULL;
+ }
+}
+
+}
« no previous file with comments | « ui/gl/gl_version_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698