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/framebuffer_manager.h" | 5 #include "gpu/command_buffer/service/framebuffer_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 FramebufferManagerTest : public testing::Test { | 11 class FramebufferManagerTest : public testing::Test { |
12 public: | 12 public: |
13 FramebufferManagerTest() { | 13 FramebufferManagerTest() { |
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 FramebufferManager manager_; | 23 FramebufferManager manager_; |
24 }; | 24 }; |
25 | 25 |
26 TEST_F(FramebufferManagerTest, Basic) { | 26 TEST_F(FramebufferManagerTest, Basic) { |
27 const GLuint kFramebuffer1Id = 1; | 27 const GLuint kClient1Id = 1; |
28 const GLuint kFramebuffer2Id = 2; | 28 const GLuint kService1Id = 11; |
| 29 const GLuint kClient2Id = 2; |
29 // Check we can create framebuffer. | 30 // Check we can create framebuffer. |
30 manager_.CreateFramebufferInfo(kFramebuffer1Id); | 31 manager_.CreateFramebufferInfo(kClient1Id, kService1Id); |
31 // Check framebuffer got created. | 32 // Check framebuffer got created. |
32 FramebufferManager::FramebufferInfo* info1 = | 33 FramebufferManager::FramebufferInfo* info1 = |
33 manager_.GetFramebufferInfo(kFramebuffer1Id); | 34 manager_.GetFramebufferInfo(kClient1Id); |
34 ASSERT_TRUE(info1 != NULL); | 35 ASSERT_TRUE(info1 != NULL); |
35 EXPECT_FALSE(info1->IsDeleted()); | 36 EXPECT_FALSE(info1->IsDeleted()); |
36 EXPECT_EQ(kFramebuffer1Id, info1->framebuffer_id()); | 37 EXPECT_EQ(kService1Id, info1->service_id()); |
37 // Check we get nothing for a non-existent framebuffer. | 38 // Check we get nothing for a non-existent framebuffer. |
38 EXPECT_TRUE(manager_.GetFramebufferInfo(kFramebuffer2Id) == NULL); | 39 EXPECT_TRUE(manager_.GetFramebufferInfo(kClient2Id) == NULL); |
39 // Check trying to a remove non-existent framebuffers does not crash. | 40 // Check trying to a remove non-existent framebuffers does not crash. |
40 manager_.RemoveFramebufferInfo(kFramebuffer2Id); | 41 manager_.RemoveFramebufferInfo(kClient2Id); |
41 // Check we can't get the framebuffer after we remove it. | 42 // Check we can't get the framebuffer after we remove it. |
42 manager_.RemoveFramebufferInfo(kFramebuffer1Id); | 43 manager_.RemoveFramebufferInfo(kClient1Id); |
43 EXPECT_TRUE(manager_.GetFramebufferInfo(kFramebuffer1Id) == NULL); | 44 EXPECT_TRUE(manager_.GetFramebufferInfo(kClient1Id) == NULL); |
44 } | 45 } |
45 | 46 |
46 // TODO(gman): Write test for AttachRenderbuffer | 47 // TODO(gman): Write test for AttachRenderbuffer |
47 | 48 |
48 } // namespace gles2 | 49 } // namespace gles2 |
49 } // namespace gpu | 50 } // namespace gpu |
50 | 51 |
51 | 52 |
OLD | NEW |