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

Unified Diff: gpu/config/gpu_info_collector_unittest.cc

Issue 2629633003: Refactor GL bindings so there is no global GLApi or DriverGL. (Closed)
Patch Set: rebase Created 3 years, 11 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 | « gpu/command_buffer/tests/fuzzer_main.cc ('k') | gpu/ipc/in_process_command_buffer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/config/gpu_info_collector_unittest.cc
diff --git a/gpu/config/gpu_info_collector_unittest.cc b/gpu/config/gpu_info_collector_unittest.cc
index 68c1ddc06fb6250f78107f41d2399470304c7dd4..0deea54c1d150e4c017b098df968cf7a29d82e08 100644
--- a/gpu/config/gpu_info_collector_unittest.cc
+++ b/gpu/config/gpu_info_collector_unittest.cc
@@ -12,8 +12,10 @@
#include "gpu/config/gpu_info_collector.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gl/gl_context_stub.h"
#include "ui/gl/gl_implementation.h"
#include "ui/gl/gl_mock.h"
+#include "ui/gl/gl_surface_stub.h"
#include "ui/gl/init/gl_factory.h"
#include "ui/gl/test/gl_surface_test_support.h"
@@ -127,6 +129,14 @@ class GPUInfoCollectorTest
}
}
+ // Need to make a context current so that WillUseGLGetStringForExtensions
+ // can be called
+ context_ = new gl::GLContextStub;
+ context_->SetExtensionsString(test_values_.gl_extensions.c_str());
+ context_->SetGLVersionString(test_values_.gl_version.c_str());
+ surface_ = new gl::GLSurfaceStub;
+ context_->MakeCurrent(surface_.get());
+
EXPECT_CALL(*gl_, GetString(GL_VERSION))
.WillRepeatedly(Return(reinterpret_cast<const GLubyte*>(
test_values_.gl_version.c_str())));
@@ -175,6 +185,8 @@ class GPUInfoCollectorTest
// Use StrictMock to make 100% sure we know how GL will be called.
std::unique_ptr<::testing::StrictMock<::gl::MockGLInterface>> gl_;
GPUInfo test_values_;
+ scoped_refptr<gl::GLContextStub> context_;
+ scoped_refptr<gl::GLSurfaceStub> surface_;
const char* gl_shading_language_version_ = nullptr;
// Persistent storage is needed for the split extension string.
« no previous file with comments | « gpu/command_buffer/tests/fuzzer_main.cc ('k') | gpu/ipc/in_process_command_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698