OLD | NEW |
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/test/test_simple_task_runner.h" | 7 #include "base/test/test_simple_task_runner.h" |
8 #include "content/common/gpu/gpu_channel.h" | 8 #include "content/common/gpu/gpu_channel.h" |
9 #include "content/common/gpu/gpu_channel_manager.h" | 9 #include "content/common/gpu/gpu_channel_manager.h" |
10 #include "content/common/gpu/gpu_channel_test_common.h" | 10 #include "content/common/gpu/gpu_channel_test_common.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 CreateChannel(kClientId, allow_view_command_buffers, false); | 66 CreateChannel(kClientId, allow_view_command_buffers, false); |
67 ASSERT_TRUE(channel); | 67 ASSERT_TRUE(channel); |
68 | 68 |
69 gfx::GLSurfaceHandle surface_handle; | 69 gfx::GLSurfaceHandle surface_handle; |
70 int32_t kRouteId = 1; | 70 int32_t kRouteId = 1; |
71 GPUCreateCommandBufferConfig init_params; | 71 GPUCreateCommandBufferConfig init_params; |
72 init_params.share_group_id = MSG_ROUTING_NONE; | 72 init_params.share_group_id = MSG_ROUTING_NONE; |
73 init_params.stream_id = 0; | 73 init_params.stream_id = 0; |
74 init_params.stream_priority = GpuStreamPriority::NORMAL; | 74 init_params.stream_priority = GpuStreamPriority::NORMAL; |
75 init_params.attribs = std::vector<int>(); | 75 init_params.attribs = std::vector<int>(); |
76 init_params.active_url = GURL(); | 76 init_params.active_url = std::string(); |
77 init_params.gpu_preference = gfx::PreferIntegratedGpu; | 77 init_params.gpu_preference = gfx::PreferIntegratedGpu; |
78 bool succeeded = false; | 78 bool succeeded = false; |
79 HandleMessage(channel, new GpuChannelMsg_CreateViewCommandBuffer( | 79 HandleMessage(channel, new GpuChannelMsg_CreateViewCommandBuffer( |
80 gfx::GLSurfaceHandle(gfx::kNullPluginWindow, | 80 gfx::GLSurfaceHandle(gfx::kNullPluginWindow, |
81 gfx::NULL_TRANSPORT), | 81 gfx::NULL_TRANSPORT), |
82 init_params, kRouteId, &succeeded)); | 82 init_params, kRouteId, &succeeded)); |
83 EXPECT_TRUE(succeeded); | 83 EXPECT_TRUE(succeeded); |
84 | 84 |
85 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); | 85 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); |
86 ASSERT_TRUE(stub); | 86 ASSERT_TRUE(stub); |
87 } | 87 } |
88 | 88 |
89 TEST_F(GpuChannelTest, CreateViewCommandBufferDisallowed) { | 89 TEST_F(GpuChannelTest, CreateViewCommandBufferDisallowed) { |
90 int32_t kClientId = 1; | 90 int32_t kClientId = 1; |
91 bool allow_view_command_buffers = false; | 91 bool allow_view_command_buffers = false; |
92 GpuChannel* channel = | 92 GpuChannel* channel = |
93 CreateChannel(kClientId, allow_view_command_buffers, false); | 93 CreateChannel(kClientId, allow_view_command_buffers, false); |
94 ASSERT_TRUE(channel); | 94 ASSERT_TRUE(channel); |
95 | 95 |
96 gfx::GLSurfaceHandle surface_handle; | 96 gfx::GLSurfaceHandle surface_handle; |
97 int32_t kRouteId = 1; | 97 int32_t kRouteId = 1; |
98 GPUCreateCommandBufferConfig init_params; | 98 GPUCreateCommandBufferConfig init_params; |
99 init_params.share_group_id = MSG_ROUTING_NONE; | 99 init_params.share_group_id = MSG_ROUTING_NONE; |
100 init_params.stream_id = 0; | 100 init_params.stream_id = 0; |
101 init_params.stream_priority = GpuStreamPriority::NORMAL; | 101 init_params.stream_priority = GpuStreamPriority::NORMAL; |
102 init_params.attribs = std::vector<int>(); | 102 init_params.attribs = std::vector<int>(); |
103 init_params.active_url = GURL(); | 103 init_params.active_url = std::string(); |
104 init_params.gpu_preference = gfx::PreferIntegratedGpu; | 104 init_params.gpu_preference = gfx::PreferIntegratedGpu; |
105 bool succeeded = false; | 105 bool succeeded = false; |
106 HandleMessage(channel, new GpuChannelMsg_CreateViewCommandBuffer( | 106 HandleMessage(channel, new GpuChannelMsg_CreateViewCommandBuffer( |
107 gfx::GLSurfaceHandle(gfx::kNullPluginWindow, | 107 gfx::GLSurfaceHandle(gfx::kNullPluginWindow, |
108 gfx::NULL_TRANSPORT), | 108 gfx::NULL_TRANSPORT), |
109 init_params, kRouteId, &succeeded)); | 109 init_params, kRouteId, &succeeded)); |
110 EXPECT_FALSE(succeeded); | 110 EXPECT_FALSE(succeeded); |
111 | 111 |
112 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); | 112 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); |
113 EXPECT_FALSE(stub); | 113 EXPECT_FALSE(stub); |
114 } | 114 } |
115 | 115 |
116 TEST_F(GpuChannelTest, CreateOffscreenCommandBuffer) { | 116 TEST_F(GpuChannelTest, CreateOffscreenCommandBuffer) { |
117 int32_t kClientId = 1; | 117 int32_t kClientId = 1; |
118 GpuChannel* channel = CreateChannel(kClientId, true, false); | 118 GpuChannel* channel = CreateChannel(kClientId, true, false); |
119 ASSERT_TRUE(channel); | 119 ASSERT_TRUE(channel); |
120 | 120 |
121 gfx::GLSurfaceHandle surface_handle; | 121 gfx::GLSurfaceHandle surface_handle; |
122 int32_t kRouteId = 1; | 122 int32_t kRouteId = 1; |
123 GPUCreateCommandBufferConfig init_params; | 123 GPUCreateCommandBufferConfig init_params; |
124 init_params.share_group_id = MSG_ROUTING_NONE; | 124 init_params.share_group_id = MSG_ROUTING_NONE; |
125 init_params.stream_id = 0; | 125 init_params.stream_id = 0; |
126 init_params.stream_priority = GpuStreamPriority::NORMAL; | 126 init_params.stream_priority = GpuStreamPriority::NORMAL; |
127 init_params.attribs = std::vector<int>(); | 127 init_params.attribs = std::vector<int>(); |
128 init_params.active_url = GURL(); | 128 init_params.active_url = std::string(); |
129 init_params.gpu_preference = gfx::PreferIntegratedGpu; | 129 init_params.gpu_preference = gfx::PreferIntegratedGpu; |
130 bool succeeded = false; | 130 bool succeeded = false; |
131 HandleMessage(channel, | 131 HandleMessage(channel, |
132 new GpuChannelMsg_CreateOffscreenCommandBuffer( | 132 new GpuChannelMsg_CreateOffscreenCommandBuffer( |
133 gfx::Size(1, 1), init_params, kRouteId, &succeeded)); | 133 gfx::Size(1, 1), init_params, kRouteId, &succeeded)); |
134 EXPECT_TRUE(succeeded); | 134 EXPECT_TRUE(succeeded); |
135 | 135 |
136 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); | 136 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); |
137 EXPECT_TRUE(stub); | 137 EXPECT_TRUE(stub); |
138 } | 138 } |
139 | 139 |
140 TEST_F(GpuChannelTest, IncompatibleStreamIds) { | 140 TEST_F(GpuChannelTest, IncompatibleStreamIds) { |
141 int32_t kClientId = 1; | 141 int32_t kClientId = 1; |
142 GpuChannel* channel = CreateChannel(kClientId, true, false); | 142 GpuChannel* channel = CreateChannel(kClientId, true, false); |
143 ASSERT_TRUE(channel); | 143 ASSERT_TRUE(channel); |
144 | 144 |
145 // Create first context. | 145 // Create first context. |
146 int32_t kRouteId1 = 1; | 146 int32_t kRouteId1 = 1; |
147 int32_t kStreamId1 = 1; | 147 int32_t kStreamId1 = 1; |
148 GPUCreateCommandBufferConfig init_params; | 148 GPUCreateCommandBufferConfig init_params; |
149 init_params.share_group_id = MSG_ROUTING_NONE; | 149 init_params.share_group_id = MSG_ROUTING_NONE; |
150 init_params.stream_id = kStreamId1; | 150 init_params.stream_id = kStreamId1; |
151 init_params.stream_priority = GpuStreamPriority::NORMAL; | 151 init_params.stream_priority = GpuStreamPriority::NORMAL; |
152 init_params.attribs = std::vector<int>(); | 152 init_params.attribs = std::vector<int>(); |
153 init_params.active_url = GURL(); | 153 init_params.active_url = std::string(); |
154 init_params.gpu_preference = gfx::PreferIntegratedGpu; | 154 init_params.gpu_preference = gfx::PreferIntegratedGpu; |
155 bool succeeded = false; | 155 bool succeeded = false; |
156 HandleMessage(channel, | 156 HandleMessage(channel, |
157 new GpuChannelMsg_CreateOffscreenCommandBuffer( | 157 new GpuChannelMsg_CreateOffscreenCommandBuffer( |
158 gfx::Size(1, 1), init_params, kRouteId1, &succeeded)); | 158 gfx::Size(1, 1), init_params, kRouteId1, &succeeded)); |
159 EXPECT_TRUE(succeeded); | 159 EXPECT_TRUE(succeeded); |
160 | 160 |
161 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId1); | 161 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId1); |
162 EXPECT_TRUE(stub); | 162 EXPECT_TRUE(stub); |
163 | 163 |
164 // Create second context in same share group but different stream. | 164 // Create second context in same share group but different stream. |
165 int32_t kRouteId2 = 2; | 165 int32_t kRouteId2 = 2; |
166 int32_t kStreamId2 = 2; | 166 int32_t kStreamId2 = 2; |
167 | 167 |
168 init_params.share_group_id = kRouteId1; | 168 init_params.share_group_id = kRouteId1; |
169 init_params.stream_id = kStreamId2; | 169 init_params.stream_id = kStreamId2; |
170 init_params.stream_priority = GpuStreamPriority::NORMAL; | 170 init_params.stream_priority = GpuStreamPriority::NORMAL; |
171 init_params.attribs = std::vector<int>(); | 171 init_params.attribs = std::vector<int>(); |
172 init_params.active_url = GURL(); | 172 init_params.active_url = std::string(); |
173 init_params.gpu_preference = gfx::PreferIntegratedGpu; | 173 init_params.gpu_preference = gfx::PreferIntegratedGpu; |
174 succeeded = false; | 174 succeeded = false; |
175 HandleMessage(channel, | 175 HandleMessage(channel, |
176 new GpuChannelMsg_CreateOffscreenCommandBuffer( | 176 new GpuChannelMsg_CreateOffscreenCommandBuffer( |
177 gfx::Size(1, 1), init_params, kRouteId2, &succeeded)); | 177 gfx::Size(1, 1), init_params, kRouteId2, &succeeded)); |
178 EXPECT_FALSE(succeeded); | 178 EXPECT_FALSE(succeeded); |
179 | 179 |
180 stub = channel->LookupCommandBuffer(kRouteId2); | 180 stub = channel->LookupCommandBuffer(kRouteId2); |
181 EXPECT_FALSE(stub); | 181 EXPECT_FALSE(stub); |
182 } | 182 } |
183 | 183 |
184 TEST_F(GpuChannelTest, IncompatibleStreamPriorities) { | 184 TEST_F(GpuChannelTest, IncompatibleStreamPriorities) { |
185 int32_t kClientId = 1; | 185 int32_t kClientId = 1; |
186 GpuChannel* channel = CreateChannel(kClientId, true, false); | 186 GpuChannel* channel = CreateChannel(kClientId, true, false); |
187 ASSERT_TRUE(channel); | 187 ASSERT_TRUE(channel); |
188 | 188 |
189 // Create first context. | 189 // Create first context. |
190 int32_t kRouteId1 = 1; | 190 int32_t kRouteId1 = 1; |
191 int32_t kStreamId1 = 1; | 191 int32_t kStreamId1 = 1; |
192 GpuStreamPriority kStreamPriority1 = GpuStreamPriority::NORMAL; | 192 GpuStreamPriority kStreamPriority1 = GpuStreamPriority::NORMAL; |
193 GPUCreateCommandBufferConfig init_params; | 193 GPUCreateCommandBufferConfig init_params; |
194 init_params.share_group_id = MSG_ROUTING_NONE; | 194 init_params.share_group_id = MSG_ROUTING_NONE; |
195 init_params.stream_id = kStreamId1; | 195 init_params.stream_id = kStreamId1; |
196 init_params.stream_priority = kStreamPriority1; | 196 init_params.stream_priority = kStreamPriority1; |
197 init_params.attribs = std::vector<int>(); | 197 init_params.attribs = std::vector<int>(); |
198 init_params.active_url = GURL(); | 198 init_params.active_url = std::string(); |
199 init_params.gpu_preference = gfx::PreferIntegratedGpu; | 199 init_params.gpu_preference = gfx::PreferIntegratedGpu; |
200 bool succeeded = false; | 200 bool succeeded = false; |
201 HandleMessage(channel, | 201 HandleMessage(channel, |
202 new GpuChannelMsg_CreateOffscreenCommandBuffer( | 202 new GpuChannelMsg_CreateOffscreenCommandBuffer( |
203 gfx::Size(1, 1), init_params, kRouteId1, &succeeded)); | 203 gfx::Size(1, 1), init_params, kRouteId1, &succeeded)); |
204 EXPECT_TRUE(succeeded); | 204 EXPECT_TRUE(succeeded); |
205 | 205 |
206 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId1); | 206 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId1); |
207 EXPECT_TRUE(stub); | 207 EXPECT_TRUE(stub); |
208 | 208 |
209 // Create second context in same share group but different stream. | 209 // Create second context in same share group but different stream. |
210 int32_t kRouteId2 = 2; | 210 int32_t kRouteId2 = 2; |
211 int32_t kStreamId2 = kStreamId1; | 211 int32_t kStreamId2 = kStreamId1; |
212 GpuStreamPriority kStreamPriority2 = GpuStreamPriority::LOW; | 212 GpuStreamPriority kStreamPriority2 = GpuStreamPriority::LOW; |
213 | 213 |
214 init_params.share_group_id = MSG_ROUTING_NONE; | 214 init_params.share_group_id = MSG_ROUTING_NONE; |
215 init_params.stream_id = kStreamId2; | 215 init_params.stream_id = kStreamId2; |
216 init_params.stream_priority = kStreamPriority2; | 216 init_params.stream_priority = kStreamPriority2; |
217 init_params.attribs = std::vector<int>(); | 217 init_params.attribs = std::vector<int>(); |
218 init_params.active_url = GURL(); | 218 init_params.active_url = std::string(); |
219 init_params.gpu_preference = gfx::PreferIntegratedGpu; | 219 init_params.gpu_preference = gfx::PreferIntegratedGpu; |
220 succeeded = false; | 220 succeeded = false; |
221 HandleMessage(channel, | 221 HandleMessage(channel, |
222 new GpuChannelMsg_CreateOffscreenCommandBuffer( | 222 new GpuChannelMsg_CreateOffscreenCommandBuffer( |
223 gfx::Size(1, 1), init_params, kRouteId2, &succeeded)); | 223 gfx::Size(1, 1), init_params, kRouteId2, &succeeded)); |
224 EXPECT_FALSE(succeeded); | 224 EXPECT_FALSE(succeeded); |
225 | 225 |
226 stub = channel->LookupCommandBuffer(kRouteId2); | 226 stub = channel->LookupCommandBuffer(kRouteId2); |
227 EXPECT_FALSE(stub); | 227 EXPECT_FALSE(stub); |
228 } | 228 } |
229 | 229 |
230 TEST_F(GpuChannelTest, StreamLifetime) { | 230 TEST_F(GpuChannelTest, StreamLifetime) { |
231 int32_t kClientId = 1; | 231 int32_t kClientId = 1; |
232 GpuChannel* channel = CreateChannel(kClientId, true, false); | 232 GpuChannel* channel = CreateChannel(kClientId, true, false); |
233 ASSERT_TRUE(channel); | 233 ASSERT_TRUE(channel); |
234 | 234 |
235 // Create first context. | 235 // Create first context. |
236 int32_t kRouteId1 = 1; | 236 int32_t kRouteId1 = 1; |
237 int32_t kStreamId1 = 1; | 237 int32_t kStreamId1 = 1; |
238 GpuStreamPriority kStreamPriority1 = GpuStreamPriority::NORMAL; | 238 GpuStreamPriority kStreamPriority1 = GpuStreamPriority::NORMAL; |
239 GPUCreateCommandBufferConfig init_params; | 239 GPUCreateCommandBufferConfig init_params; |
240 init_params.share_group_id = MSG_ROUTING_NONE; | 240 init_params.share_group_id = MSG_ROUTING_NONE; |
241 init_params.stream_id = kStreamId1; | 241 init_params.stream_id = kStreamId1; |
242 init_params.stream_priority = kStreamPriority1; | 242 init_params.stream_priority = kStreamPriority1; |
243 init_params.attribs = std::vector<int>(); | 243 init_params.attribs = std::vector<int>(); |
244 init_params.active_url = GURL(); | 244 init_params.active_url = std::string(); |
245 init_params.gpu_preference = gfx::PreferIntegratedGpu; | 245 init_params.gpu_preference = gfx::PreferIntegratedGpu; |
246 bool succeeded = false; | 246 bool succeeded = false; |
247 HandleMessage(channel, | 247 HandleMessage(channel, |
248 new GpuChannelMsg_CreateOffscreenCommandBuffer( | 248 new GpuChannelMsg_CreateOffscreenCommandBuffer( |
249 gfx::Size(1, 1), init_params, kRouteId1, &succeeded)); | 249 gfx::Size(1, 1), init_params, kRouteId1, &succeeded)); |
250 EXPECT_TRUE(succeeded); | 250 EXPECT_TRUE(succeeded); |
251 | 251 |
252 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId1); | 252 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId1); |
253 EXPECT_TRUE(stub); | 253 EXPECT_TRUE(stub); |
254 | 254 |
255 HandleMessage(channel, new GpuChannelMsg_DestroyCommandBuffer(kRouteId1)); | 255 HandleMessage(channel, new GpuChannelMsg_DestroyCommandBuffer(kRouteId1)); |
256 stub = channel->LookupCommandBuffer(kRouteId1); | 256 stub = channel->LookupCommandBuffer(kRouteId1); |
257 EXPECT_FALSE(stub); | 257 EXPECT_FALSE(stub); |
258 | 258 |
259 // Create second context in same share group but different stream. | 259 // Create second context in same share group but different stream. |
260 int32_t kRouteId2 = 2; | 260 int32_t kRouteId2 = 2; |
261 int32_t kStreamId2 = 2; | 261 int32_t kStreamId2 = 2; |
262 GpuStreamPriority kStreamPriority2 = GpuStreamPriority::LOW; | 262 GpuStreamPriority kStreamPriority2 = GpuStreamPriority::LOW; |
263 | 263 |
264 init_params.share_group_id = MSG_ROUTING_NONE; | 264 init_params.share_group_id = MSG_ROUTING_NONE; |
265 init_params.stream_id = kStreamId2; | 265 init_params.stream_id = kStreamId2; |
266 init_params.stream_priority = kStreamPriority2; | 266 init_params.stream_priority = kStreamPriority2; |
267 init_params.attribs = std::vector<int>(); | 267 init_params.attribs = std::vector<int>(); |
268 init_params.active_url = GURL(); | 268 init_params.active_url = std::string(); |
269 init_params.gpu_preference = gfx::PreferIntegratedGpu; | 269 init_params.gpu_preference = gfx::PreferIntegratedGpu; |
270 succeeded = false; | 270 succeeded = false; |
271 HandleMessage(channel, | 271 HandleMessage(channel, |
272 new GpuChannelMsg_CreateOffscreenCommandBuffer( | 272 new GpuChannelMsg_CreateOffscreenCommandBuffer( |
273 gfx::Size(1, 1), init_params, kRouteId2, &succeeded)); | 273 gfx::Size(1, 1), init_params, kRouteId2, &succeeded)); |
274 EXPECT_TRUE(succeeded); | 274 EXPECT_TRUE(succeeded); |
275 | 275 |
276 stub = channel->LookupCommandBuffer(kRouteId2); | 276 stub = channel->LookupCommandBuffer(kRouteId2); |
277 EXPECT_TRUE(stub); | 277 EXPECT_TRUE(stub); |
278 } | 278 } |
279 | 279 |
280 TEST_F(GpuChannelTest, RealTimeStreamsDisallowed) { | 280 TEST_F(GpuChannelTest, RealTimeStreamsDisallowed) { |
281 int32_t kClientId = 1; | 281 int32_t kClientId = 1; |
282 bool allow_real_time_streams = false; | 282 bool allow_real_time_streams = false; |
283 GpuChannel* channel = CreateChannel(kClientId, true, allow_real_time_streams); | 283 GpuChannel* channel = CreateChannel(kClientId, true, allow_real_time_streams); |
284 ASSERT_TRUE(channel); | 284 ASSERT_TRUE(channel); |
285 | 285 |
286 // Create first context. | 286 // Create first context. |
287 int32_t kRouteId = 1; | 287 int32_t kRouteId = 1; |
288 int32_t kStreamId = 1; | 288 int32_t kStreamId = 1; |
289 GpuStreamPriority kStreamPriority = GpuStreamPriority::REAL_TIME; | 289 GpuStreamPriority kStreamPriority = GpuStreamPriority::REAL_TIME; |
290 GPUCreateCommandBufferConfig init_params; | 290 GPUCreateCommandBufferConfig init_params; |
291 init_params.share_group_id = MSG_ROUTING_NONE; | 291 init_params.share_group_id = MSG_ROUTING_NONE; |
292 init_params.stream_id = kStreamId; | 292 init_params.stream_id = kStreamId; |
293 init_params.stream_priority = kStreamPriority; | 293 init_params.stream_priority = kStreamPriority; |
294 init_params.attribs = std::vector<int>(); | 294 init_params.attribs = std::vector<int>(); |
295 init_params.active_url = GURL(); | 295 init_params.active_url = std::string(); |
296 init_params.gpu_preference = gfx::PreferIntegratedGpu; | 296 init_params.gpu_preference = gfx::PreferIntegratedGpu; |
297 bool succeeded = false; | 297 bool succeeded = false; |
298 HandleMessage(channel, | 298 HandleMessage(channel, |
299 new GpuChannelMsg_CreateOffscreenCommandBuffer( | 299 new GpuChannelMsg_CreateOffscreenCommandBuffer( |
300 gfx::Size(1, 1), init_params, kRouteId, &succeeded)); | 300 gfx::Size(1, 1), init_params, kRouteId, &succeeded)); |
301 EXPECT_FALSE(succeeded); | 301 EXPECT_FALSE(succeeded); |
302 | 302 |
303 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); | 303 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); |
304 EXPECT_FALSE(stub); | 304 EXPECT_FALSE(stub); |
305 } | 305 } |
306 | 306 |
307 TEST_F(GpuChannelTest, RealTimeStreamsAllowed) { | 307 TEST_F(GpuChannelTest, RealTimeStreamsAllowed) { |
308 int32_t kClientId = 1; | 308 int32_t kClientId = 1; |
309 bool allow_real_time_streams = true; | 309 bool allow_real_time_streams = true; |
310 GpuChannel* channel = CreateChannel(kClientId, true, allow_real_time_streams); | 310 GpuChannel* channel = CreateChannel(kClientId, true, allow_real_time_streams); |
311 ASSERT_TRUE(channel); | 311 ASSERT_TRUE(channel); |
312 | 312 |
313 // Create first context. | 313 // Create first context. |
314 int32_t kRouteId = 1; | 314 int32_t kRouteId = 1; |
315 int32_t kStreamId = 1; | 315 int32_t kStreamId = 1; |
316 GpuStreamPriority kStreamPriority = GpuStreamPriority::REAL_TIME; | 316 GpuStreamPriority kStreamPriority = GpuStreamPriority::REAL_TIME; |
317 GPUCreateCommandBufferConfig init_params; | 317 GPUCreateCommandBufferConfig init_params; |
318 init_params.share_group_id = MSG_ROUTING_NONE; | 318 init_params.share_group_id = MSG_ROUTING_NONE; |
319 init_params.stream_id = kStreamId; | 319 init_params.stream_id = kStreamId; |
320 init_params.stream_priority = kStreamPriority; | 320 init_params.stream_priority = kStreamPriority; |
321 init_params.attribs = std::vector<int>(); | 321 init_params.attribs = std::vector<int>(); |
322 init_params.active_url = GURL(); | 322 init_params.active_url = std::string(); |
323 init_params.gpu_preference = gfx::PreferIntegratedGpu; | 323 init_params.gpu_preference = gfx::PreferIntegratedGpu; |
324 bool succeeded = false; | 324 bool succeeded = false; |
325 HandleMessage(channel, | 325 HandleMessage(channel, |
326 new GpuChannelMsg_CreateOffscreenCommandBuffer( | 326 new GpuChannelMsg_CreateOffscreenCommandBuffer( |
327 gfx::Size(1, 1), init_params, kRouteId, &succeeded)); | 327 gfx::Size(1, 1), init_params, kRouteId, &succeeded)); |
328 EXPECT_TRUE(succeeded); | 328 EXPECT_TRUE(succeeded); |
329 | 329 |
330 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); | 330 GpuCommandBufferStub* stub = channel->LookupCommandBuffer(kRouteId); |
331 EXPECT_TRUE(stub); | 331 EXPECT_TRUE(stub); |
332 } | 332 } |
333 | 333 |
334 } // namespace content | 334 } // namespace content |
OLD | NEW |