| 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> | 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_switches.h" | 11 #include "ui/gl/gl_switches.h" |
| 11 | 12 |
| 12 namespace gl { | 13 namespace gl { |
| 13 | 14 |
| 14 class EGLApiTest : public testing::Test { | 15 class EGLApiTest : public testing::Test { |
| 15 public: | 16 public: |
| 16 void SetUp() override { | 17 void SetUp() override { |
| 17 fake_client_extension_string_ = ""; | 18 fake_client_extension_string_ = ""; |
| 18 fake_extension_string_ = ""; | 19 fake_extension_string_ = ""; |
| 19 | 20 |
| (...skipping 15 matching lines...) Expand all Loading... |
| 35 fake_extension_string_ = ""; | 36 fake_extension_string_ = ""; |
| 36 } | 37 } |
| 37 | 38 |
| 38 void InitializeAPI(base::CommandLine* command_line) { | 39 void InitializeAPI(base::CommandLine* command_line) { |
| 39 api_.reset(new RealEGLApi()); | 40 api_.reset(new RealEGLApi()); |
| 40 g_current_egl_context = api_.get(); | 41 g_current_egl_context = api_.get(); |
| 41 if (command_line) | 42 if (command_line) |
| 42 api_->InitializeWithCommandLine(&g_driver_egl, command_line); | 43 api_->InitializeWithCommandLine(&g_driver_egl, command_line); |
| 43 else | 44 else |
| 44 api_->Initialize(&g_driver_egl); | 45 api_->Initialize(&g_driver_egl); |
| 46 g_driver_egl.InitializeClientExtensionBindings(); |
| 47 GLSurfaceEGL::InitializeDisplay(EGL_DEFAULT_DISPLAY); |
| 45 g_driver_egl.InitializeExtensionBindings(); | 48 g_driver_egl.InitializeExtensionBindings(); |
| 46 } | 49 } |
| 47 | 50 |
| 48 void SetFakeExtensionString(const char* fake_string, | 51 void SetFakeExtensionString(const char* fake_string, |
| 49 const char* fake_client_string) { | 52 const char* fake_client_string) { |
| 50 fake_extension_string_ = fake_string; | 53 fake_extension_string_ = fake_string; |
| 51 fake_client_extension_string_ = fake_client_string; | 54 fake_client_extension_string_ = fake_client_string; |
| 52 } | 55 } |
| 53 | 56 |
| 54 static EGLBoolean GL_BINDING_CALL FakeInitialize(EGLDisplay display, | 57 static EGLBoolean GL_BINDING_CALL FakeInitialize(EGLDisplay display, |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); | 135 base::CommandLine command_line(base::CommandLine::NO_PROGRAM); |
| 133 command_line.AppendSwitchASCII(switches::kDisableGLExtensions, | 136 command_line.AppendSwitchASCII(switches::kDisableGLExtensions, |
| 134 kFakeDisabledExtensions); | 137 kFakeDisabledExtensions); |
| 135 InitializeAPI(&command_line); | 138 InitializeAPI(&command_line); |
| 136 | 139 |
| 137 EXPECT_STREQ(kFilteredClientExtensions, GetExtensions().first); | 140 EXPECT_STREQ(kFilteredClientExtensions, GetExtensions().first); |
| 138 EXPECT_STREQ(kFilteredExtensions, GetExtensions().second); | 141 EXPECT_STREQ(kFilteredExtensions, GetExtensions().second); |
| 139 } | 142 } |
| 140 | 143 |
| 141 } // namespace gl | 144 } // namespace gl |
| OLD | NEW |