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

Side by Side Diff: gpu/command_buffer/tests/gl_unittests_android.cc

Issue 1920163005: Split //ui/gl into //ui/gl + //ui/gi/init. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/tests/gl_tests_main.cc ('k') | gpu/command_buffer_service.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 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 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 <GLES2/gl2.h> 5 #include <GLES2/gl2.h>
6 #include <GLES2/gl2ext.h> 6 #include <GLES2/gl2ext.h>
7 7
8 #include <android/native_window_jni.h> 8 #include <android/native_window_jni.h>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/synchronization/waitable_event.h" 12 #include "base/synchronization/waitable_event.h"
13 #include "gpu/command_buffer/tests/gl_manager.h" 13 #include "gpu/command_buffer/tests/gl_manager.h"
14 #include "gpu/command_buffer/tests/gl_test_utils.h" 14 #include "gpu/command_buffer/tests/gl_test_utils.h"
15 #include "testing/gmock/include/gmock/gmock.h" 15 #include "testing/gmock/include/gmock/gmock.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 #include "ui/gfx/native_widget_types.h" 17 #include "ui/gfx/native_widget_types.h"
18 #include "ui/gl/android/surface_texture.h" 18 #include "ui/gl/android/surface_texture.h"
19 #include "ui/gl/gl_surface.h" 19 #include "ui/gl/gl_surface.h"
20 #include "ui/gl/init/gl_factory.h"
20 21
21 namespace gpu { 22 namespace gpu {
22 23
23 class GLSurfaceTextureTest : public testing::Test { 24 class GLSurfaceTextureTest : public testing::Test {
24 protected: 25 protected:
25 void SetUp() override { gl_.Initialize(GLManager::Options()); } 26 void SetUp() override { gl_.Initialize(GLManager::Options()); }
26 27
27 void TearDown() override { gl_.Destroy(); } 28 void TearDown() override { gl_.Destroy(); }
28 29
29 GLManager gl_; 30 GLManager gl_;
30 }; 31 };
31 32
32 TEST_F(GLSurfaceTextureTest, SimpleTest) { 33 TEST_F(GLSurfaceTextureTest, SimpleTest) {
33 // TODO(sievers): Eliminate the need for this by using a client-side 34 // TODO(sievers): Eliminate the need for this by using a client-side
34 // abstraction for the SurfaceTexture in this test. 35 // abstraction for the SurfaceTexture in this test.
35 GLuint texture = 0xFEEDBEEF; 36 GLuint texture = 0xFEEDBEEF;
36 37
37 scoped_refptr<gfx::SurfaceTexture> surface_texture( 38 scoped_refptr<gfx::SurfaceTexture> surface_texture(
38 gfx::SurfaceTexture::Create(texture)); 39 gfx::SurfaceTexture::Create(texture));
39 gfx::AcceleratedWidget window = surface_texture->CreateSurface(); 40 gfx::AcceleratedWidget window = surface_texture->CreateSurface();
40 EXPECT_TRUE(window != NULL); 41 EXPECT_TRUE(window != NULL);
41 42
42 scoped_refptr<gfx::GLSurface> gl_surface = 43 scoped_refptr<gfx::GLSurface> gl_surface =
43 gfx::GLSurface::CreateViewGLSurface(window); 44 gl::init::CreateViewGLSurface(window);
44 EXPECT_TRUE(gl_surface.get() != NULL); 45 EXPECT_TRUE(gl_surface.get() != NULL);
45 46
46 gl_.SetSurface(gl_surface.get()); 47 gl_.SetSurface(gl_surface.get());
47 48
48 glClearColor(0.0f, 1.0f, 0.0f, 1.0f); 49 glClearColor(0.0f, 1.0f, 0.0f, 1.0f);
49 glClear(GL_COLOR_BUFFER_BIT); 50 glClear(GL_COLOR_BUFFER_BIT);
50 // glSwapBuffers(); 51 // glSwapBuffers();
51 52
52 surface_texture->UpdateTexImage(); 53 surface_texture->UpdateTexImage();
53 54
54 GLTestHelper::CheckGLError("no errors", __LINE__); 55 GLTestHelper::CheckGLError("no errors", __LINE__);
55 56
56 ANativeWindow_release(window); 57 ANativeWindow_release(window);
57 } 58 }
58 59
59 } // namespace gpu 60 } // namespace gpu
60 61
OLDNEW
« no previous file with comments | « gpu/command_buffer/tests/gl_tests_main.cc ('k') | gpu/command_buffer_service.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698