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

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

Issue 1302233003: Replace gmock's deprecated SetArgumentPointee with SetArgPointee. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2017 Created 3 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 26 matching lines...) Expand all
37 using ::testing::_; 37 using ::testing::_;
38 using ::testing::DoAll; 38 using ::testing::DoAll;
39 using ::testing::InSequence; 39 using ::testing::InSequence;
40 using ::testing::Invoke; 40 using ::testing::Invoke;
41 using ::testing::MatcherCast; 41 using ::testing::MatcherCast;
42 using ::testing::Mock; 42 using ::testing::Mock;
43 using ::testing::Pointee; 43 using ::testing::Pointee;
44 using ::testing::Return; 44 using ::testing::Return;
45 using ::testing::SaveArg; 45 using ::testing::SaveArg;
46 using ::testing::SetArrayArgument; 46 using ::testing::SetArrayArgument;
47 using ::testing::SetArgumentPointee; 47 using ::testing::SetArgPointee;
48 using ::testing::SetArgPointee; 48 using ::testing::SetArgPointee;
49 using ::testing::StrEq; 49 using ::testing::StrEq;
50 using ::testing::StrictMock; 50 using ::testing::StrictMock;
51 51
52 namespace { 52 namespace {
53 class EmulatingRGBImageStub : public gl::GLImageStub { 53 class EmulatingRGBImageStub : public gl::GLImageStub {
54 protected: 54 protected:
55 ~EmulatingRGBImageStub() override {} 55 ~EmulatingRGBImageStub() override {}
56 bool EmulatingRGB() const override { 56 bool EmulatingRGB() const override {
57 return true; 57 return true;
(...skipping 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 GL_LUMINANCE_ALPHA, 760 GL_LUMINANCE_ALPHA,
761 GL_SRGB, 761 GL_SRGB,
762 GL_SRGB_ALPHA, 762 GL_SRGB_ALPHA,
763 }; 763 };
764 GLenum target = GL_TEXTURE_2D; 764 GLenum target = GL_TEXTURE_2D;
765 GLint level = 0; 765 GLint level = 0;
766 GLsizei width = 2; 766 GLsizei width = 2;
767 GLsizei height = 4; 767 GLsizei height = 4;
768 GLint border = 0; 768 GLint border = 0;
769 EXPECT_CALL(*gl_, GenTextures(_, _)) 769 EXPECT_CALL(*gl_, GenTextures(_, _))
770 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) 770 .WillOnce(SetArgPointee<1>(kNewServiceId))
771 .RetiresOnSaturation(); 771 .RetiresOnSaturation();
772 GenHelper<GenTexturesImmediate>(kNewClientId); 772 GenHelper<GenTexturesImmediate>(kNewClientId);
773 773
774 TextureManager* manager = group().texture_manager(); 774 TextureManager* manager = group().texture_manager();
775 775
776 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR)); 776 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR));
777 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_)) 777 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_))
778 .WillRepeatedly(Return(GL_FRAMEBUFFER_COMPLETE)); 778 .WillRepeatedly(Return(GL_FRAMEBUFFER_COMPLETE));
779 for (size_t i = 0; i < arraysize(kUnsizedInternalFormats); ++i) { 779 for (size_t i = 0; i < arraysize(kUnsizedInternalFormats); ++i) {
780 // Copy from main framebuffer to texture, using the unsized internal format. 780 // Copy from main framebuffer to texture, using the unsized internal format.
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 {GL_BGRA_EXT, GL_RGBA8}, 850 {GL_BGRA_EXT, GL_RGBA8},
851 {GL_LUMINANCE, GL_RGB8}, 851 {GL_LUMINANCE, GL_RGB8},
852 {GL_LUMINANCE_ALPHA, GL_RGBA8}, 852 {GL_LUMINANCE_ALPHA, GL_RGBA8},
853 }; 853 };
854 GLenum target = GL_TEXTURE_2D; 854 GLenum target = GL_TEXTURE_2D;
855 GLint level = 0; 855 GLint level = 0;
856 GLsizei width = 2; 856 GLsizei width = 2;
857 GLsizei height = 4; 857 GLsizei height = 4;
858 GLint border = 0; 858 GLint border = 0;
859 EXPECT_CALL(*gl_, GenTextures(_, _)) 859 EXPECT_CALL(*gl_, GenTextures(_, _))
860 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) 860 .WillOnce(SetArgPointee<1>(kNewServiceId))
861 .RetiresOnSaturation(); 861 .RetiresOnSaturation();
862 GenHelper<GenTexturesImmediate>(kNewClientId); 862 GenHelper<GenTexturesImmediate>(kNewClientId);
863 863
864 TextureManager* manager = group().texture_manager(); 864 TextureManager* manager = group().texture_manager();
865 865
866 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR)); 866 EXPECT_CALL(*gl_, GetError()).WillRepeatedly(Return(GL_NO_ERROR));
867 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_)) 867 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_))
868 .WillRepeatedly(Return(GL_FRAMEBUFFER_COMPLETE)); 868 .WillRepeatedly(Return(GL_FRAMEBUFFER_COMPLETE));
869 for (size_t i = 0; i < arraysize(kUnsizedInternalFormats); ++i) { 869 for (size_t i = 0; i < arraysize(kUnsizedInternalFormats); ++i) {
870 // Copy from main framebuffer to texture, using the unsized internal format. 870 // Copy from main framebuffer to texture, using the unsized internal format.
(...skipping 1335 matching lines...) Expand 10 before | Expand all | Expand 10 after
2206 2206
2207 2207
2208 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalBindTexture) { 2208 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalBindTexture) {
2209 InitState init; 2209 InitState init;
2210 init.extensions = "GL_OES_EGL_image_external"; 2210 init.extensions = "GL_OES_EGL_image_external";
2211 init.gl_version = "opengl es 2.0"; 2211 init.gl_version = "opengl es 2.0";
2212 init.bind_generates_resource = true; 2212 init.bind_generates_resource = true;
2213 InitDecoder(init); 2213 InitDecoder(init);
2214 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId)); 2214 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId));
2215 EXPECT_CALL(*gl_, GenTextures(1, _)) 2215 EXPECT_CALL(*gl_, GenTextures(1, _))
2216 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); 2216 .WillOnce(SetArgPointee<1>(kNewServiceId));
2217 BindTexture cmd; 2217 BindTexture cmd;
2218 cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId); 2218 cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId);
2219 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2219 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2220 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2220 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2221 TextureRef* texture_ref = GetTexture(kNewClientId); 2221 TextureRef* texture_ref = GetTexture(kNewClientId);
2222 EXPECT_TRUE(texture_ref != NULL); 2222 EXPECT_TRUE(texture_ref != NULL);
2223 EXPECT_TRUE(texture_ref->texture()->target() == GL_TEXTURE_EXTERNAL_OES); 2223 EXPECT_TRUE(texture_ref->texture()->target() == GL_TEXTURE_EXTERNAL_OES);
2224 } 2224 }
2225 2225
2226 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) { 2226 TEST_P(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) {
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after
2611 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 2611 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
2612 } 2612 }
2613 2613
2614 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) { 2614 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) {
2615 InitState init; 2615 InitState init;
2616 init.extensions = "GL_ARB_texture_rectangle"; 2616 init.extensions = "GL_ARB_texture_rectangle";
2617 init.bind_generates_resource = true; 2617 init.bind_generates_resource = true;
2618 InitDecoder(init); 2618 InitDecoder(init);
2619 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId)); 2619 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId));
2620 EXPECT_CALL(*gl_, GenTextures(1, _)) 2620 EXPECT_CALL(*gl_, GenTextures(1, _))
2621 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); 2621 .WillOnce(SetArgPointee<1>(kNewServiceId));
2622 BindTexture cmd; 2622 BindTexture cmd;
2623 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, kNewClientId); 2623 cmd.Init(GL_TEXTURE_RECTANGLE_ARB, kNewClientId);
2624 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 2624 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
2625 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2625 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2626 Texture* texture = GetTexture(kNewClientId)->texture(); 2626 Texture* texture = GetTexture(kNewClientId)->texture();
2627 EXPECT_TRUE(texture != NULL); 2627 EXPECT_TRUE(texture != NULL);
2628 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB); 2628 EXPECT_TRUE(texture->target() == GL_TEXTURE_RECTANGLE_ARB);
2629 } 2629 }
2630 2630
2631 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) { 2631 TEST_P(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) {
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
3219 EXPECT_EQ(4, height); 3219 EXPECT_EQ(4, height);
3220 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); 3220 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format));
3221 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); 3221 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format);
3222 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); 3222 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
3223 3223
3224 // Service ID has not changed. 3224 // Service ID has not changed.
3225 EXPECT_EQ(kServiceTextureId, texture->service_id()); 3225 EXPECT_EQ(kServiceTextureId, texture->service_id());
3226 3226
3227 // Create new texture for consume. 3227 // Create new texture for consume.
3228 EXPECT_CALL(*gl_, GenTextures(_, _)) 3228 EXPECT_CALL(*gl_, GenTextures(_, _))
3229 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) 3229 .WillOnce(SetArgPointee<1>(kNewServiceId))
3230 .RetiresOnSaturation(); 3230 .RetiresOnSaturation();
3231 DoBindTexture(GL_TEXTURE_2D, kNewClientId, kNewServiceId); 3231 DoBindTexture(GL_TEXTURE_2D, kNewClientId, kNewServiceId);
3232 3232
3233 // Assigns and binds original service size texture ID. 3233 // Assigns and binds original service size texture ID.
3234 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0)) 3234 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, 0))
3235 .Times(1) 3235 .Times(1)
3236 .RetiresOnSaturation(); 3236 .RetiresOnSaturation();
3237 EXPECT_CALL(*gl_, DeleteTextures(1, _)).Times(1).RetiresOnSaturation(); 3237 EXPECT_CALL(*gl_, DeleteTextures(1, _)).Times(1).RetiresOnSaturation();
3238 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) 3238 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId))
3239 .Times(1) 3239 .Times(1)
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
3402 // ProduceTexture should fail it the texture and produce targets don't match. 3402 // ProduceTexture should fail it the texture and produce targets don't match.
3403 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 3403 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
3404 } 3404 }
3405 3405
3406 TEST_P(GLES2DecoderTest, CreateAndConsumeTextureCHROMIUMInvalidMailbox) { 3406 TEST_P(GLES2DecoderTest, CreateAndConsumeTextureCHROMIUMInvalidMailbox) {
3407 // Attempt to consume the mailbox when no texture has been produced with it. 3407 // Attempt to consume the mailbox when no texture has been produced with it.
3408 Mailbox mailbox = Mailbox::Generate(); 3408 Mailbox mailbox = Mailbox::Generate();
3409 GLuint new_texture_id = kNewClientId; 3409 GLuint new_texture_id = kNewClientId;
3410 3410
3411 EXPECT_CALL(*gl_, GenTextures(1, _)) 3411 EXPECT_CALL(*gl_, GenTextures(1, _))
3412 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) 3412 .WillOnce(SetArgPointee<1>(kNewServiceId))
3413 .RetiresOnSaturation(); 3413 .RetiresOnSaturation();
3414 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, _)) 3414 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, _))
3415 .Times(2) 3415 .Times(2)
3416 .RetiresOnSaturation(); 3416 .RetiresOnSaturation();
3417 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) 3417 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0))
3418 .Times(1) 3418 .Times(1)
3419 .RetiresOnSaturation(); 3419 .RetiresOnSaturation();
3420 3420
3421 CreateAndConsumeTextureINTERNALImmediate& consume_cmd = 3421 CreateAndConsumeTextureINTERNALImmediate& consume_cmd =
3422 *GetImmediateAs<CreateAndConsumeTextureINTERNALImmediate>(); 3422 *GetImmediateAs<CreateAndConsumeTextureINTERNALImmediate>();
3423 consume_cmd.Init(GL_TEXTURE_2D, new_texture_id, mailbox.name); 3423 consume_cmd.Init(GL_TEXTURE_2D, new_texture_id, mailbox.name);
(...skipping 25 matching lines...) Expand all
3449 ASSERT_TRUE(texture_ref != NULL); 3449 ASSERT_TRUE(texture_ref != NULL);
3450 3450
3451 ProduceTextureDirectCHROMIUMImmediate& produce_cmd = 3451 ProduceTextureDirectCHROMIUMImmediate& produce_cmd =
3452 *GetImmediateAs<ProduceTextureDirectCHROMIUMImmediate>(); 3452 *GetImmediateAs<ProduceTextureDirectCHROMIUMImmediate>();
3453 produce_cmd.Init(client_texture_id_, GL_TEXTURE_2D, mailbox.name); 3453 produce_cmd.Init(client_texture_id_, GL_TEXTURE_2D, mailbox.name);
3454 EXPECT_EQ(error::kNoError, 3454 EXPECT_EQ(error::kNoError,
3455 ExecuteImmediateCmd(produce_cmd, sizeof(mailbox.name))); 3455 ExecuteImmediateCmd(produce_cmd, sizeof(mailbox.name)));
3456 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 3456 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3457 3457
3458 EXPECT_CALL(*gl_, GenTextures(1, _)) 3458 EXPECT_CALL(*gl_, GenTextures(1, _))
3459 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) 3459 .WillOnce(SetArgPointee<1>(kNewServiceId))
3460 .RetiresOnSaturation(); 3460 .RetiresOnSaturation();
3461 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_CUBE_MAP, _)) 3461 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_CUBE_MAP, _))
3462 .Times(2) 3462 .Times(2)
3463 .RetiresOnSaturation(); 3463 .RetiresOnSaturation();
3464 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)) 3464 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0))
3465 .Times(1) 3465 .Times(1)
3466 .RetiresOnSaturation(); 3466 .RetiresOnSaturation();
3467 3467
3468 // Attempt to consume the mailbox with a different target. 3468 // Attempt to consume the mailbox with a different target.
3469 GLuint new_texture_id = kNewClientId; 3469 GLuint new_texture_id = kNewClientId;
3470 CreateAndConsumeTextureINTERNALImmediate& consume_cmd = 3470 CreateAndConsumeTextureINTERNALImmediate& consume_cmd =
(...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after
4762 cmd.Init(GL_TEXTURE_2D, client_texture_id_); 4762 cmd.Init(GL_TEXTURE_2D, client_texture_id_);
4763 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 4763 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
4764 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 4764 EXPECT_EQ(GL_NO_ERROR, GetGLError());
4765 } 4765 }
4766 4766
4767 TEST_P(GLES2DecoderTest, BindTextureValidArgsNewId) { 4767 TEST_P(GLES2DecoderTest, BindTextureValidArgsNewId) {
4768 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId)) 4768 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId))
4769 .Times(1) 4769 .Times(1)
4770 .RetiresOnSaturation(); 4770 .RetiresOnSaturation();
4771 EXPECT_CALL(*gl_, GenTextures(1, _)) 4771 EXPECT_CALL(*gl_, GenTextures(1, _))
4772 .WillOnce(SetArgumentPointee<1>(kNewServiceId)); 4772 .WillOnce(SetArgPointee<1>(kNewServiceId));
4773 if (!feature_info()->gl_version_info().BehavesLikeGLES() && 4773 if (!feature_info()->gl_version_info().BehavesLikeGLES() &&
4774 feature_info()->gl_version_info().IsAtLeastGL(3, 2)) { 4774 feature_info()->gl_version_info().IsAtLeastGL(3, 2)) {
4775 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, 4775 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D,
4776 GL_DEPTH_TEXTURE_MODE, 4776 GL_DEPTH_TEXTURE_MODE,
4777 GL_RED)) 4777 GL_RED))
4778 .Times(1) 4778 .Times(1)
4779 .RetiresOnSaturation(); 4779 .RetiresOnSaturation();
4780 } 4780 }
4781 BindTexture cmd; 4781 BindTexture cmd;
4782 cmd.Init(GL_TEXTURE_2D, kNewClientId); 4782 cmd.Init(GL_TEXTURE_2D, kNewClientId);
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
4870 // TODO(gman): CompressedTexSubImage2DImmediate 4870 // TODO(gman): CompressedTexSubImage2DImmediate
4871 4871
4872 // TODO(gman): TexImage2D 4872 // TODO(gman): TexImage2D
4873 4873
4874 // TODO(gman): TexImage2DImmediate 4874 // TODO(gman): TexImage2DImmediate
4875 4875
4876 // TODO(gman): TexSubImage2DImmediate 4876 // TODO(gman): TexSubImage2DImmediate
4877 4877
4878 } // namespace gles2 4878 } // namespace gles2
4879 } // namespace gpu 4879 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc ('k') | gpu/command_buffer/service/query_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698