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

Side by Side Diff: gpu/command_buffer/service/vertex_attrib_manager_unittest.cc

Issue 1542513002: Switch to standard integer types in gpu/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix Created 4 years, 12 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/vertex_attrib_manager.h" 5 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
6 6
7 #include <stdint.h>
8
7 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
8 #include "gpu/command_buffer/service/buffer_manager.h" 10 #include "gpu/command_buffer/service/buffer_manager.h"
9 #include "gpu/command_buffer/service/error_state_mock.h" 11 #include "gpu/command_buffer/service/error_state_mock.h"
10 #include "gpu/command_buffer/service/feature_info.h" 12 #include "gpu/command_buffer/service/feature_info.h"
11 #include "gpu/command_buffer/service/gpu_service_test.h" 13 #include "gpu/command_buffer/service/gpu_service_test.h"
12 #include "gpu/command_buffer/service/test_helper.h" 14 #include "gpu/command_buffer/service/test_helper.h"
13 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
14 #include "ui/gl/gl_mock.h" 16 #include "ui/gl/gl_mock.h"
15 17
16 using ::testing::Pointee; 18 using ::testing::Pointee;
17 using ::testing::_; 19 using ::testing::_;
18 20
19 namespace gpu { 21 namespace gpu {
20 namespace gles2 { 22 namespace gles2 {
21 23
22 class VertexAttribManagerTest : public GpuServiceTest { 24 class VertexAttribManagerTest : public GpuServiceTest {
23 public: 25 public:
24 static const uint32 kNumVertexAttribs = 8; 26 static const uint32_t kNumVertexAttribs = 8;
25 27
26 VertexAttribManagerTest() { 28 VertexAttribManagerTest() {
27 } 29 }
28 30
29 ~VertexAttribManagerTest() override {} 31 ~VertexAttribManagerTest() override {}
30 32
31 protected: 33 protected:
32 void SetUp() override { 34 void SetUp() override {
33 GpuServiceTest::SetUp(); 35 GpuServiceTest::SetUp();
34 36
35 for (uint32 ii = 0; ii < kNumVertexAttribs; ++ii) { 37 for (uint32_t ii = 0; ii < kNumVertexAttribs; ++ii) {
36 EXPECT_CALL(*gl_, VertexAttrib4f(ii, 0.0f, 0.0f, 0.0f, 1.0f)) 38 EXPECT_CALL(*gl_, VertexAttrib4f(ii, 0.0f, 0.0f, 0.0f, 1.0f))
37 .Times(1) 39 .Times(1)
38 .RetiresOnSaturation(); 40 .RetiresOnSaturation();
39 } 41 }
40 42
41 manager_ = new VertexAttribManager(); 43 manager_ = new VertexAttribManager();
42 manager_->Initialize(kNumVertexAttribs, true); 44 manager_->Initialize(kNumVertexAttribs, true);
43 } 45 }
44 46
45 scoped_refptr<VertexAttribManager> manager_; 47 scoped_refptr<VertexAttribManager> manager_;
46 }; 48 };
47 49
48 // GCC requires these declarations, but MSVC requires they not be present 50 // GCC requires these declarations, but MSVC requires they not be present
49 #ifndef COMPILER_MSVC 51 #ifndef COMPILER_MSVC
50 const uint32 VertexAttribManagerTest::kNumVertexAttribs; 52 const uint32_t VertexAttribManagerTest::kNumVertexAttribs;
51 #endif 53 #endif
52 54
53 TEST_F(VertexAttribManagerTest, Basic) { 55 TEST_F(VertexAttribManagerTest, Basic) {
54 EXPECT_TRUE(manager_->GetVertexAttrib(kNumVertexAttribs) == NULL); 56 EXPECT_TRUE(manager_->GetVertexAttrib(kNumVertexAttribs) == NULL);
55 EXPECT_FALSE(manager_->HaveFixedAttribs()); 57 EXPECT_FALSE(manager_->HaveFixedAttribs());
56 58
57 const VertexAttribManager::VertexAttribList& enabled_attribs = 59 const VertexAttribManager::VertexAttribList& enabled_attribs =
58 manager_->GetEnabledVertexAttribs(); 60 manager_->GetEnabledVertexAttribs();
59 EXPECT_EQ(0u, enabled_attribs.size()); 61 EXPECT_EQ(0u, enabled_attribs.size());
60 62
61 for (uint32 ii = 0; ii < kNumVertexAttribs; ii += kNumVertexAttribs - 1) { 63 for (uint32_t ii = 0; ii < kNumVertexAttribs; ii += kNumVertexAttribs - 1) {
62 VertexAttrib* attrib = manager_->GetVertexAttrib(ii); 64 VertexAttrib* attrib = manager_->GetVertexAttrib(ii);
63 ASSERT_TRUE(attrib != NULL); 65 ASSERT_TRUE(attrib != NULL);
64 EXPECT_EQ(ii, attrib->index()); 66 EXPECT_EQ(ii, attrib->index());
65 EXPECT_TRUE(attrib->buffer() == NULL); 67 EXPECT_TRUE(attrib->buffer() == NULL);
66 EXPECT_EQ(0, attrib->offset()); 68 EXPECT_EQ(0, attrib->offset());
67 EXPECT_EQ(4, attrib->size()); 69 EXPECT_EQ(4, attrib->size());
68 EXPECT_EQ(static_cast<GLenum>(GL_FLOAT), attrib->type()); 70 EXPECT_EQ(static_cast<GLenum>(GL_FLOAT), attrib->type());
69 EXPECT_EQ(GL_FALSE, attrib->normalized()); 71 EXPECT_EQ(GL_FALSE, attrib->normalized());
70 EXPECT_EQ(0, attrib->gl_stride()); 72 EXPECT_EQ(0, attrib->gl_stride());
71 EXPECT_FALSE(attrib->enabled()); 73 EXPECT_FALSE(attrib->enabled());
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 buffer_manager.Destroy(false); 221 buffer_manager.Destroy(false);
220 } 222 }
221 223
222 // TODO(gman): Test ValidateBindings 224 // TODO(gman): Test ValidateBindings
223 // TODO(gman): Test ValidateBindings with client side arrays. 225 // TODO(gman): Test ValidateBindings with client side arrays.
224 226
225 } // namespace gles2 227 } // namespace gles2
226 } // namespace gpu 228 } // namespace gpu
227 229
228 230
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/vertex_attrib_manager.cc ('k') | gpu/command_buffer/tests/compressed_texture_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698