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

Unified Diff: gpu/command_buffer/service/gpu_service_test.cc

Issue 332303002: gpu: Add base class for gpu service tests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: update gpu/build.GN Created 6 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 | « gpu/command_buffer/service/gpu_service_test.h ('k') | gpu/command_buffer/service/gpu_tracer_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gpu_service_test.cc
diff --git a/gpu/command_buffer/service/gpu_service_test.cc b/gpu/command_buffer/service/gpu_service_test.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a51a54c7a4879a2ff14e0cd722b74100009a6f9e
--- /dev/null
+++ b/gpu/command_buffer/service/gpu_service_test.cc
@@ -0,0 +1,50 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "gpu/command_buffer/service/gpu_service_test.h"
+
+#include "gpu/command_buffer/service/test_helper.h"
+#include "testing/gtest/include/gtest/gtest.h"
+#include "ui/gl/gl_context_stub_with_extensions.h"
+#include "ui/gl/gl_implementation.h"
+#include "ui/gl/gl_mock.h"
+#include "ui/gl/gl_surface.h"
+
+namespace gpu {
+namespace gles2 {
+
+GpuServiceTest::GpuServiceTest() : ran_setup_(false), ran_teardown_(false) {
+}
+
+GpuServiceTest::~GpuServiceTest() {
+ DCHECK(ran_teardown_);
+}
+
+void GpuServiceTest::SetUp() {
+ testing::Test::SetUp();
+
+ gfx::SetGLGetProcAddressProc(gfx::MockGLInterface::GetGLProcAddress);
+ gfx::GLSurface::InitializeOneOffWithMockBindingsForTests();
+ gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
+ ::gfx::MockGLInterface::SetGLInterface(gl_.get());
+
+ context_ = new gfx::GLContextStubWithExtensions;
+ context_->AddExtensionsString(NULL);
+ context_->SetGLVersionString("3.0");
+ gfx::GLSurface::InitializeDynamicMockBindingsForTests(context_);
+ ran_setup_ = true;
+}
+
+void GpuServiceTest::TearDown() {
+ DCHECK(ran_setup_);
+ ::gfx::MockGLInterface::SetGLInterface(NULL);
+ gl_.reset();
+ gfx::ClearGLBindings();
+ ran_teardown_ = true;
+
+ testing::Test::TearDown();
+}
+
+} // namespace gles2
+} // namespace gpu
« no previous file with comments | « gpu/command_buffer/service/gpu_service_test.h ('k') | gpu/command_buffer/service/gpu_tracer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698