OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/renderbuffer_manager.h" | 5 #include "gpu/command_buffer/service/renderbuffer_manager.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 namespace gpu { | 8 namespace gpu { |
9 namespace gles2 { | 9 namespace gles2 { |
10 | 10 |
11 class RenderbufferManagerTest : public testing::Test { | 11 class RenderbufferManagerTest : public testing::Test { |
12 public: | 12 public: |
13 RenderbufferManagerTest() { | 13 RenderbufferManagerTest() { |
14 } | 14 } |
15 | 15 |
16 protected: | 16 protected: |
17 virtual void SetUp() { | 17 virtual void SetUp() { |
18 } | 18 } |
19 | 19 |
20 virtual void TearDown() { | 20 virtual void TearDown() { |
21 } | 21 } |
22 | 22 |
23 RenderbufferManager manager_; | 23 RenderbufferManager manager_; |
24 }; | 24 }; |
25 | 25 |
26 TEST_F(RenderbufferManagerTest, Basic) { | 26 TEST_F(RenderbufferManagerTest, Basic) { |
27 const GLuint kRenderbuffer1Id = 1; | 27 const GLuint kClient1Id = 1; |
28 const GLuint kRenderbuffer2Id = 2; | 28 const GLuint kService1Id = 11; |
| 29 const GLuint kClient2Id = 2; |
29 // Check we can create renderbuffer. | 30 // Check we can create renderbuffer. |
30 manager_.CreateRenderbufferInfo(kRenderbuffer1Id); | 31 manager_.CreateRenderbufferInfo(kClient1Id, kService1Id); |
31 // Check renderbuffer got created. | 32 // Check renderbuffer got created. |
32 RenderbufferManager::RenderbufferInfo* info1 = | 33 RenderbufferManager::RenderbufferInfo* info1 = |
33 manager_.GetRenderbufferInfo(kRenderbuffer1Id); | 34 manager_.GetRenderbufferInfo(kClient1Id); |
34 ASSERT_TRUE(info1 != NULL); | 35 ASSERT_TRUE(info1 != NULL); |
35 EXPECT_FALSE(info1->cleared()); | 36 EXPECT_FALSE(info1->cleared()); |
36 info1->set_cleared(); | 37 info1->set_cleared(); |
37 EXPECT_TRUE(info1->cleared()); | 38 EXPECT_TRUE(info1->cleared()); |
38 EXPECT_FALSE(info1->IsDeleted()); | 39 EXPECT_FALSE(info1->IsDeleted()); |
39 EXPECT_EQ(kRenderbuffer1Id, info1->renderbuffer_id()); | 40 EXPECT_EQ(kService1Id, info1->service_id()); |
40 // Check we get nothing for a non-existent renderbuffer. | 41 // Check we get nothing for a non-existent renderbuffer. |
41 EXPECT_TRUE(manager_.GetRenderbufferInfo(kRenderbuffer2Id) == NULL); | 42 EXPECT_TRUE(manager_.GetRenderbufferInfo(kClient2Id) == NULL); |
42 // Check trying to a remove non-existent renderbuffers does not crash. | 43 // Check trying to a remove non-existent renderbuffers does not crash. |
43 manager_.RemoveRenderbufferInfo(kRenderbuffer2Id); | 44 manager_.RemoveRenderbufferInfo(kClient2Id); |
44 // Check we can't get the renderbuffer after we remove it. | 45 // Check we can't get the renderbuffer after we remove it. |
45 manager_.RemoveRenderbufferInfo(kRenderbuffer1Id); | 46 manager_.RemoveRenderbufferInfo(kClient1Id); |
46 EXPECT_TRUE(manager_.GetRenderbufferInfo(kRenderbuffer1Id) == NULL); | 47 EXPECT_TRUE(manager_.GetRenderbufferInfo(kClient1Id) == NULL); |
47 } | 48 } |
48 | 49 |
49 } // namespace gles2 | 50 } // namespace gles2 |
50 } // namespace gpu | 51 } // namespace gpu |
51 | 52 |
52 | 53 |
OLD | NEW |