Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / gpu / command_buffer / tests / gl_unittests_android.cc
blob9bdd503fd9d8599ffd331f2b36dcc692857dc8d3
1 // Copyright (c) 2013 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 <android/native_window_jni.h>
10 #include "base/bind.h"
11 #include "base/logging.h"
12 #include "base/synchronization/waitable_event.h"
13 #include "gpu/command_buffer/tests/gl_manager.h"
14 #include "gpu/command_buffer/tests/gl_test_utils.h"
15 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/gfx/native_widget_types.h"
18 #include "ui/gl/android/surface_texture.h"
19 #include "ui/gl/gl_surface.h"
21 namespace gpu {
23 class GLSurfaceTextureTest : public testing::Test {
24 protected:
25 void SetUp() override { gl_.Initialize(GLManager::Options()); }
27 void TearDown() override { gl_.Destroy(); }
29 GLManager gl_;
32 TEST_F(GLSurfaceTextureTest, SimpleTest) {
33 // TODO(sievers): Eliminate the need for this by using a client-side
34 // abstraction for the SurfaceTexture in this test.
35 GLuint texture = 0xFEEDBEEF;
37 scoped_refptr<gfx::SurfaceTexture> surface_texture(
38 gfx::SurfaceTexture::Create(texture));
39 gfx::AcceleratedWidget window = surface_texture->CreateSurface();
40 EXPECT_TRUE(window != NULL);
42 scoped_refptr<gfx::GLSurface> gl_surface =
43 gfx::GLSurface::CreateViewGLSurface(window);
44 EXPECT_TRUE(gl_surface.get() != NULL);
46 gl_.SetSurface(gl_surface.get());
48 glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
49 glClear(GL_COLOR_BUFFER_BIT);
50 // glSwapBuffers();
52 surface_texture->UpdateTexImage();
54 GLTestHelper::CheckGLError("no errors", __LINE__);
56 ANativeWindow_release(window);
59 } // namespace gpu