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

Side by Side Diff: cc/test/test_web_graphics_context_3d_unittest.cc

Issue 1866203004: Convert //cc from scoped_ptr to std::unique_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: scopedptrcc: rebase 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
« no previous file with comments | « cc/test/test_web_graphics_context_3d.cc ('k') | cc/test/threaded_channel_for_test.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "base/memory/scoped_ptr.h"
6 #include "cc/test/test_web_graphics_context_3d.h" 5 #include "cc/test/test_web_graphics_context_3d.h"
6
7 #include <memory>
8
7 #include "gpu/GLES2/gl2extchromium.h" 9 #include "gpu/GLES2/gl2extchromium.h"
8 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
9 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
10 #include "third_party/khronos/GLES2/gl2ext.h" 12 #include "third_party/khronos/GLES2/gl2ext.h"
11 13
12 namespace cc { 14 namespace cc {
13 namespace { 15 namespace {
14 16
15 static bool check_parameter_value(TestWebGraphicsContext3D* context, 17 static bool check_parameter_value(TestWebGraphicsContext3D* context,
16 GLenum pname, 18 GLenum pname,
17 GLint expected_value) { 19 GLint expected_value) {
18 GLint actual_value = 0; 20 GLint actual_value = 0;
19 context->getTexParameteriv(GL_TEXTURE_2D, pname, &actual_value); 21 context->getTexParameteriv(GL_TEXTURE_2D, pname, &actual_value);
20 return expected_value == actual_value; 22 return expected_value == actual_value;
21 } 23 }
22 24
23 static void expect_default_parameter_values(TestWebGraphicsContext3D* context) { 25 static void expect_default_parameter_values(TestWebGraphicsContext3D* context) {
24 EXPECT_TRUE(check_parameter_value(context, GL_TEXTURE_MAG_FILTER, GL_LINEAR)); 26 EXPECT_TRUE(check_parameter_value(context, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
25 EXPECT_TRUE(check_parameter_value( 27 EXPECT_TRUE(check_parameter_value(
26 context, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR)); 28 context, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR));
27 EXPECT_TRUE( 29 EXPECT_TRUE(
28 check_parameter_value(context, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE)); 30 check_parameter_value(context, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
29 EXPECT_TRUE( 31 EXPECT_TRUE(
30 check_parameter_value(context, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE)); 32 check_parameter_value(context, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
31 EXPECT_TRUE(check_parameter_value(context, GL_TEXTURE_USAGE_ANGLE, GL_NONE)); 33 EXPECT_TRUE(check_parameter_value(context, GL_TEXTURE_USAGE_ANGLE, GL_NONE));
32 } 34 }
33 35
34 TEST(TestWebGraphicsContext3DTest, GetDefaultTextureParameterValues) { 36 TEST(TestWebGraphicsContext3DTest, GetDefaultTextureParameterValues) {
35 scoped_ptr<TestWebGraphicsContext3D> context( 37 std::unique_ptr<TestWebGraphicsContext3D> context(
36 TestWebGraphicsContext3D::Create()); 38 TestWebGraphicsContext3D::Create());
37 39
38 GLuint texture = context->createTexture(); 40 GLuint texture = context->createTexture();
39 context->bindTexture(GL_TEXTURE_2D, texture); 41 context->bindTexture(GL_TEXTURE_2D, texture);
40 42
41 expect_default_parameter_values(context.get()); 43 expect_default_parameter_values(context.get());
42 } 44 }
43 45
44 TEST(TestWebGraphicsContext3DTest, SetAndGetTextureParameter) { 46 TEST(TestWebGraphicsContext3DTest, SetAndGetTextureParameter) {
45 scoped_ptr<TestWebGraphicsContext3D> context( 47 std::unique_ptr<TestWebGraphicsContext3D> context(
46 TestWebGraphicsContext3D::Create()); 48 TestWebGraphicsContext3D::Create());
47 49
48 GLuint texture = context->createTexture(); 50 GLuint texture = context->createTexture();
49 context->bindTexture(GL_TEXTURE_2D, texture); 51 context->bindTexture(GL_TEXTURE_2D, texture);
50 context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 52 context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
51 53
52 EXPECT_TRUE( 54 EXPECT_TRUE(
53 check_parameter_value(context.get(), GL_TEXTURE_MIN_FILTER, GL_NEAREST)); 55 check_parameter_value(context.get(), GL_TEXTURE_MIN_FILTER, GL_NEAREST));
54 } 56 }
55 57
56 TEST(TestWebGraphicsContext3DTest, 58 TEST(TestWebGraphicsContext3DTest,
57 SetAndGetMultipleTextureParametersOnMultipleTextures) { 59 SetAndGetMultipleTextureParametersOnMultipleTextures) {
58 scoped_ptr<TestWebGraphicsContext3D> context( 60 std::unique_ptr<TestWebGraphicsContext3D> context(
59 TestWebGraphicsContext3D::Create()); 61 TestWebGraphicsContext3D::Create());
60 62
61 // Set and get non-default texture parameters on the first texture. 63 // Set and get non-default texture parameters on the first texture.
62 GLuint first_texture = context->createTexture(); 64 GLuint first_texture = context->createTexture();
63 context->bindTexture(GL_TEXTURE_2D, first_texture); 65 context->bindTexture(GL_TEXTURE_2D, first_texture);
64 context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 66 context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
65 context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 67 context->texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
66 68
67 EXPECT_TRUE( 69 EXPECT_TRUE(
68 check_parameter_value(context.get(), GL_TEXTURE_MIN_FILTER, GL_LINEAR)); 70 check_parameter_value(context.get(), GL_TEXTURE_MIN_FILTER, GL_LINEAR));
(...skipping 18 matching lines...) Expand all
87 // intact. 89 // intact.
88 context->bindTexture(GL_TEXTURE_2D, first_texture); 90 context->bindTexture(GL_TEXTURE_2D, first_texture);
89 91
90 EXPECT_TRUE( 92 EXPECT_TRUE(
91 check_parameter_value(context.get(), GL_TEXTURE_MIN_FILTER, GL_LINEAR)); 93 check_parameter_value(context.get(), GL_TEXTURE_MIN_FILTER, GL_LINEAR));
92 EXPECT_TRUE( 94 EXPECT_TRUE(
93 check_parameter_value(context.get(), GL_TEXTURE_MAG_FILTER, GL_NEAREST)); 95 check_parameter_value(context.get(), GL_TEXTURE_MAG_FILTER, GL_NEAREST));
94 } 96 }
95 97
96 TEST(TestWebGraphicsContext3DTest, UseMultipleRenderAndFramebuffers) { 98 TEST(TestWebGraphicsContext3DTest, UseMultipleRenderAndFramebuffers) {
97 scoped_ptr<TestWebGraphicsContext3D> context( 99 std::unique_ptr<TestWebGraphicsContext3D> context(
98 TestWebGraphicsContext3D::Create()); 100 TestWebGraphicsContext3D::Create());
99 101
100 GLuint ids[2]; 102 GLuint ids[2];
101 context->genFramebuffers(2, ids); 103 context->genFramebuffers(2, ids);
102 EXPECT_NE(ids[0], ids[1]); 104 EXPECT_NE(ids[0], ids[1]);
103 context->deleteFramebuffers(2, ids); 105 context->deleteFramebuffers(2, ids);
104 106
105 context->genRenderbuffers(2, ids); 107 context->genRenderbuffers(2, ids);
106 EXPECT_NE(ids[0], ids[1]); 108 EXPECT_NE(ids[0], ids[1]);
107 context->deleteRenderbuffers(2, ids); 109 context->deleteRenderbuffers(2, ids);
108 } 110 }
109 111
110 } // namespace 112 } // namespace
111 } // namespace cc 113 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_web_graphics_context_3d.cc ('k') | cc/test/threaded_channel_for_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698