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

Side by Side Diff: gpu/command_buffer/service/context_group_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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "gpu/command_buffer/service/context_group.h" 5 #include "gpu/command_buffer/service/context_group.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/memory/scoped_ptr.h" 9 #include <memory>
10
10 #include "gpu/command_buffer/common/value_state.h" 11 #include "gpu/command_buffer/common/value_state.h"
11 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" 12 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
12 #include "gpu/command_buffer/service/gpu_service_test.h" 13 #include "gpu/command_buffer/service/gpu_service_test.h"
13 #include "gpu/command_buffer/service/mailbox_manager.h" 14 #include "gpu/command_buffer/service/mailbox_manager.h"
14 #include "gpu/command_buffer/service/test_helper.h" 15 #include "gpu/command_buffer/service/test_helper.h"
15 #include "gpu/command_buffer/service/texture_manager.h" 16 #include "gpu/command_buffer/service/texture_manager.h"
16 #include "gpu/command_buffer/service/valuebuffer_manager.h" 17 #include "gpu/command_buffer/service/valuebuffer_manager.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "ui/gl/gl_mock.h" 19 #include "ui/gl/gl_mock.h"
19 20
(...skipping 21 matching lines...) Expand all
41 protected: 42 protected:
42 void SetUp() override { 43 void SetUp() override {
43 GpuServiceTest::SetUp(); 44 GpuServiceTest::SetUp();
44 decoder_.reset(new MockGLES2Decoder()); 45 decoder_.reset(new MockGLES2Decoder());
45 group_ = scoped_refptr<ContextGroup>(new ContextGroup( 46 group_ = scoped_refptr<ContextGroup>(new ContextGroup(
46 gpu_preferences_, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 47 gpu_preferences_, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
47 kBindGeneratesResource)); 48 kBindGeneratesResource));
48 } 49 }
49 50
50 GpuPreferences gpu_preferences_; 51 GpuPreferences gpu_preferences_;
51 scoped_ptr<MockGLES2Decoder> decoder_; 52 std::unique_ptr<MockGLES2Decoder> decoder_;
52 scoped_refptr<ContextGroup> group_; 53 scoped_refptr<ContextGroup> group_;
53 }; 54 };
54 55
55 TEST_F(ContextGroupTest, Basic) { 56 TEST_F(ContextGroupTest, Basic) {
56 // Test it starts off uninitialized. 57 // Test it starts off uninitialized.
57 EXPECT_EQ(0u, group_->max_vertex_attribs()); 58 EXPECT_EQ(0u, group_->max_vertex_attribs());
58 EXPECT_EQ(0u, group_->max_texture_units()); 59 EXPECT_EQ(0u, group_->max_texture_units());
59 EXPECT_EQ(0u, group_->max_texture_image_units()); 60 EXPECT_EQ(0u, group_->max_texture_image_units());
60 EXPECT_EQ(0u, group_->max_vertex_texture_image_units()); 61 EXPECT_EQ(0u, group_->max_vertex_texture_image_units());
61 EXPECT_EQ(0u, group_->max_fragment_uniform_vectors()); 62 EXPECT_EQ(0u, group_->max_fragment_uniform_vectors());
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 group_->Destroy(decoder_.get(), false); 99 group_->Destroy(decoder_.get(), false);
99 EXPECT_TRUE(group_->buffer_manager() == NULL); 100 EXPECT_TRUE(group_->buffer_manager() == NULL);
100 EXPECT_TRUE(group_->framebuffer_manager() == NULL); 101 EXPECT_TRUE(group_->framebuffer_manager() == NULL);
101 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); 102 EXPECT_TRUE(group_->renderbuffer_manager() == NULL);
102 EXPECT_TRUE(group_->texture_manager() == NULL); 103 EXPECT_TRUE(group_->texture_manager() == NULL);
103 EXPECT_TRUE(group_->program_manager() == NULL); 104 EXPECT_TRUE(group_->program_manager() == NULL);
104 EXPECT_TRUE(group_->shader_manager() == NULL); 105 EXPECT_TRUE(group_->shader_manager() == NULL);
105 } 106 }
106 107
107 TEST_F(ContextGroupTest, MultipleContexts) { 108 TEST_F(ContextGroupTest, MultipleContexts) {
108 scoped_ptr<MockGLES2Decoder> decoder2_(new MockGLES2Decoder()); 109 std::unique_ptr<MockGLES2Decoder> decoder2_(new MockGLES2Decoder());
109 TestHelper::SetupContextGroupInitExpectations( 110 TestHelper::SetupContextGroupInitExpectations(
110 gl_.get(), DisallowedFeatures(), "", "", kBindGeneratesResource); 111 gl_.get(), DisallowedFeatures(), "", "", kBindGeneratesResource);
111 EXPECT_TRUE(group_->Initialize(decoder_.get(), CONTEXT_TYPE_OPENGLES2, 112 EXPECT_TRUE(group_->Initialize(decoder_.get(), CONTEXT_TYPE_OPENGLES2,
112 DisallowedFeatures())); 113 DisallowedFeatures()));
113 EXPECT_FALSE(group_->Initialize(decoder2_.get(), CONTEXT_TYPE_WEBGL1, 114 EXPECT_FALSE(group_->Initialize(decoder2_.get(), CONTEXT_TYPE_WEBGL1,
114 DisallowedFeatures())); 115 DisallowedFeatures()));
115 EXPECT_FALSE(group_->Initialize(decoder2_.get(), CONTEXT_TYPE_WEBGL2, 116 EXPECT_FALSE(group_->Initialize(decoder2_.get(), CONTEXT_TYPE_WEBGL2,
116 DisallowedFeatures())); 117 DisallowedFeatures()));
117 EXPECT_FALSE(group_->Initialize(decoder2_.get(), CONTEXT_TYPE_OPENGLES3, 118 EXPECT_FALSE(group_->Initialize(decoder2_.get(), CONTEXT_TYPE_OPENGLES3,
118 DisallowedFeatures())); 119 DisallowedFeatures()));
(...skipping 23 matching lines...) Expand all
142 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); 143 EXPECT_TRUE(group_->renderbuffer_manager() == NULL);
143 EXPECT_TRUE(group_->texture_manager() == NULL); 144 EXPECT_TRUE(group_->texture_manager() == NULL);
144 EXPECT_TRUE(group_->program_manager() == NULL); 145 EXPECT_TRUE(group_->program_manager() == NULL);
145 EXPECT_TRUE(group_->shader_manager() == NULL); 146 EXPECT_TRUE(group_->shader_manager() == NULL);
146 } 147 }
147 148
148 } // namespace gles2 149 } // namespace gles2
149 } // namespace gpu 150 } // namespace gpu
150 151
151 152
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698