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

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

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: undo part of clang-format Created 4 years, 8 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 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 #include <stdint.h> 7 #include <stdint.h>
8 8
no sievers 2016/04/05 19:02:42 #include <memory>
Mostyn Bramley-Moore 2016/04/05 21:35:32 Done.
9 #include "gpu/command_buffer/service/feature_info.h" 9 #include "gpu/command_buffer/service/feature_info.h"
10 #include "gpu/command_buffer/tests/gl_manager.h" 10 #include "gpu/command_buffer/tests/gl_manager.h"
11 #include "gpu/command_buffer/tests/gl_test_utils.h" 11 #include "gpu/command_buffer/tests/gl_test_utils.h"
12 #include "testing/gmock/include/gmock/gmock.h" 12 #include "testing/gmock/include/gmock/gmock.h"
13 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
14 14
15 namespace gpu { 15 namespace gpu {
16 16
17 class GLTest : public testing::Test { 17 class GLTest : public testing::Test {
18 protected: 18 protected:
(...skipping 14 matching lines...) Expand all
33 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected)); 33 EXPECT_TRUE(GLTestHelper::CheckPixels(0, 0, 1, 1, 0, expected));
34 GLTestHelper::CheckGLError("no errors", __LINE__); 34 GLTestHelper::CheckGLError("no errors", __LINE__);
35 } 35 }
36 36
37 TEST_F(GLTest, BasicFBO) { 37 TEST_F(GLTest, BasicFBO) {
38 GLuint tex = 0; 38 GLuint tex = 0;
39 glGenTextures(1, &tex); 39 glGenTextures(1, &tex);
40 GLuint fbo = 0; 40 GLuint fbo = 0;
41 glGenFramebuffers(1, &fbo); 41 glGenFramebuffers(1, &fbo);
42 glBindTexture(GL_TEXTURE_2D, tex); 42 glBindTexture(GL_TEXTURE_2D, tex);
43 scoped_ptr<uint8_t[]> pixels(new uint8_t[16 * 16 * 4]); 43 std::unique_ptr<uint8_t[]> pixels(new uint8_t[16 * 16 * 4]);
44 memset(pixels.get(), 0, 16*16*4); 44 memset(pixels.get(), 0, 16*16*4);
45 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE, 45 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 16, 0, GL_RGBA, GL_UNSIGNED_BYTE,
46 pixels.get()); 46 pixels.get());
47 glGenerateMipmap(GL_TEXTURE_2D); 47 glGenerateMipmap(GL_TEXTURE_2D);
48 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 48 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
49 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 49 glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
50 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 50 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
51 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 51 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
52 glBindFramebuffer(GL_FRAMEBUFFER, fbo); 52 glBindFramebuffer(GL_FRAMEBUFFER, fbo);
53 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 53 glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 EXPECT_STREQ( 132 EXPECT_STREQ(
133 "Chromium", 133 "Chromium",
134 reinterpret_cast<const char*>(glGetString(GL_RENDERER))); 134 reinterpret_cast<const char*>(glGetString(GL_RENDERER)));
135 EXPECT_STREQ( 135 EXPECT_STREQ(
136 "Chromium", 136 "Chromium",
137 reinterpret_cast<const char*>(glGetString(GL_VENDOR))); 137 reinterpret_cast<const char*>(glGetString(GL_VENDOR)));
138 } 138 }
139 139
140 } // namespace gpu 140 } // namespace gpu
141 141
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698