OLD | NEW |
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/context_group.h" | 5 #include "gpu/command_buffer/service/context_group.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 8 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
9 #include "gpu/command_buffer/service/test_helper.h" | 9 #include "gpu/command_buffer/service/test_helper.h" |
10 #include "gpu/command_buffer/service/texture_manager.h" | 10 #include "gpu/command_buffer/service/texture_manager.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 using ::testing::SetArrayArgument; | 23 using ::testing::SetArrayArgument; |
24 using ::testing::SetArgumentPointee; | 24 using ::testing::SetArgumentPointee; |
25 using ::testing::StrEq; | 25 using ::testing::StrEq; |
26 using ::testing::StrictMock; | 26 using ::testing::StrictMock; |
27 | 27 |
28 namespace gpu { | 28 namespace gpu { |
29 namespace gles2 { | 29 namespace gles2 { |
30 | 30 |
31 class ContextGroupTest : public testing::Test { | 31 class ContextGroupTest : public testing::Test { |
32 public: | 32 public: |
33 ContextGroupTest() { | 33 static const bool kBindGeneratesResource = false; |
34 } | 34 |
| 35 ContextGroupTest() {} |
35 | 36 |
36 protected: | 37 protected: |
37 virtual void SetUp() { | 38 virtual void SetUp() { |
38 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); | 39 gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>()); |
39 ::gfx::MockGLInterface::SetGLInterface(gl_.get()); | 40 ::gfx::MockGLInterface::SetGLInterface(gl_.get()); |
40 decoder_.reset(new MockGLES2Decoder()); | 41 decoder_.reset(new MockGLES2Decoder()); |
41 group_ = scoped_refptr<ContextGroup>( | 42 group_ = scoped_refptr<ContextGroup>( |
42 new ContextGroup(NULL, NULL, NULL, NULL, NULL, true)); | 43 new ContextGroup(NULL, NULL, NULL, NULL, NULL, kBindGeneratesResource)); |
43 } | 44 } |
44 | 45 |
45 virtual void TearDown() { | 46 virtual void TearDown() { |
46 ::gfx::MockGLInterface::SetGLInterface(NULL); | 47 ::gfx::MockGLInterface::SetGLInterface(NULL); |
47 gl_.reset(); | 48 gl_.reset(); |
48 } | 49 } |
49 | 50 |
50 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; | 51 scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_; |
51 scoped_ptr<MockGLES2Decoder> decoder_; | 52 scoped_ptr<MockGLES2Decoder> decoder_; |
52 scoped_refptr<ContextGroup> group_; | 53 scoped_refptr<ContextGroup> group_; |
(...skipping 10 matching lines...) Expand all Loading... |
63 EXPECT_EQ(0u, group_->max_vertex_uniform_vectors()); | 64 EXPECT_EQ(0u, group_->max_vertex_uniform_vectors()); |
64 EXPECT_TRUE(group_->buffer_manager() == NULL); | 65 EXPECT_TRUE(group_->buffer_manager() == NULL); |
65 EXPECT_TRUE(group_->framebuffer_manager() == NULL); | 66 EXPECT_TRUE(group_->framebuffer_manager() == NULL); |
66 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); | 67 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); |
67 EXPECT_TRUE(group_->texture_manager() == NULL); | 68 EXPECT_TRUE(group_->texture_manager() == NULL); |
68 EXPECT_TRUE(group_->program_manager() == NULL); | 69 EXPECT_TRUE(group_->program_manager() == NULL); |
69 EXPECT_TRUE(group_->shader_manager() == NULL); | 70 EXPECT_TRUE(group_->shader_manager() == NULL); |
70 } | 71 } |
71 | 72 |
72 TEST_F(ContextGroupTest, InitializeNoExtensions) { | 73 TEST_F(ContextGroupTest, InitializeNoExtensions) { |
73 TestHelper::SetupContextGroupInitExpectations(gl_.get(), | 74 TestHelper::SetupContextGroupInitExpectations( |
74 DisallowedFeatures(), "", ""); | 75 gl_.get(), DisallowedFeatures(), "", "", kBindGeneratesResource); |
75 group_->Initialize(decoder_.get(), DisallowedFeatures()); | 76 group_->Initialize(decoder_.get(), DisallowedFeatures()); |
76 EXPECT_EQ(static_cast<uint32>(TestHelper::kNumVertexAttribs), | 77 EXPECT_EQ(static_cast<uint32>(TestHelper::kNumVertexAttribs), |
77 group_->max_vertex_attribs()); | 78 group_->max_vertex_attribs()); |
78 EXPECT_EQ(static_cast<uint32>(TestHelper::kNumTextureUnits), | 79 EXPECT_EQ(static_cast<uint32>(TestHelper::kNumTextureUnits), |
79 group_->max_texture_units()); | 80 group_->max_texture_units()); |
80 EXPECT_EQ(static_cast<uint32>(TestHelper::kMaxTextureImageUnits), | 81 EXPECT_EQ(static_cast<uint32>(TestHelper::kMaxTextureImageUnits), |
81 group_->max_texture_image_units()); | 82 group_->max_texture_image_units()); |
82 EXPECT_EQ(static_cast<uint32>(TestHelper::kMaxVertexTextureImageUnits), | 83 EXPECT_EQ(static_cast<uint32>(TestHelper::kMaxVertexTextureImageUnits), |
83 group_->max_vertex_texture_image_units()); | 84 group_->max_vertex_texture_image_units()); |
84 EXPECT_EQ(static_cast<uint32>(TestHelper::kMaxFragmentUniformVectors), | 85 EXPECT_EQ(static_cast<uint32>(TestHelper::kMaxFragmentUniformVectors), |
(...skipping 13 matching lines...) Expand all Loading... |
98 EXPECT_TRUE(group_->buffer_manager() == NULL); | 99 EXPECT_TRUE(group_->buffer_manager() == NULL); |
99 EXPECT_TRUE(group_->framebuffer_manager() == NULL); | 100 EXPECT_TRUE(group_->framebuffer_manager() == NULL); |
100 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); | 101 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); |
101 EXPECT_TRUE(group_->texture_manager() == NULL); | 102 EXPECT_TRUE(group_->texture_manager() == NULL); |
102 EXPECT_TRUE(group_->program_manager() == NULL); | 103 EXPECT_TRUE(group_->program_manager() == NULL); |
103 EXPECT_TRUE(group_->shader_manager() == NULL); | 104 EXPECT_TRUE(group_->shader_manager() == NULL); |
104 } | 105 } |
105 | 106 |
106 TEST_F(ContextGroupTest, MultipleContexts) { | 107 TEST_F(ContextGroupTest, MultipleContexts) { |
107 scoped_ptr<MockGLES2Decoder> decoder2_(new MockGLES2Decoder()); | 108 scoped_ptr<MockGLES2Decoder> decoder2_(new MockGLES2Decoder()); |
108 TestHelper::SetupContextGroupInitExpectations(gl_.get(), | 109 TestHelper::SetupContextGroupInitExpectations( |
109 DisallowedFeatures(), "", ""); | 110 gl_.get(), DisallowedFeatures(), "", "", kBindGeneratesResource); |
110 group_->Initialize(decoder_.get(), DisallowedFeatures()); | 111 group_->Initialize(decoder_.get(), DisallowedFeatures()); |
111 group_->Initialize(decoder2_.get(), DisallowedFeatures()); | 112 group_->Initialize(decoder2_.get(), DisallowedFeatures()); |
112 | 113 |
113 EXPECT_TRUE(group_->buffer_manager() != NULL); | 114 EXPECT_TRUE(group_->buffer_manager() != NULL); |
114 EXPECT_TRUE(group_->framebuffer_manager() != NULL); | 115 EXPECT_TRUE(group_->framebuffer_manager() != NULL); |
115 EXPECT_TRUE(group_->renderbuffer_manager() != NULL); | 116 EXPECT_TRUE(group_->renderbuffer_manager() != NULL); |
116 EXPECT_TRUE(group_->texture_manager() != NULL); | 117 EXPECT_TRUE(group_->texture_manager() != NULL); |
117 EXPECT_TRUE(group_->program_manager() != NULL); | 118 EXPECT_TRUE(group_->program_manager() != NULL); |
118 EXPECT_TRUE(group_->shader_manager() != NULL); | 119 EXPECT_TRUE(group_->shader_manager() != NULL); |
119 | 120 |
(...skipping 13 matching lines...) Expand all Loading... |
133 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); | 134 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); |
134 EXPECT_TRUE(group_->texture_manager() == NULL); | 135 EXPECT_TRUE(group_->texture_manager() == NULL); |
135 EXPECT_TRUE(group_->program_manager() == NULL); | 136 EXPECT_TRUE(group_->program_manager() == NULL); |
136 EXPECT_TRUE(group_->shader_manager() == NULL); | 137 EXPECT_TRUE(group_->shader_manager() == NULL); |
137 } | 138 } |
138 | 139 |
139 } // namespace gles2 | 140 } // namespace gles2 |
140 } // namespace gpu | 141 } // namespace gpu |
141 | 142 |
142 | 143 |
OLD | NEW |