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

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

Issue 12647003: Refactor a bunch of Texture related GPU code (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« 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/string_number_conversions.h" 10 #include "base/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/gl_utils.h" 14 #include "gpu/command_buffer/service/gl_utils.h"
15 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" 15 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
16 #include "gpu/command_buffer/service/program_manager.h" 16 #include "gpu/command_buffer/service/program_manager.h"
17 #include "gpu/command_buffer/service/texture_manager.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 #include "ui/gl/gl_mock.h" 19 #include "ui/gl/gl_mock.h"
19 20
20 using ::testing::_; 21 using ::testing::_;
21 using ::testing::DoAll; 22 using ::testing::DoAll;
22 using ::testing::InSequence; 23 using ::testing::InSequence;
23 using ::testing::MatcherCast; 24 using ::testing::MatcherCast;
24 using ::testing::Pointee; 25 using ::testing::Pointee;
25 using ::testing::Return; 26 using ::testing::Return;
26 using ::testing::SetArrayArgument; 27 using ::testing::SetArrayArgument;
(...skipping 483 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 buffer->target(), size, _, usage)) 511 buffer->target(), size, _, usage))
511 .Times(1) 512 .Times(1)
512 .RetiresOnSaturation(); 513 .RetiresOnSaturation();
513 } 514 }
514 EXPECT_CALL(*decoder, PeekGLError()) 515 EXPECT_CALL(*decoder, PeekGLError())
515 .WillOnce(Return(error)) 516 .WillOnce(Return(error))
516 .RetiresOnSaturation(); 517 .RetiresOnSaturation();
517 manager->DoBufferData(decoder, buffer, size, usage, data); 518 manager->DoBufferData(decoder, buffer, size, usage, data);
518 } 519 }
519 520
521 void TestHelper::SetTexParameterWithExpectations(
522 ::gfx::MockGLInterface* gl, MockGLES2Decoder* decoder,
523 TextureManager* manager, Texture* texture,
524 GLenum pname, GLint value, GLenum error) {
525 if (error == GL_NO_ERROR) {
526 if (pname != GL_TEXTURE_POOL_CHROMIUM) {
527 EXPECT_CALL(*gl, TexParameteri(texture->target(), pname, value))
528 .Times(1)
529 .RetiresOnSaturation();
530 }
531 } else if (error == GL_INVALID_ENUM) {
532 EXPECT_CALL(*decoder, SetGLErrorInvalidEnum(_, value, _))
533 .Times(1)
534 .RetiresOnSaturation();
535 } else {
536 EXPECT_CALL(*decoder, SetGLErrorInvalidParam(error, _, _, _))
537 .Times(1)
538 .RetiresOnSaturation();
539 }
540 manager->SetParameter("", decoder, texture, pname, value);
541 }
542
520 } // namespace gles2 543 } // namespace gles2
521 } // namespace gpu 544 } // namespace gpu
522 545
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