| 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/gles2_cmd_decoder_unittest_base.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" | 
| 6 | 6 | 
| 7 #include <algorithm> | 7 #include <algorithm> | 
| 8 #include <string> | 8 #include <string> | 
| 9 #include <vector> | 9 #include <vector> | 
| 10 | 10 | 
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 335       .WillOnce(SetArgumentPointee<1>(kServiceElementBufferId)) | 335       .WillOnce(SetArgumentPointee<1>(kServiceElementBufferId)) | 
| 336       .RetiresOnSaturation(); | 336       .RetiresOnSaturation(); | 
| 337   GenHelper<cmds::GenBuffersImmediate>(client_element_buffer_id_); | 337   GenHelper<cmds::GenBuffersImmediate>(client_element_buffer_id_); | 
| 338 | 338 | 
| 339   DoCreateProgram(client_program_id_, kServiceProgramId); | 339   DoCreateProgram(client_program_id_, kServiceProgramId); | 
| 340   DoCreateShader(GL_VERTEX_SHADER, client_shader_id_, kServiceShaderId); | 340   DoCreateShader(GL_VERTEX_SHADER, client_shader_id_, kServiceShaderId); | 
| 341 | 341 | 
| 342   EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 342   EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 
| 343 } | 343 } | 
| 344 | 344 | 
| 345 void GLES2DecoderTestBase::TearDown() { | 345 void GLES2DecoderTestBase::ResetDecoder() { | 
|  | 346   if (!decoder_.get()) | 
|  | 347     return; | 
| 346   // All Tests should have read all their GLErrors before getting here. | 348   // All Tests should have read all their GLErrors before getting here. | 
| 347   EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 349   EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 
| 348 | 350 | 
| 349   EXPECT_CALL(*gl_, DeleteBuffersARB(1, _)) | 351   EXPECT_CALL(*gl_, DeleteBuffersARB(1, _)) | 
| 350       .Times(2) | 352       .Times(2) | 
| 351       .RetiresOnSaturation(); | 353       .RetiresOnSaturation(); | 
| 352 | 354 | 
| 353   decoder_->EndDecoding(); | 355   decoder_->EndDecoding(); | 
| 354   decoder_->Destroy(true); | 356   decoder_->Destroy(true); | 
| 355   decoder_.reset(); | 357   decoder_.reset(); | 
| 356   group_->Destroy(mock_decoder_.get(), false); | 358   group_->Destroy(mock_decoder_.get(), false); | 
| 357   engine_.reset(); | 359   engine_.reset(); | 
| 358   ::gfx::MockGLInterface::SetGLInterface(NULL); | 360   ::gfx::MockGLInterface::SetGLInterface(NULL); | 
| 359   gl_.reset(); | 361   gl_.reset(); | 
| 360 } | 362 } | 
| 361 | 363 | 
|  | 364 void GLES2DecoderTestBase::TearDown() { | 
|  | 365   ResetDecoder(); | 
|  | 366 } | 
|  | 367 | 
| 362 void GLES2DecoderTestBase::ExpectEnableDisable(GLenum cap, bool enable) { | 368 void GLES2DecoderTestBase::ExpectEnableDisable(GLenum cap, bool enable) { | 
| 363   if (enable) { | 369   if (enable) { | 
| 364     EXPECT_CALL(*gl_, Enable(cap)) | 370     EXPECT_CALL(*gl_, Enable(cap)) | 
| 365         .Times(1) | 371         .Times(1) | 
| 366         .RetiresOnSaturation(); | 372         .RetiresOnSaturation(); | 
| 367   } else { | 373   } else { | 
| 368     EXPECT_CALL(*gl_, Disable(cap)) | 374     EXPECT_CALL(*gl_, Disable(cap)) | 
| 369         .Times(1) | 375         .Times(1) | 
| 370         .RetiresOnSaturation(); | 376         .RetiresOnSaturation(); | 
| 371   } | 377   } | 
| (...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1411 } | 1417 } | 
| 1412 | 1418 | 
| 1413 void GLES2DecoderTestBase::AddExpectationsForSimulatedAttrib0( | 1419 void GLES2DecoderTestBase::AddExpectationsForSimulatedAttrib0( | 
| 1414     GLsizei num_vertices, GLuint buffer_id) { | 1420     GLsizei num_vertices, GLuint buffer_id) { | 
| 1415   AddExpectationsForSimulatedAttrib0WithError( | 1421   AddExpectationsForSimulatedAttrib0WithError( | 
| 1416       num_vertices, buffer_id, GL_NO_ERROR); | 1422       num_vertices, buffer_id, GL_NO_ERROR); | 
| 1417 } | 1423 } | 
| 1418 | 1424 | 
| 1419 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine:: | 1425 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine:: | 
| 1420 MockCommandBufferEngine() { | 1426 MockCommandBufferEngine() { | 
| 1421   data_.reset(new int8[kSharedBufferSize]); | 1427   shm_.reset(new base::SharedMemory()); | 
|  | 1428   shm_->CreateAndMapAnonymous(kSharedBufferSize); | 
|  | 1429   valid_buffer_.size = kSharedBufferSize; | 
|  | 1430   valid_buffer_.shared_memory = shm_.get(); | 
|  | 1431   valid_buffer_.ptr = shm_->memory(); | 
| 1422   ClearSharedMemory(); | 1432   ClearSharedMemory(); | 
| 1423   valid_buffer_.ptr = data_.get(); |  | 
| 1424   valid_buffer_.size = kSharedBufferSize; |  | 
| 1425 } | 1433 } | 
| 1426 | 1434 | 
| 1427 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine:: | 1435 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine:: | 
| 1428 ~MockCommandBufferEngine() {} | 1436 ~MockCommandBufferEngine() {} | 
| 1429 | 1437 | 
| 1430 gpu::Buffer | 1438 gpu::Buffer | 
| 1431 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine::GetSharedMemoryBuffer( | 1439 GLES2DecoderWithShaderTestBase::MockCommandBufferEngine::GetSharedMemoryBuffer( | 
| 1432     int32 shm_id) { | 1440     int32 shm_id) { | 
| 1433   return shm_id == kSharedMemoryId ? valid_buffer_ : invalid_buffer_; | 1441   return shm_id == kSharedMemoryId ? valid_buffer_ : invalid_buffer_; | 
| 1434 } | 1442 } | 
| (...skipping 25 matching lines...) Expand all  Loading... | 
| 1460   SetupDefaultProgram(); | 1468   SetupDefaultProgram(); | 
| 1461 } | 1469 } | 
| 1462 | 1470 | 
| 1463 // Include the auto-generated part of this file. We split this because it means | 1471 // Include the auto-generated part of this file. We split this because it means | 
| 1464 // we can easily edit the non-auto generated parts right here in this file | 1472 // we can easily edit the non-auto generated parts right here in this file | 
| 1465 // instead of having to edit some template or the code generator. | 1473 // instead of having to edit some template or the code generator. | 
| 1466 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 1474 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_0_autogen.h" | 
| 1467 | 1475 | 
| 1468 }  // namespace gles2 | 1476 }  // namespace gles2 | 
| 1469 }  // namespace gpu | 1477 }  // namespace gpu | 
| OLD | NEW | 
|---|