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/common/value_state.h" | 8 #include "gpu/command_buffer/common/value_state.h" |
9 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
10 #include "gpu/command_buffer/service/gpu_service_test.h" | 10 #include "gpu/command_buffer/service/gpu_service_test.h" |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 EXPECT_TRUE(group_->framebuffer_manager() == NULL); | 61 EXPECT_TRUE(group_->framebuffer_manager() == NULL); |
62 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); | 62 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); |
63 EXPECT_TRUE(group_->texture_manager() == NULL); | 63 EXPECT_TRUE(group_->texture_manager() == NULL); |
64 EXPECT_TRUE(group_->program_manager() == NULL); | 64 EXPECT_TRUE(group_->program_manager() == NULL); |
65 EXPECT_TRUE(group_->shader_manager() == NULL); | 65 EXPECT_TRUE(group_->shader_manager() == NULL); |
66 } | 66 } |
67 | 67 |
68 TEST_F(ContextGroupTest, InitializeNoExtensions) { | 68 TEST_F(ContextGroupTest, InitializeNoExtensions) { |
69 TestHelper::SetupContextGroupInitExpectations( | 69 TestHelper::SetupContextGroupInitExpectations( |
70 gl_.get(), DisallowedFeatures(), "", "", kBindGeneratesResource); | 70 gl_.get(), DisallowedFeatures(), "", "", kBindGeneratesResource); |
71 group_->Initialize(decoder_.get(), DisallowedFeatures()); | 71 group_->Initialize( |
| 72 decoder_.get(), ContextGroup::kContextTypeOther, DisallowedFeatures()); |
72 EXPECT_EQ(static_cast<uint32>(TestHelper::kNumVertexAttribs), | 73 EXPECT_EQ(static_cast<uint32>(TestHelper::kNumVertexAttribs), |
73 group_->max_vertex_attribs()); | 74 group_->max_vertex_attribs()); |
74 EXPECT_EQ(static_cast<uint32>(TestHelper::kNumTextureUnits), | 75 EXPECT_EQ(static_cast<uint32>(TestHelper::kNumTextureUnits), |
75 group_->max_texture_units()); | 76 group_->max_texture_units()); |
76 EXPECT_EQ(static_cast<uint32>(TestHelper::kMaxTextureImageUnits), | 77 EXPECT_EQ(static_cast<uint32>(TestHelper::kMaxTextureImageUnits), |
77 group_->max_texture_image_units()); | 78 group_->max_texture_image_units()); |
78 EXPECT_EQ(static_cast<uint32>(TestHelper::kMaxVertexTextureImageUnits), | 79 EXPECT_EQ(static_cast<uint32>(TestHelper::kMaxVertexTextureImageUnits), |
79 group_->max_vertex_texture_image_units()); | 80 group_->max_vertex_texture_image_units()); |
80 EXPECT_EQ(static_cast<uint32>(TestHelper::kMaxFragmentUniformVectors), | 81 EXPECT_EQ(static_cast<uint32>(TestHelper::kMaxFragmentUniformVectors), |
81 group_->max_fragment_uniform_vectors()); | 82 group_->max_fragment_uniform_vectors()); |
(...skipping 14 matching lines...) Expand all Loading... |
96 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); | 97 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); |
97 EXPECT_TRUE(group_->texture_manager() == NULL); | 98 EXPECT_TRUE(group_->texture_manager() == NULL); |
98 EXPECT_TRUE(group_->program_manager() == NULL); | 99 EXPECT_TRUE(group_->program_manager() == NULL); |
99 EXPECT_TRUE(group_->shader_manager() == NULL); | 100 EXPECT_TRUE(group_->shader_manager() == NULL); |
100 } | 101 } |
101 | 102 |
102 TEST_F(ContextGroupTest, MultipleContexts) { | 103 TEST_F(ContextGroupTest, MultipleContexts) { |
103 scoped_ptr<MockGLES2Decoder> decoder2_(new MockGLES2Decoder()); | 104 scoped_ptr<MockGLES2Decoder> decoder2_(new MockGLES2Decoder()); |
104 TestHelper::SetupContextGroupInitExpectations( | 105 TestHelper::SetupContextGroupInitExpectations( |
105 gl_.get(), DisallowedFeatures(), "", "", kBindGeneratesResource); | 106 gl_.get(), DisallowedFeatures(), "", "", kBindGeneratesResource); |
106 group_->Initialize(decoder_.get(), DisallowedFeatures()); | 107 EXPECT_TRUE(group_->Initialize( |
107 group_->Initialize(decoder2_.get(), DisallowedFeatures()); | 108 decoder_.get(), ContextGroup::kContextTypeOther, DisallowedFeatures())); |
| 109 EXPECT_FALSE(group_->Initialize( |
| 110 decoder2_.get(), ContextGroup::kContextTypeWebGL1, DisallowedFeatures())); |
| 111 EXPECT_FALSE(group_->Initialize( |
| 112 decoder2_.get(), ContextGroup::kContextTypeWebGL2, DisallowedFeatures())); |
| 113 EXPECT_FALSE(group_->Initialize( |
| 114 decoder2_.get(), ContextGroup::kContextTypeUndefined, |
| 115 DisallowedFeatures())); |
| 116 EXPECT_TRUE(group_->Initialize( |
| 117 decoder2_.get(), ContextGroup::kContextTypeOther, DisallowedFeatures())); |
108 | 118 |
109 EXPECT_TRUE(group_->buffer_manager() != NULL); | 119 EXPECT_TRUE(group_->buffer_manager() != NULL); |
110 EXPECT_TRUE(group_->framebuffer_manager() != NULL); | 120 EXPECT_TRUE(group_->framebuffer_manager() != NULL); |
111 EXPECT_TRUE(group_->renderbuffer_manager() != NULL); | 121 EXPECT_TRUE(group_->renderbuffer_manager() != NULL); |
112 EXPECT_TRUE(group_->texture_manager() != NULL); | 122 EXPECT_TRUE(group_->texture_manager() != NULL); |
113 EXPECT_TRUE(group_->program_manager() != NULL); | 123 EXPECT_TRUE(group_->program_manager() != NULL); |
114 EXPECT_TRUE(group_->shader_manager() != NULL); | 124 EXPECT_TRUE(group_->shader_manager() != NULL); |
115 | 125 |
116 group_->Destroy(decoder_.get(), false); | 126 group_->Destroy(decoder_.get(), false); |
117 | 127 |
(...skipping 11 matching lines...) Expand all Loading... |
129 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); | 139 EXPECT_TRUE(group_->renderbuffer_manager() == NULL); |
130 EXPECT_TRUE(group_->texture_manager() == NULL); | 140 EXPECT_TRUE(group_->texture_manager() == NULL); |
131 EXPECT_TRUE(group_->program_manager() == NULL); | 141 EXPECT_TRUE(group_->program_manager() == NULL); |
132 EXPECT_TRUE(group_->shader_manager() == NULL); | 142 EXPECT_TRUE(group_->shader_manager() == NULL); |
133 } | 143 } |
134 | 144 |
135 } // namespace gles2 | 145 } // namespace gles2 |
136 } // namespace gpu | 146 } // namespace gpu |
137 | 147 |
138 | 148 |
OLD | NEW |