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

Side by Side Diff: gpu/command_buffer/client/program_info_manager_unittest.cc

Issue 1859703002: convert //gpu to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on master 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) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory>
9
8 #include "gpu/command_buffer/client/program_info_manager.h" 10 #include "gpu/command_buffer/client/program_info_manager.h"
9 #include "testing/gtest/include/gtest/gtest.h" 11 #include "testing/gtest/include/gtest/gtest.h"
10 12
11 namespace { 13 namespace {
12 14
13 uint32_t ComputeOffset(const void* start, const void* position) { 15 uint32_t ComputeOffset(const void* start, const void* position) {
14 return static_cast<const uint8_t*>(position) - 16 return static_cast<const uint8_t*>(position) -
15 static_cast<const uint8_t*>(start); 17 static_cast<const uint8_t*>(start);
16 } 18 }
17 19
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 data->entry[0].name_offset = ComputeOffset(data, data->name0); 160 data->entry[0].name_offset = ComputeOffset(data, data->name0);
159 data->entry[0].name_length = arraysize(data->name0); 161 data->entry[0].name_length = arraysize(data->name0);
160 data->entry[1].size = 2; 162 data->entry[1].size = 2;
161 data->entry[1].type = GL_FLOAT; 163 data->entry[1].type = GL_FLOAT;
162 data->entry[1].name_offset = ComputeOffset(data, data->name1); 164 data->entry[1].name_offset = ComputeOffset(data, data->name1);
163 data->entry[1].name_length = arraysize(data->name1); 165 data->entry[1].name_length = arraysize(data->name1);
164 memcpy(data->name0, kName[0], arraysize(data->name0)); 166 memcpy(data->name0, kName[0], arraysize(data->name0));
165 memcpy(data->name1, kName[1], arraysize(data->name1)); 167 memcpy(data->name1, kName[1], arraysize(data->name1));
166 } 168 }
167 169
168 scoped_ptr<ProgramInfoManager> program_info_manager_; 170 std::unique_ptr<ProgramInfoManager> program_info_manager_;
169 Program* program_; 171 Program* program_;
170 }; 172 };
171 173
172 TEST_F(ProgramInfoManagerTest, UpdateES2) { 174 TEST_F(ProgramInfoManagerTest, UpdateES2) {
173 ProgramES2Data data; 175 ProgramES2Data data;
174 SetupProgramES2Data(&data); 176 SetupProgramES2Data(&data);
175 const std::string kNames[] = { data.uniform_name0, data.uniform_name1 }; 177 const std::string kNames[] = { data.uniform_name0, data.uniform_name1 };
176 const int32_t* kLocs[] = { data.uniform_loc0, data.uniform_loc1 }; 178 const int32_t* kLocs[] = { data.uniform_loc0, data.uniform_loc1 };
177 std::vector<int8_t> result(sizeof(data)); 179 std::vector<int8_t> result(sizeof(data));
178 memcpy(&result[0], &data, sizeof(data)); 180 memcpy(&result[0], &data, sizeof(data));
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 EXPECT_EQ(data_es2.uniforms[ii].size, size[ii]); 551 EXPECT_EQ(data_es2.uniforms[ii].size, size[ii]);
550 EXPECT_EQ(data_es2.uniforms[ii].type, static_cast<uint32_t>(type[ii])); 552 EXPECT_EQ(data_es2.uniforms[ii].type, static_cast<uint32_t>(type[ii]));
551 EXPECT_EQ(data_es2.uniforms[ii].name_length + 1, 553 EXPECT_EQ(data_es2.uniforms[ii].name_length + 1,
552 static_cast<uint32_t>(name_length[ii])); 554 static_cast<uint32_t>(name_length[ii]));
553 } 555 }
554 } 556 }
555 557
556 } // namespace gles2 558 } // namespace gles2
557 } // namespace gpu 559 } // namespace gpu
558 560
OLDNEW
« no previous file with comments | « gpu/command_buffer/client/mapped_memory_unittest.cc ('k') | gpu/command_buffer/client/query_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698