OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <memory> |
| 6 |
5 #include "base/command_line.h" | 7 #include "base/command_line.h" |
6 #include "base/memory/scoped_ptr.h" | |
7 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
8 #include "ui/gl/gl_egl_api_implementation.h" | 9 #include "ui/gl/gl_egl_api_implementation.h" |
9 #include "ui/gl/gl_switches.h" | 10 #include "ui/gl/gl_switches.h" |
10 | 11 |
11 namespace gfx { | 12 namespace gfx { |
12 | 13 |
13 class EGLApiTest : public testing::Test { | 14 class EGLApiTest : public testing::Test { |
14 public: | 15 public: |
15 void SetUp() override { | 16 void SetUp() override { |
16 fake_client_extension_string_ = ""; | 17 fake_client_extension_string_ = ""; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 std::pair<const char*, const char*> GetExtensions() { | 82 std::pair<const char*, const char*> GetExtensions() { |
82 return std::make_pair( | 83 return std::make_pair( |
83 api_->eglQueryStringFn(EGL_NO_DISPLAY, EGL_EXTENSIONS), | 84 api_->eglQueryStringFn(EGL_NO_DISPLAY, EGL_EXTENSIONS), |
84 api_->eglQueryStringFn(api_->eglGetCurrentDisplayFn(), EGL_EXTENSIONS)); | 85 api_->eglQueryStringFn(api_->eglGetCurrentDisplayFn(), EGL_EXTENSIONS)); |
85 } | 86 } |
86 | 87 |
87 protected: | 88 protected: |
88 static const char* fake_extension_string_; | 89 static const char* fake_extension_string_; |
89 static const char* fake_client_extension_string_; | 90 static const char* fake_client_extension_string_; |
90 | 91 |
91 scoped_ptr<RealEGLApi> api_; | 92 std::unique_ptr<RealEGLApi> api_; |
92 }; | 93 }; |
93 | 94 |
94 const char* EGLApiTest::fake_extension_string_ = ""; | 95 const char* EGLApiTest::fake_extension_string_ = ""; |
95 const char* EGLApiTest::fake_client_extension_string_ = ""; | 96 const char* EGLApiTest::fake_client_extension_string_ = ""; |
96 | 97 |
97 TEST_F(EGLApiTest, DisabledExtensionBitTest) { | 98 TEST_F(EGLApiTest, DisabledExtensionBitTest) { |
98 static const char* kFakeExtensions = "EGL_KHR_fence_sync"; | 99 static const char* kFakeExtensions = "EGL_KHR_fence_sync"; |
99 static const char* kFakeClientExtensions = ""; | 100 static const char* kFakeClientExtensions = ""; |
100 static const char* kFakeDisabledExtensions = "EGL_KHR_fence_sync"; | 101 static const char* kFakeDisabledExtensions = "EGL_KHR_fence_sync"; |
101 | 102 |
(...skipping 29 matching lines...) Expand all Loading... |
131 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | 132 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
132 command_line.AppendSwitchASCII(switches::kDisableGLExtensions, | 133 command_line.AppendSwitchASCII(switches::kDisableGLExtensions, |
133 kFakeDisabledExtensions); | 134 kFakeDisabledExtensions); |
134 InitializeAPI(&command_line); | 135 InitializeAPI(&command_line); |
135 | 136 |
136 EXPECT_STREQ(kFilteredClientExtensions, GetExtensions().first); | 137 EXPECT_STREQ(kFilteredClientExtensions, GetExtensions().first); |
137 EXPECT_STREQ(kFilteredExtensions, GetExtensions().second); | 138 EXPECT_STREQ(kFilteredExtensions, GetExtensions().second); |
138 } | 139 } |
139 | 140 |
140 } // namespace gfx | 141 } // namespace gfx |
OLD | NEW |