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 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 5 #ifndef GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 6 #define GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
7 | 7 |
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
10 #include "gpu/command_buffer/service/buffer_manager.h" | 10 #include "gpu/command_buffer/service/buffer_manager.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 const char* gl_version, | 164 const char* gl_version, |
165 bool has_alpha, | 165 bool has_alpha, |
166 bool has_depth, | 166 bool has_depth, |
167 bool has_stencil, | 167 bool has_stencil, |
168 bool request_alpha, | 168 bool request_alpha, |
169 bool request_depth, | 169 bool request_depth, |
170 bool request_stencil, | 170 bool request_stencil, |
171 bool bind_generates_resource, | 171 bool bind_generates_resource, |
172 const CommandLine* command_line); | 172 const CommandLine* command_line); |
173 | 173 |
| 174 void ResetDecoder(); |
| 175 |
174 const ContextGroup& group() const { | 176 const ContextGroup& group() const { |
175 return *group_.get(); | 177 return *group_.get(); |
176 } | 178 } |
177 | 179 |
178 ::testing::StrictMock< ::gfx::MockGLInterface>* GetGLMock() const { | 180 ::testing::StrictMock< ::gfx::MockGLInterface>* GetGLMock() const { |
179 return gl_.get(); | 181 return gl_.get(); |
180 } | 182 } |
181 | 183 |
182 GLES2Decoder* GetDecoder() const { | 184 GLES2Decoder* GetDecoder() const { |
183 return decoder_.get(); | 185 return decoder_.get(); |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 private: | 513 private: |
512 class MockCommandBufferEngine : public CommandBufferEngine { | 514 class MockCommandBufferEngine : public CommandBufferEngine { |
513 public: | 515 public: |
514 MockCommandBufferEngine(); | 516 MockCommandBufferEngine(); |
515 | 517 |
516 virtual ~MockCommandBufferEngine(); | 518 virtual ~MockCommandBufferEngine(); |
517 | 519 |
518 virtual gpu::Buffer GetSharedMemoryBuffer(int32 shm_id) OVERRIDE; | 520 virtual gpu::Buffer GetSharedMemoryBuffer(int32 shm_id) OVERRIDE; |
519 | 521 |
520 void ClearSharedMemory() { | 522 void ClearSharedMemory() { |
521 memset(data_.get(), kInitialMemoryValue, kSharedBufferSize); | 523 memset(shm_->memory(), kInitialMemoryValue, kSharedBufferSize); |
522 } | 524 } |
523 | 525 |
524 virtual void set_token(int32 token) OVERRIDE; | 526 virtual void set_token(int32 token) OVERRIDE; |
525 | 527 |
526 virtual bool SetGetBuffer(int32 /* transfer_buffer_id */) OVERRIDE; | 528 virtual bool SetGetBuffer(int32 /* transfer_buffer_id */) OVERRIDE; |
527 | 529 |
528 // Overridden from CommandBufferEngine. | 530 // Overridden from CommandBufferEngine. |
529 virtual bool SetGetOffset(int32 offset) OVERRIDE; | 531 virtual bool SetGetOffset(int32 offset) OVERRIDE; |
530 | 532 |
531 // Overridden from CommandBufferEngine. | 533 // Overridden from CommandBufferEngine. |
532 virtual int32 GetGetOffset() OVERRIDE; | 534 virtual int32 GetGetOffset() OVERRIDE; |
533 | 535 |
534 private: | 536 private: |
535 scoped_ptr<int8[]> data_; | 537 scoped_ptr<base::SharedMemory> shm_; |
536 gpu::Buffer valid_buffer_; | 538 gpu::Buffer valid_buffer_; |
537 gpu::Buffer invalid_buffer_; | 539 gpu::Buffer invalid_buffer_; |
538 }; | 540 }; |
539 | 541 |
540 void AddExpectationsForVertexAttribManager(); | 542 void AddExpectationsForVertexAttribManager(); |
541 | 543 |
542 scoped_ptr< ::testing::StrictMock<MockCommandBufferEngine> > engine_; | 544 scoped_ptr< ::testing::StrictMock<MockCommandBufferEngine> > engine_; |
543 scoped_refptr<ContextGroup> group_; | 545 scoped_refptr<ContextGroup> group_; |
544 }; | 546 }; |
545 | 547 |
546 class GLES2DecoderWithShaderTestBase : public GLES2DecoderTestBase { | 548 class GLES2DecoderWithShaderTestBase : public GLES2DecoderTestBase { |
547 public: | 549 public: |
548 GLES2DecoderWithShaderTestBase() | 550 GLES2DecoderWithShaderTestBase() |
549 : GLES2DecoderTestBase() { | 551 : GLES2DecoderTestBase() { |
550 } | 552 } |
551 | 553 |
552 protected: | 554 protected: |
553 virtual void SetUp() OVERRIDE; | 555 virtual void SetUp() OVERRIDE; |
554 virtual void TearDown() OVERRIDE; | 556 virtual void TearDown() OVERRIDE; |
555 | 557 |
556 }; | 558 }; |
557 | 559 |
558 } // namespace gles2 | 560 } // namespace gles2 |
559 } // namespace gpu | 561 } // namespace gpu |
560 | 562 |
561 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ | 563 #endif // GPU_COMMAND_BUFFER_SERVICE_GLES2_CMD_DECODER_UNITTEST_BASE_H_ |
OLD | NEW |