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

Side by Side Diff: ui/gl/egl_api_unittest.cc

Issue 2548253003: Revert of ui/gl: Initialize the ANGLE Platform on all configurations (Closed)
Patch Set: Created 4 years 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 | « ui/gl/BUILD.gn ('k') | ui/gl/gl_surface_egl.h » ('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 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> 5 #include <memory>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "ui/gl/gl_egl_api_implementation.h" 9 #include "ui/gl/gl_egl_api_implementation.h"
10 #include "ui/gl/gl_surface_egl.h" 10 #include "ui/gl/gl_surface_egl.h"
11 #include "ui/gl/gl_switches.h" 11 #include "ui/gl/gl_switches.h"
12 12
13 namespace gl { 13 namespace gl {
14 14
15 class EGLApiTest : public testing::Test { 15 class EGLApiTest : public testing::Test {
16 public: 16 public:
17 void SetUp() override { 17 void SetUp() override {
18 fake_client_extension_string_ = ""; 18 fake_client_extension_string_ = "";
19 fake_extension_string_ = ""; 19 fake_extension_string_ = "";
20 20
21 // TODO(dyen): Add a way to bind mock drivers for testing. 21 // TODO(dyen): Add a way to bind mock drivers for testing.
22 g_driver_egl.ClearBindings(); 22 g_driver_egl.ClearBindings();
23 g_driver_egl.fn.eglInitializeFn = &FakeInitialize; 23 g_driver_egl.fn.eglInitializeFn = &FakeInitialize;
24 g_driver_egl.fn.eglQueryStringFn = &FakeQueryString; 24 g_driver_egl.fn.eglQueryStringFn = &FakeQueryString;
25 g_driver_egl.fn.eglGetCurrentDisplayFn = &FakeGetCurrentDisplay; 25 g_driver_egl.fn.eglGetCurrentDisplayFn = &FakeGetCurrentDisplay;
26 g_driver_egl.fn.eglGetDisplayFn = &FakeGetDisplay; 26 g_driver_egl.fn.eglGetDisplayFn = &FakeGetDisplay;
27 g_driver_egl.fn.eglGetErrorFn = &FakeGetError; 27 g_driver_egl.fn.eglGetErrorFn = &FakeGetError;
28 g_driver_egl.fn.eglGetProcAddressFn = &FakeGetProcAddress;
29 } 28 }
30 29
31 void TearDown() override { 30 void TearDown() override {
32 g_current_egl_context = nullptr; 31 g_current_egl_context = nullptr;
33 api_.reset(nullptr); 32 api_.reset(nullptr);
34 g_driver_egl.ClearBindings(); 33 g_driver_egl.ClearBindings();
35 34
36 fake_client_extension_string_ = ""; 35 fake_client_extension_string_ = "";
37 fake_extension_string_ = ""; 36 fake_extension_string_ = "";
38 } 37 }
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 75
77 static EGLDisplay GL_BINDING_CALL FakeGetDisplay( 76 static EGLDisplay GL_BINDING_CALL FakeGetDisplay(
78 EGLNativeDisplayType native_display) { 77 EGLNativeDisplayType native_display) {
79 return reinterpret_cast<EGLDisplay>(0x1); 78 return reinterpret_cast<EGLDisplay>(0x1);
80 } 79 }
81 80
82 static EGLint GL_BINDING_CALL FakeGetError() { 81 static EGLint GL_BINDING_CALL FakeGetError() {
83 return EGL_SUCCESS; 82 return EGL_SUCCESS;
84 } 83 }
85 84
86 static __eglMustCastToProperFunctionPointerType GL_BINDING_CALL
87 FakeGetProcAddress(const char* procname) {
88 return nullptr;
89 }
90
91 std::pair<const char*, const char*> GetExtensions() { 85 std::pair<const char*, const char*> GetExtensions() {
92 return std::make_pair( 86 return std::make_pair(
93 api_->eglQueryStringFn(EGL_NO_DISPLAY, EGL_EXTENSIONS), 87 api_->eglQueryStringFn(EGL_NO_DISPLAY, EGL_EXTENSIONS),
94 api_->eglQueryStringFn(api_->eglGetCurrentDisplayFn(), EGL_EXTENSIONS)); 88 api_->eglQueryStringFn(api_->eglGetCurrentDisplayFn(), EGL_EXTENSIONS));
95 } 89 }
96 90
97 protected: 91 protected:
98 static const char* fake_extension_string_; 92 static const char* fake_extension_string_;
99 static const char* fake_client_extension_string_; 93 static const char* fake_client_extension_string_;
100 94
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); 135 base::CommandLine command_line(base::CommandLine::NO_PROGRAM);
142 command_line.AppendSwitchASCII(switches::kDisableGLExtensions, 136 command_line.AppendSwitchASCII(switches::kDisableGLExtensions,
143 kFakeDisabledExtensions); 137 kFakeDisabledExtensions);
144 InitializeAPI(&command_line); 138 InitializeAPI(&command_line);
145 139
146 EXPECT_STREQ(kFilteredClientExtensions, GetExtensions().first); 140 EXPECT_STREQ(kFilteredClientExtensions, GetExtensions().first);
147 EXPECT_STREQ(kFilteredExtensions, GetExtensions().second); 141 EXPECT_STREQ(kFilteredExtensions, GetExtensions().second);
148 } 142 }
149 143
150 } // namespace gl 144 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/BUILD.gn ('k') | ui/gl/gl_surface_egl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698