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

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

Issue 235563002: gpu: Separate GpuControlService from GpuControl (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove MailboxManager Created 6 years, 7 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 | Annotate | Revision Log
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_array_manager.h" 5 #include "gpu/command_buffer/service/vertex_array_manager.h"
6 #include "gpu/command_buffer/service/vertex_attrib_manager.h" 6 #include "gpu/command_buffer/service/vertex_attrib_manager.h"
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "gpu/command_buffer/service/feature_info.h" 9 #include "gpu/command_buffer/service/feature_info.h"
10 #include "gpu/command_buffer/service/test_helper.h" 10 #include "gpu/command_buffer/service/test_helper.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 const uint32 VertexArrayManagerTest::kNumVertexAttribs; 51 const uint32 VertexArrayManagerTest::kNumVertexAttribs;
52 #endif 52 #endif
53 53
54 TEST_F(VertexArrayManagerTest, Basic) { 54 TEST_F(VertexArrayManagerTest, Basic) {
55 const GLuint kClient1Id = 1; 55 const GLuint kClient1Id = 1;
56 const GLuint kService1Id = 11; 56 const GLuint kService1Id = 11;
57 const GLuint kClient2Id = 2; 57 const GLuint kClient2Id = 2;
58 58
59 // Check we can create 59 // Check we can create
60 manager_->CreateVertexAttribManager( 60 manager_->CreateVertexAttribManager(
61 kClient1Id, kService1Id, kNumVertexAttribs, true); 61 kClient1Id, kService1Id, kNumVertexAttribs);
62 // Check creation success 62 // Check creation success
63 VertexAttribManager* info1 = manager_->GetVertexAttribManager(kClient1Id); 63 VertexAttribManager* info1 = manager_->GetVertexAttribManager(kClient1Id);
64 ASSERT_TRUE(info1 != NULL); 64 ASSERT_TRUE(info1 != NULL);
65 EXPECT_EQ(kService1Id, info1->service_id()); 65 EXPECT_EQ(kService1Id, info1->service_id());
66 GLuint client_id = 0; 66 GLuint client_id = 0;
67 EXPECT_TRUE(manager_->GetClientId(info1->service_id(), &client_id)); 67 EXPECT_TRUE(manager_->GetClientId(info1->service_id(), &client_id));
68 EXPECT_EQ(kClient1Id, client_id); 68 EXPECT_EQ(kClient1Id, client_id);
69 // Check we get nothing for a non-existent name. 69 // Check we get nothing for a non-existent name.
70 EXPECT_TRUE(manager_->GetVertexAttribManager(kClient2Id) == NULL); 70 EXPECT_TRUE(manager_->GetVertexAttribManager(kClient2Id) == NULL);
71 // Check trying to a remove non-existent name does not crash. 71 // Check trying to a remove non-existent name does not crash.
72 manager_->RemoveVertexAttribManager(kClient2Id); 72 manager_->RemoveVertexAttribManager(kClient2Id);
73 // Check that it gets deleted when the last reference is released. 73 // Check that it gets deleted when the last reference is released.
74 EXPECT_CALL(*gl_, DeleteVertexArraysOES(1, ::testing::Pointee(kService1Id))) 74 EXPECT_CALL(*gl_, DeleteVertexArraysOES(1, ::testing::Pointee(kService1Id)))
75 .Times(1) 75 .Times(1)
76 .RetiresOnSaturation(); 76 .RetiresOnSaturation();
77 // Check we can't get the texture after we remove it. 77 // Check we can't get the texture after we remove it.
78 manager_->RemoveVertexAttribManager(kClient1Id); 78 manager_->RemoveVertexAttribManager(kClient1Id);
79 EXPECT_TRUE(manager_->GetVertexAttribManager(kClient1Id) == NULL); 79 EXPECT_TRUE(manager_->GetVertexAttribManager(kClient1Id) == NULL);
80 } 80 }
81 81
82 TEST_F(VertexArrayManagerTest, Destroy) { 82 TEST_F(VertexArrayManagerTest, Destroy) {
83 const GLuint kClient1Id = 1; 83 const GLuint kClient1Id = 1;
84 const GLuint kService1Id = 11; 84 const GLuint kService1Id = 11;
85 VertexArrayManager manager; 85 VertexArrayManager manager;
86 // Check we can create 86 // Check we can create
87 manager.CreateVertexAttribManager( 87 manager.CreateVertexAttribManager(kClient1Id, kService1Id, kNumVertexAttribs);
88 kClient1Id, kService1Id, kNumVertexAttribs, true);
89 // Check creation success 88 // Check creation success
90 VertexAttribManager* info1 = manager.GetVertexAttribManager(kClient1Id); 89 VertexAttribManager* info1 = manager.GetVertexAttribManager(kClient1Id);
91 ASSERT_TRUE(info1 != NULL); 90 ASSERT_TRUE(info1 != NULL);
92 EXPECT_CALL(*gl_, DeleteVertexArraysOES(1, ::testing::Pointee(kService1Id))) 91 EXPECT_CALL(*gl_, DeleteVertexArraysOES(1, ::testing::Pointee(kService1Id)))
93 .Times(1) 92 .Times(1)
94 .RetiresOnSaturation(); 93 .RetiresOnSaturation();
95 manager.Destroy(true); 94 manager.Destroy(true);
96 // Check that resources got freed. 95 // Check that resources got freed.
97 info1 = manager.GetVertexAttribManager(kClient1Id); 96 info1 = manager.GetVertexAttribManager(kClient1Id);
98 ASSERT_TRUE(info1 == NULL); 97 ASSERT_TRUE(info1 == NULL);
99 } 98 }
100 99
101 } // namespace gles2 100 } // namespace gles2
102 } // namespace gpu 101 } // namespace gpu
103 102
104 103
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698