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

Side by Side Diff: gpu/command_buffer/service/test_helper.cc

Issue 14308014: Clean up of GLES2 Command Decoder by moving some of the error state into a separate class. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix merge error. Created 7 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
« no previous file with comments | « gpu/command_buffer/service/test_helper.h ('k') | gpu/command_buffer/service/texture_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #include "gpu/command_buffer/service/test_helper.h" 5 #include "gpu/command_buffer/service/test_helper.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_tokenizer.h" 11 #include "base/strings/string_tokenizer.h"
12 #include "gpu/command_buffer/common/types.h" 12 #include "gpu/command_buffer/common/types.h"
13 #include "gpu/command_buffer/service/buffer_manager.h" 13 #include "gpu/command_buffer/service/buffer_manager.h"
14 #include "gpu/command_buffer/service/error_state_mock.h"
14 #include "gpu/command_buffer/service/gl_utils.h" 15 #include "gpu/command_buffer/service/gl_utils.h"
15 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
16 #include "gpu/command_buffer/service/gpu_switches.h" 16 #include "gpu/command_buffer/service/gpu_switches.h"
17 #include "gpu/command_buffer/service/program_manager.h" 17 #include "gpu/command_buffer/service/program_manager.h"
18 #include "gpu/command_buffer/service/texture_manager.h" 18 #include "gpu/command_buffer/service/texture_manager.h"
19 #include "testing/gtest/include/gtest/gtest.h" 19 #include "testing/gtest/include/gtest/gtest.h"
20 #include "ui/gl/gl_mock.h" 20 #include "ui/gl/gl_mock.h"
21 21
22 using ::testing::_; 22 using ::testing::_;
23 using ::testing::DoAll; 23 using ::testing::DoAll;
24 using ::testing::InSequence; 24 using ::testing::InSequence;
25 using ::testing::MatcherCast; 25 using ::testing::MatcherCast;
(...skipping 465 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 EXPECT_CALL(*gl, 491 EXPECT_CALL(*gl,
492 LinkProgram(service_id)) 492 LinkProgram(service_id))
493 .Times(1) 493 .Times(1)
494 .RetiresOnSaturation(); 494 .RetiresOnSaturation();
495 495
496 SetupProgramSuccessExpectations( 496 SetupProgramSuccessExpectations(
497 gl, attribs, num_attribs, uniforms, num_uniforms, service_id); 497 gl, attribs, num_attribs, uniforms, num_uniforms, service_id);
498 } 498 }
499 499
500 void TestHelper::DoBufferData( 500 void TestHelper::DoBufferData(
501 ::gfx::MockGLInterface* gl, MockGLES2Decoder* decoder, 501 ::gfx::MockGLInterface* gl, MockErrorState* error_state,
502 BufferManager* manager, Buffer* buffer, GLsizeiptr size, GLenum usage, 502 BufferManager* manager, Buffer* buffer, GLsizeiptr size, GLenum usage,
503 const GLvoid* data, GLenum error) { 503 const GLvoid* data, GLenum error) {
504 EXPECT_CALL(*decoder, CopyRealGLErrorsToWrapper(_, _, _)) 504 EXPECT_CALL(*error_state, CopyRealGLErrorsToWrapper(_, _, _))
505 .Times(1) 505 .Times(1)
506 .RetiresOnSaturation(); 506 .RetiresOnSaturation();
507 if (manager->IsUsageClientSideArray(usage)) { 507 if (manager->IsUsageClientSideArray(usage)) {
508 EXPECT_CALL(*gl, BufferData( 508 EXPECT_CALL(*gl, BufferData(
509 buffer->target(), 0, _, usage)) 509 buffer->target(), 0, _, usage))
510 .Times(1) 510 .Times(1)
511 .RetiresOnSaturation(); 511 .RetiresOnSaturation();
512 } else { 512 } else {
513 EXPECT_CALL(*gl, BufferData( 513 EXPECT_CALL(*gl, BufferData(
514 buffer->target(), size, _, usage)) 514 buffer->target(), size, _, usage))
515 .Times(1) 515 .Times(1)
516 .RetiresOnSaturation(); 516 .RetiresOnSaturation();
517 } 517 }
518 EXPECT_CALL(*decoder, PeekGLError(_, _, _)) 518 EXPECT_CALL(*error_state, PeekGLError(_, _, _))
519 .WillOnce(Return(error)) 519 .WillOnce(Return(error))
520 .RetiresOnSaturation(); 520 .RetiresOnSaturation();
521 manager->DoBufferData(decoder, buffer, size, usage, data); 521 manager->DoBufferData(error_state, buffer, size, usage, data);
522 } 522 }
523 523
524 void TestHelper::SetTexParameterWithExpectations( 524 void TestHelper::SetTexParameterWithExpectations(
525 ::gfx::MockGLInterface* gl, MockGLES2Decoder* decoder, 525 ::gfx::MockGLInterface* gl, MockErrorState* error_state,
526 TextureManager* manager, Texture* texture, 526 TextureManager* manager, Texture* texture,
527 GLenum pname, GLint value, GLenum error) { 527 GLenum pname, GLint value, GLenum error) {
528 if (error == GL_NO_ERROR) { 528 if (error == GL_NO_ERROR) {
529 if (pname != GL_TEXTURE_POOL_CHROMIUM) { 529 if (pname != GL_TEXTURE_POOL_CHROMIUM) {
530 EXPECT_CALL(*gl, TexParameteri(texture->target(), pname, value)) 530 EXPECT_CALL(*gl, TexParameteri(texture->target(), pname, value))
531 .Times(1) 531 .Times(1)
532 .RetiresOnSaturation(); 532 .RetiresOnSaturation();
533 } 533 }
534 } else if (error == GL_INVALID_ENUM) { 534 } else if (error == GL_INVALID_ENUM) {
535 EXPECT_CALL(*decoder, SetGLErrorInvalidEnum(_, _, _, value, _)) 535 EXPECT_CALL(*error_state, SetGLErrorInvalidEnum(_, _, _, value, _))
536 .Times(1) 536 .Times(1)
537 .RetiresOnSaturation(); 537 .RetiresOnSaturation();
538 } else { 538 } else {
539 EXPECT_CALL(*decoder, SetGLErrorInvalidParam(_, _, error, _, _, _)) 539 EXPECT_CALL(*error_state, SetGLErrorInvalidParam(_, _, error, _, _, _))
540 .Times(1) 540 .Times(1)
541 .RetiresOnSaturation(); 541 .RetiresOnSaturation();
542 } 542 }
543 manager->SetParameter("", decoder, texture, pname, value); 543 manager->SetParameter("", error_state, texture, pname, value);
544 } 544 }
545 545
546 ScopedGLImplementationSetter::ScopedGLImplementationSetter( 546 ScopedGLImplementationSetter::ScopedGLImplementationSetter(
547 gfx::GLImplementation implementation) 547 gfx::GLImplementation implementation)
548 : old_implementation_(gfx::GetGLImplementation()) { 548 : old_implementation_(gfx::GetGLImplementation()) {
549 gfx::SetGLImplementation(implementation); 549 gfx::SetGLImplementation(implementation);
550 } 550 }
551 551
552 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() { 552 ScopedGLImplementationSetter::~ScopedGLImplementationSetter() {
553 gfx::SetGLImplementation(old_implementation_); 553 gfx::SetGLImplementation(old_implementation_);
554 } 554 }
555 555
556 } // namespace gles2 556 } // namespace gles2
557 } // namespace gpu 557 } // namespace gpu
558 558
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/test_helper.h ('k') | gpu/command_buffer/service/texture_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698