Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / gpu / command_buffer / tests / gl_shared_resources_unittest.cc
blob0f7ffe8b7eccc2ff52a5a4590fa7484f5e064abf
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include <GLES2/gl2.h>
6 #include <GLES2/gl2ext.h>
8 #include "base/logging.h"
9 #include "gpu/command_buffer/tests/gl_manager.h"
10 #include "gpu/command_buffer/tests/gl_test_utils.h"
11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h"
14 namespace gpu {
16 class GLSharedResources : public testing::Test {
17 protected:
18 void SetUp() override {
19 GLManager::Options options;
20 options.bind_generates_resource = true;
21 gl1_.Initialize(options);
22 options.share_group_manager = &gl1_;
23 gl2_.Initialize(options);
26 void TearDown() override {
27 gl1_.Destroy();
28 gl2_.Destroy();
31 GLManager gl1_;
32 GLManager gl2_;
35 // Test that GL creating/deleting works across context.
36 TEST_F(GLSharedResources, CreateDelete) {
37 gl1_.MakeCurrent();
38 GLuint tex = 0;
39 glGenTextures(1, &tex);
40 gl2_.MakeCurrent();
41 glBindTexture(GL_TEXTURE_2D, tex);
42 glDeleteTextures(1, &tex);
43 gl1_.MakeCurrent();
44 glBindTexture(GL_TEXTURE_2D,tex);
45 GLTestHelper::CheckGLError("no errors", __LINE__);
46 gl2_.MakeCurrent();
47 GLTestHelper::CheckGLError("no errors", __LINE__);
50 } // namespace gpu