Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(527)

Side by Side Diff: gpu/command_buffer/client/gles2_implementation_unittest.cc

Issue 1864723003: Make lost context and error message callbacks on GpuControl go to client (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: errorcallback: gputestexpect Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <GLES2/gl2.h> 9 #include <GLES2/gl2.h>
10 #include <GLES2/gl2ext.h> 10 #include <GLES2/gl2ext.h>
(...skipping 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 InSequence sequence; 484 InSequence sequence;
485 485
486 const bool support_client_side_arrays = true; 486 const bool support_client_side_arrays = true;
487 gl_.reset(new GLES2Implementation(helper_.get(), 487 gl_.reset(new GLES2Implementation(helper_.get(),
488 share_group, 488 share_group,
489 transfer_buffer_.get(), 489 transfer_buffer_.get(),
490 bind_generates_resource_client, 490 bind_generates_resource_client,
491 lose_context_when_out_of_memory, 491 lose_context_when_out_of_memory,
492 support_client_side_arrays, 492 support_client_side_arrays,
493 gpu_control_.get())); 493 gpu_control_.get()));
494 }
494 495
495 if (!gl_->Initialize(kTransferBufferSize, 496 // The client should be set to something non-null.
496 kTransferBufferSize, 497 EXPECT_CALL(*gpu_control_, SetGpuControlClient(gl_.get())).Times(1);
497 kTransferBufferSize, 498
498 GLES2Implementation::kNoLimit)) 499 if (!gl_->Initialize(kTransferBufferSize, kTransferBufferSize,
499 return false; 500 kTransferBufferSize, GLES2Implementation::kNoLimit))
500 } 501 return false;
501 502
502 helper_->CommandBufferHelper::Finish(); 503 helper_->CommandBufferHelper::Finish();
503 ::testing::Mock::VerifyAndClearExpectations(gl_.get()); 504 ::testing::Mock::VerifyAndClearExpectations(gl_.get());
504 505
505 scoped_refptr<Buffer> ring_buffer = helper_->get_ring_buffer(); 506 scoped_refptr<Buffer> ring_buffer = helper_->get_ring_buffer();
506 commands_ = static_cast<CommandBufferEntry*>(ring_buffer->memory()) + 507 commands_ = static_cast<CommandBufferEntry*>(ring_buffer->memory()) +
507 command_buffer()->GetPutOffset(); 508 command_buffer()->GetPutOffset();
508 ClearCommands(); 509 ClearCommands();
509 EXPECT_TRUE(transfer_buffer_->InSync()); 510 EXPECT_TRUE(transfer_buffer_->InSync());
510 511
511 ::testing::Mock::VerifyAndClearExpectations(command_buffer()); 512 ::testing::Mock::VerifyAndClearExpectations(command_buffer());
512 return true; 513 return true;
513 } 514 }
514 515
515 void TearDown() { 516 void TearDown() {
516 Mock::VerifyAndClear(gl_.get()); 517 Mock::VerifyAndClear(gl_.get());
517 EXPECT_CALL(*command_buffer(), OnFlush()).Times(AnyNumber()); 518 EXPECT_CALL(*command_buffer(), OnFlush()).Times(AnyNumber());
518 // For command buffer. 519 // For command buffer.
519 EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_)) 520 EXPECT_CALL(*command_buffer(), DestroyTransferBuffer(_))
520 .Times(AtLeast(1)); 521 .Times(AtLeast(1));
522 // The client should be unset.
523 EXPECT_CALL(*gpu_control_, SetGpuControlClient(nullptr)).Times(1);
521 gl_.reset(); 524 gl_.reset();
522 } 525 }
523 526
524 MockClientCommandBuffer* command_buffer() const { 527 MockClientCommandBuffer* command_buffer() const {
525 return command_buffer_.get(); 528 return command_buffer_.get();
526 } 529 }
527 530
528 int GetNextToken() { return ++token_; } 531 int GetNextToken() { return ++token_; }
529 532
530 void ClearCommands() { 533 void ClearCommands() {
(...skipping 3968 matching lines...) Expand 10 before | Expand all | Expand 10 after
4499 ContextInitOptions init_options; 4502 ContextInitOptions init_options;
4500 init_options.transfer_buffer_initialize_fail = true; 4503 init_options.transfer_buffer_initialize_fail = true;
4501 EXPECT_FALSE(Initialize(init_options)); 4504 EXPECT_FALSE(Initialize(init_options));
4502 } 4505 }
4503 4506
4504 #include "base/macros.h" 4507 #include "base/macros.h"
4505 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h" 4508 #include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
4506 4509
4507 } // namespace gles2 4510 } // namespace gles2
4508 } // namespace gpu 4511 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698