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 // Tests for GLES2Implementation. | 5 // Tests for GLES2Implementation. |
6 | 6 |
7 #include "gpu/command_buffer/client/gles2_implementation.h" | 7 #include "gpu/command_buffer/client/gles2_implementation.h" |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 static const GLuint kTexturesStartId = 1; | 385 static const GLuint kTexturesStartId = 1; |
386 static const GLuint kQueriesStartId = 1; | 386 static const GLuint kQueriesStartId = 1; |
387 static const GLuint kVertexArraysStartId = 1; | 387 static const GLuint kVertexArraysStartId = 1; |
388 | 388 |
389 typedef MockTransferBuffer::ExpectedMemoryInfo ExpectedMemoryInfo; | 389 typedef MockTransferBuffer::ExpectedMemoryInfo ExpectedMemoryInfo; |
390 | 390 |
391 class TestContext { | 391 class TestContext { |
392 public: | 392 public: |
393 TestContext() : commands_(NULL), token_(0) {} | 393 TestContext() : commands_(NULL), token_(0) {} |
394 | 394 |
| 395 #if defined(OS_CHROMEOS) |
| 396 bool Initialize(ShareGroup* share_group, |
| 397 bool bind_generates_resource, |
| 398 bool lose_context_when_out_of_memory) { |
| 399 #else |
395 void Initialize(ShareGroup* share_group, | 400 void Initialize(ShareGroup* share_group, |
396 bool bind_generates_resource, | 401 bool bind_generates_resource, |
397 bool lose_context_when_out_of_memory) { | 402 bool lose_context_when_out_of_memory) { |
| 403 #endif |
398 command_buffer_.reset(new StrictMock<MockClientCommandBuffer>()); | 404 command_buffer_.reset(new StrictMock<MockClientCommandBuffer>()); |
| 405 #if defined(OS_CHROMEOS) |
| 406 if (!command_buffer_->Initialize()) |
| 407 return false; |
| 408 #else |
399 ASSERT_TRUE(command_buffer_->Initialize()); | 409 ASSERT_TRUE(command_buffer_->Initialize()); |
| 410 #endif |
400 | 411 |
401 transfer_buffer_.reset( | 412 transfer_buffer_.reset( |
402 new MockTransferBuffer(command_buffer_.get(), | 413 new MockTransferBuffer(command_buffer_.get(), |
403 kTransferBufferSize, | 414 kTransferBufferSize, |
404 GLES2Implementation::kStartingOffset, | 415 GLES2Implementation::kStartingOffset, |
405 GLES2Implementation::kAlignment)); | 416 GLES2Implementation::kAlignment)); |
406 | 417 |
407 helper_.reset(new GLES2CmdHelper(command_buffer())); | 418 helper_.reset(new GLES2CmdHelper(command_buffer())); |
408 helper_->Initialize(kCommandBufferSizeBytes); | 419 helper_->Initialize(kCommandBufferSizeBytes); |
409 | 420 |
410 gpu_control_.reset(new StrictMock<MockClientGpuControl>()); | 421 gpu_control_.reset(new StrictMock<MockClientGpuControl>()); |
411 EXPECT_CALL(*gpu_control_, GetCapabilities()) | 422 EXPECT_CALL(*gpu_control_, GetCapabilities()) |
412 .WillOnce(testing::Return(Capabilities())); | 423 .WillOnce(testing::Return(Capabilities())); |
413 | 424 |
414 GLES2Implementation::GLStaticState state; | 425 GLES2Implementation::GLStaticState state; |
415 GLES2Implementation::GLStaticState::IntState& int_state = state.int_state; | 426 GLES2Implementation::GLStaticState::IntState& int_state = state.int_state; |
416 int_state.max_combined_texture_image_units = | 427 int_state.max_combined_texture_image_units = |
417 kMaxCombinedTextureImageUnits; | 428 kMaxCombinedTextureImageUnits; |
418 int_state.max_cube_map_texture_size = kMaxCubeMapTextureSize; | 429 int_state.max_cube_map_texture_size = kMaxCubeMapTextureSize; |
419 int_state.max_fragment_uniform_vectors = kMaxFragmentUniformVectors; | 430 int_state.max_fragment_uniform_vectors = kMaxFragmentUniformVectors; |
420 int_state.max_renderbuffer_size = kMaxRenderbufferSize; | 431 int_state.max_renderbuffer_size = kMaxRenderbufferSize; |
421 int_state.max_texture_image_units = kMaxTextureImageUnits; | 432 int_state.max_texture_image_units = kMaxTextureImageUnits; |
422 int_state.max_texture_size = kMaxTextureSize; | 433 int_state.max_texture_size = kMaxTextureSize; |
423 int_state.max_varying_vectors = kMaxVaryingVectors; | 434 int_state.max_varying_vectors = kMaxVaryingVectors; |
424 int_state.max_vertex_attribs = kMaxVertexAttribs; | 435 int_state.max_vertex_attribs = kMaxVertexAttribs; |
425 int_state.max_vertex_texture_image_units = kMaxVertexTextureImageUnits; | 436 int_state.max_vertex_texture_image_units = kMaxVertexTextureImageUnits; |
426 int_state.max_vertex_uniform_vectors = kMaxVertexUniformVectors; | 437 int_state.max_vertex_uniform_vectors = kMaxVertexUniformVectors; |
427 int_state.num_compressed_texture_formats = kNumCompressedTextureFormats; | 438 int_state.num_compressed_texture_formats = kNumCompressedTextureFormats; |
428 int_state.num_shader_binary_formats = kNumShaderBinaryFormats; | 439 int_state.num_shader_binary_formats = kNumShaderBinaryFormats; |
| 440 #if defined(OS_CHROMEOS) |
| 441 int_state.bind_generates_resource_chromium = |
| 442 bind_generates_resource ? 1 : 0; |
| 443 #endif |
429 | 444 |
430 // This just happens to work for now because IntState has 1 GLint per | 445 // This just happens to work for now because IntState has 1 GLint per |
431 // state. | 446 // state. |
432 // If IntState gets more complicated this code will need to get more | 447 // If IntState gets more complicated this code will need to get more |
433 // complicated. | 448 // complicated. |
434 ExpectedMemoryInfo mem1 = transfer_buffer_->GetExpectedMemory( | 449 ExpectedMemoryInfo mem1 = transfer_buffer_->GetExpectedMemory( |
435 sizeof(GLES2Implementation::GLStaticState::IntState) * 2 + | 450 sizeof(GLES2Implementation::GLStaticState::IntState) * 2 + |
436 sizeof(cmds::GetShaderPrecisionFormat::Result) * 12); | 451 sizeof(cmds::GetShaderPrecisionFormat::Result) * 12); |
437 | 452 |
438 { | 453 { |
439 InSequence sequence; | 454 InSequence sequence; |
440 | 455 |
441 EXPECT_CALL(*command_buffer_, OnFlush()) | 456 EXPECT_CALL(*command_buffer_, OnFlush()) |
442 .WillOnce(SetMemory(mem1.ptr + sizeof(int_state), int_state)) | 457 .WillOnce(SetMemory(mem1.ptr + sizeof(int_state), int_state)) |
443 .RetiresOnSaturation(); | 458 .RetiresOnSaturation(); |
444 GetNextToken(); // eat the token that starting up will use. | 459 GetNextToken(); // eat the token that starting up will use. |
445 | 460 |
446 gl_.reset(new GLES2Implementation(helper_.get(), | 461 gl_.reset(new GLES2Implementation(helper_.get(), |
447 share_group, | 462 share_group, |
448 transfer_buffer_.get(), | 463 transfer_buffer_.get(), |
449 bind_generates_resource, | 464 bind_generates_resource, |
450 lose_context_when_out_of_memory, | 465 lose_context_when_out_of_memory, |
451 gpu_control_.get())); | 466 gpu_control_.get())); |
| 467 #if defined(OS_CHROMEOS) |
| 468 if (!gl_->Initialize(kTransferBufferSize, |
| 469 kTransferBufferSize, |
| 470 kTransferBufferSize, |
| 471 GLES2Implementation::kNoLimit)) |
| 472 return false; |
| 473 #else |
452 ASSERT_TRUE(gl_->Initialize(kTransferBufferSize, | 474 ASSERT_TRUE(gl_->Initialize(kTransferBufferSize, |
453 kTransferBufferSize, | 475 kTransferBufferSize, |
454 kTransferBufferSize, | 476 kTransferBufferSize, |
455 GLES2Implementation::kNoLimit)); | 477 GLES2Implementation::kNoLimit)); |
| 478 #endif |
456 } | 479 } |
457 | 480 |
458 EXPECT_CALL(*command_buffer_, OnFlush()).Times(1).RetiresOnSaturation(); | 481 EXPECT_CALL(*command_buffer_, OnFlush()).Times(1).RetiresOnSaturation(); |
459 helper_->CommandBufferHelper::Finish(); | 482 helper_->CommandBufferHelper::Finish(); |
460 ::testing::Mock::VerifyAndClearExpectations(gl_.get()); | 483 ::testing::Mock::VerifyAndClearExpectations(gl_.get()); |
461 | 484 |
462 scoped_refptr<Buffer> ring_buffer = helper_->get_ring_buffer(); | 485 scoped_refptr<Buffer> ring_buffer = helper_->get_ring_buffer(); |
463 commands_ = static_cast<CommandBufferEntry*>(ring_buffer->memory()) + | 486 commands_ = static_cast<CommandBufferEntry*>(ring_buffer->memory()) + |
464 command_buffer()->GetState().put_offset; | 487 command_buffer()->GetState().put_offset; |
465 ClearCommands(); | 488 ClearCommands(); |
466 EXPECT_TRUE(transfer_buffer_->InSync()); | 489 EXPECT_TRUE(transfer_buffer_->InSync()); |
467 | 490 |
468 ::testing::Mock::VerifyAndClearExpectations(command_buffer()); | 491 ::testing::Mock::VerifyAndClearExpectations(command_buffer()); |
| 492 #if defined(OS_CHROMEOS) |
| 493 return true; |
| 494 #endif |
469 } | 495 } |
470 | 496 |
471 void TearDown() { | 497 void TearDown() { |
472 Mock::VerifyAndClear(gl_.get()); | 498 Mock::VerifyAndClear(gl_.get()); |
473 EXPECT_CALL(*command_buffer(), OnFlush()).Times(AnyNumber()); | 499 EXPECT_CALL(*command_buffer(), OnFlush()).Times(AnyNumber()); |
474 // For command buffer. | 500 // For command buffer. |
475 EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_)) | 501 EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_)) |
476 .Times(AtLeast(1)); | 502 .Times(AtLeast(1)); |
477 gl_.reset(); | 503 gl_.reset(); |
478 } | 504 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 return false; | 537 return false; |
512 } | 538 } |
513 } | 539 } |
514 return true; | 540 return true; |
515 } | 541 } |
516 | 542 |
517 QueryTracker::Query* GetQuery(GLuint id) { | 543 QueryTracker::Query* GetQuery(GLuint id) { |
518 return gl_->query_tracker_->GetQuery(id); | 544 return gl_->query_tracker_->GetQuery(id); |
519 } | 545 } |
520 | 546 |
| 547 #if !defined(OS_CHROMEOS) |
521 void Initialize(bool bind_generates_resource, | 548 void Initialize(bool bind_generates_resource, |
522 bool lose_context_when_out_of_memory) { | 549 bool lose_context_when_out_of_memory) { |
523 share_group_ = new ShareGroup(bind_generates_resource); | 550 share_group_ = new ShareGroup(bind_generates_resource); |
524 | 551 |
525 for (int i = 0; i < kNumTestContexts; i++) | 552 for (int i = 0; i < kNumTestContexts; i++) |
526 test_contexts_[i].Initialize(share_group_.get(), | 553 test_contexts_[i].Initialize(share_group_.get(), |
527 bind_generates_resource, | 554 bind_generates_resource, |
528 lose_context_when_out_of_memory); | 555 lose_context_when_out_of_memory); |
| 556 #else |
| 557 struct ContextInitOptions { |
| 558 ContextInitOptions() |
| 559 : bind_generates_resource_client(true), |
| 560 bind_generates_resource_service(true), |
| 561 lose_context_when_out_of_memory(false) {} |
| 562 |
| 563 bool bind_generates_resource_client; |
| 564 bool bind_generates_resource_service; |
| 565 bool lose_context_when_out_of_memory; |
| 566 }; |
| 567 |
| 568 bool Initialize(const ContextInitOptions& init_options) { |
| 569 bool success = true; |
| 570 share_group_ = new ShareGroup(init_options.bind_generates_resource_service); |
| 571 |
| 572 for (int i = 0; i < kNumTestContexts; i++) { |
| 573 if (!test_contexts_[i].Initialize( |
| 574 share_group_.get(), |
| 575 init_options.bind_generates_resource_client, |
| 576 init_options.lose_context_when_out_of_memory)) |
| 577 success = false; |
| 578 } |
| 579 #endif |
529 | 580 |
530 // Default to test context 0. | 581 // Default to test context 0. |
531 gpu_control_ = test_contexts_[0].gpu_control_.get(); | 582 gpu_control_ = test_contexts_[0].gpu_control_.get(); |
532 helper_ = test_contexts_[0].helper_.get(); | 583 helper_ = test_contexts_[0].helper_.get(); |
533 transfer_buffer_ = test_contexts_[0].transfer_buffer_.get(); | 584 transfer_buffer_ = test_contexts_[0].transfer_buffer_.get(); |
534 gl_ = test_contexts_[0].gl_.get(); | 585 gl_ = test_contexts_[0].gl_.get(); |
535 commands_ = test_contexts_[0].commands_; | 586 commands_ = test_contexts_[0].commands_; |
| 587 #if defined(OS_CHROMEOS) |
| 588 return success; |
| 589 #endif |
536 } | 590 } |
537 | 591 |
538 MockClientCommandBuffer* command_buffer() const { | 592 MockClientCommandBuffer* command_buffer() const { |
539 return test_contexts_[0].command_buffer_.get(); | 593 return test_contexts_[0].command_buffer_.get(); |
540 } | 594 } |
541 | 595 |
542 int GetNextToken() { return test_contexts_[0].GetNextToken(); } | 596 int GetNextToken() { return test_contexts_[0].GetNextToken(); } |
543 | 597 |
544 const void* GetPut() { | 598 const void* GetPut() { |
545 return helper_->GetSpace(0); | 599 return helper_->GetSpace(0); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
585 | 639 |
586 scoped_refptr<ShareGroup> share_group_; | 640 scoped_refptr<ShareGroup> share_group_; |
587 MockClientGpuControl* gpu_control_; | 641 MockClientGpuControl* gpu_control_; |
588 GLES2CmdHelper* helper_; | 642 GLES2CmdHelper* helper_; |
589 MockTransferBuffer* transfer_buffer_; | 643 MockTransferBuffer* transfer_buffer_; |
590 GLES2Implementation* gl_; | 644 GLES2Implementation* gl_; |
591 CommandBufferEntry* commands_; | 645 CommandBufferEntry* commands_; |
592 }; | 646 }; |
593 | 647 |
594 void GLES2ImplementationTest::SetUp() { | 648 void GLES2ImplementationTest::SetUp() { |
| 649 #if defined(OS_CHROMEOS) |
| 650 ContextInitOptions init_options; |
| 651 ASSERT_TRUE(Initialize(init_options)); |
| 652 #else |
595 bool bind_generates_resource = true; | 653 bool bind_generates_resource = true; |
596 bool lose_context_when_out_of_memory = false; | 654 bool lose_context_when_out_of_memory = false; |
597 Initialize(bind_generates_resource, lose_context_when_out_of_memory); | 655 Initialize(bind_generates_resource, lose_context_when_out_of_memory); |
| 656 #endif |
598 } | 657 } |
599 | 658 |
600 void GLES2ImplementationTest::TearDown() { | 659 void GLES2ImplementationTest::TearDown() { |
601 for (int i = 0; i < kNumTestContexts; i++) | 660 for (int i = 0; i < kNumTestContexts; i++) |
602 test_contexts_[i].TearDown(); | 661 test_contexts_[i].TearDown(); |
603 } | 662 } |
604 | 663 |
605 class GLES2ImplementationManualInitTest : public GLES2ImplementationTest { | 664 class GLES2ImplementationManualInitTest : public GLES2ImplementationTest { |
606 protected: | 665 protected: |
607 virtual void SetUp() OVERRIDE {} | 666 virtual void SetUp() OVERRIDE {} |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 EXPECT_NE(id1, id3); | 749 EXPECT_NE(id1, id3); |
691 | 750 |
692 // Lazy release triggered by another Delete. Should reuse id1. | 751 // Lazy release triggered by another Delete. Should reuse id1. |
693 ResApi::Delete(gl1, 1, &id2); | 752 ResApi::Delete(gl1, 1, &id2); |
694 ResApi::Gen(gl2, 1, &id3); | 753 ResApi::Gen(gl2, 1, &id3); |
695 EXPECT_EQ(id1, id3); | 754 EXPECT_EQ(id1, id3); |
696 } | 755 } |
697 }; | 756 }; |
698 | 757 |
699 void GLES2ImplementationStrictSharedTest::SetUp() { | 758 void GLES2ImplementationStrictSharedTest::SetUp() { |
| 759 #if defined(OS_CHROMEOS) |
| 760 ContextInitOptions init_options; |
| 761 init_options.bind_generates_resource_client = false; |
| 762 init_options.bind_generates_resource_service = false; |
| 763 ASSERT_TRUE(Initialize(init_options)); |
| 764 #else |
700 bool bind_generates_resource = false; | 765 bool bind_generates_resource = false; |
701 bool lose_context_when_out_of_memory = false; | 766 bool lose_context_when_out_of_memory = false; |
702 Initialize(bind_generates_resource, lose_context_when_out_of_memory); | 767 Initialize(bind_generates_resource, lose_context_when_out_of_memory); |
| 768 #endif |
703 } | 769 } |
704 | 770 |
705 // GCC requires these declarations, but MSVC requires they not be present | 771 // GCC requires these declarations, but MSVC requires they not be present |
706 #ifndef _MSC_VER | 772 #ifndef _MSC_VER |
707 const uint8 GLES2ImplementationTest::kInitialValue; | 773 const uint8 GLES2ImplementationTest::kInitialValue; |
708 const int32 GLES2ImplementationTest::kNumCommandEntries; | 774 const int32 GLES2ImplementationTest::kNumCommandEntries; |
709 const int32 GLES2ImplementationTest::kCommandBufferSizeBytes; | 775 const int32 GLES2ImplementationTest::kCommandBufferSizeBytes; |
710 const size_t GLES2ImplementationTest::kTransferBufferSize; | 776 const size_t GLES2ImplementationTest::kTransferBufferSize; |
711 const GLint GLES2ImplementationTest::kMaxCombinedTextureImageUnits; | 777 const GLint GLES2ImplementationTest::kMaxCombinedTextureImageUnits; |
712 const GLint GLES2ImplementationTest::kMaxCubeMapTextureSize; | 778 const GLint GLES2ImplementationTest::kMaxCubeMapTextureSize; |
(...skipping 2397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3110 }; | 3176 }; |
3111 | 3177 |
3112 Mailbox mailbox = Mailbox::Generate(); | 3178 Mailbox mailbox = Mailbox::Generate(); |
3113 Cmds expected; | 3179 Cmds expected; |
3114 expected.cmd.Init(GL_TEXTURE_2D, mailbox.name); | 3180 expected.cmd.Init(GL_TEXTURE_2D, mailbox.name); |
3115 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 3181 gl_->ProduceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
3116 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3182 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3117 } | 3183 } |
3118 | 3184 |
3119 TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) { | 3185 TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) { |
| 3186 #if defined(OS_CHROMEOS) |
| 3187 ContextInitOptions init_options; |
| 3188 init_options.lose_context_when_out_of_memory = true; |
| 3189 ASSERT_TRUE(Initialize(init_options)); |
| 3190 #else |
3120 bool bind_generates_resource = false; | 3191 bool bind_generates_resource = false; |
3121 bool lose_context_when_out_of_memory = true; | 3192 bool lose_context_when_out_of_memory = true; |
3122 Initialize(bind_generates_resource, lose_context_when_out_of_memory); | 3193 Initialize(bind_generates_resource, lose_context_when_out_of_memory); |
| 3194 #endif |
3123 | 3195 |
3124 struct Cmds { | 3196 struct Cmds { |
3125 cmds::LoseContextCHROMIUM cmd; | 3197 cmds::LoseContextCHROMIUM cmd; |
3126 }; | 3198 }; |
3127 | 3199 |
3128 GLsizei max = std::numeric_limits<GLsizei>::max(); | 3200 GLsizei max = std::numeric_limits<GLsizei>::max(); |
3129 EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _)) | 3201 EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _)) |
3130 .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL))); | 3202 .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL))); |
3131 gl_->CreateImageCHROMIUM(max, max, 0); | 3203 gl_->CreateImageCHROMIUM(max, max, 0); |
3132 // The context should be lost. | 3204 // The context should be lost. |
3133 Cmds expected; | 3205 Cmds expected; |
3134 expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_UNKNOWN_CONTEXT_RESET_ARB); | 3206 expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_UNKNOWN_CONTEXT_RESET_ARB); |
3135 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); | 3207 EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected))); |
3136 } | 3208 } |
3137 | 3209 |
3138 TEST_F(GLES2ImplementationManualInitTest, NoLoseContextOnOOM) { | 3210 TEST_F(GLES2ImplementationManualInitTest, NoLoseContextOnOOM) { |
| 3211 #if defined(OS_CHROMEOS) |
| 3212 ContextInitOptions init_options; |
| 3213 ASSERT_TRUE(Initialize(init_options)); |
| 3214 #else |
3139 bool bind_generates_resource = false; | 3215 bool bind_generates_resource = false; |
3140 bool lose_context_when_out_of_memory = false; | 3216 bool lose_context_when_out_of_memory = false; |
3141 Initialize(bind_generates_resource, lose_context_when_out_of_memory); | 3217 Initialize(bind_generates_resource, lose_context_when_out_of_memory); |
3142 | 3218 #endif |
3143 struct Cmds { | 3219 struct Cmds { |
3144 cmds::LoseContextCHROMIUM cmd; | 3220 cmds::LoseContextCHROMIUM cmd; |
3145 }; | 3221 }; |
3146 | 3222 |
3147 GLsizei max = std::numeric_limits<GLsizei>::max(); | 3223 GLsizei max = std::numeric_limits<GLsizei>::max(); |
3148 EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _)) | 3224 EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _)) |
3149 .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL))); | 3225 .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL))); |
3150 gl_->CreateImageCHROMIUM(max, max, 0); | 3226 gl_->CreateImageCHROMIUM(max, max, 0); |
3151 // The context should not be lost. | 3227 // The context should not be lost. |
3152 EXPECT_TRUE(NoCommandsWritten()); | 3228 EXPECT_TRUE(NoCommandsWritten()); |
3153 } | 3229 } |
3154 | 3230 |
| 3231 #if defined(OS_CHROMEOS) |
| 3232 TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch1) { |
| 3233 ContextInitOptions init_options; |
| 3234 init_options.bind_generates_resource_client = false; |
| 3235 init_options.bind_generates_resource_service = true; |
| 3236 EXPECT_FALSE(Initialize(init_options)); |
| 3237 } |
| 3238 |
| 3239 TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch2) { |
| 3240 ContextInitOptions init_options; |
| 3241 init_options.bind_generates_resource_client = true; |
| 3242 init_options.bind_generates_resource_service = false; |
| 3243 EXPECT_FALSE(Initialize(init_options)); |
| 3244 } |
| 3245 #endif |
| 3246 |
3155 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" | 3247 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" |
3156 | 3248 |
3157 } // namespace gles2 | 3249 } // namespace gles2 |
3158 } // namespace gpu | 3250 } // namespace gpu |
OLD | NEW |