| 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 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| (...skipping 1107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1118 storage_cmd.Init(kTarget, kLevel, kSizedInternalFormat, kWidth, kHeight); | 1118 storage_cmd.Init(kTarget, kLevel, kSizedInternalFormat, kWidth, kHeight); |
| 1119 EXPECT_EQ(error::kNoError, ExecuteCmd(storage_cmd)); | 1119 EXPECT_EQ(error::kNoError, ExecuteCmd(storage_cmd)); |
| 1120 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1120 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1121 | 1121 |
| 1122 // This should not invoke CopyTexImage2D. | 1122 // This should not invoke CopyTexImage2D. |
| 1123 copy_cmd.Init(kTarget, kLevel, kInternalFormat, 0, 0, kWidth, kHeight); | 1123 copy_cmd.Init(kTarget, kLevel, kInternalFormat, 0, 0, kWidth, kHeight); |
| 1124 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_cmd)); | 1124 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_cmd)); |
| 1125 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1125 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1126 } | 1126 } |
| 1127 | 1127 |
| 1128 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMValidArgs) { | 1128 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMGuilty) { |
| 1129 EXPECT_CALL(*mock_decoder_, LoseContext(GL_GUILTY_CONTEXT_RESET_ARB)) | 1129 EXPECT_CALL(*mock_decoder_, MarkContextLost(error::kInnocent)) |
| 1130 .Times(1); | 1130 .Times(1); |
| 1131 cmds::LoseContextCHROMIUM cmd; | 1131 cmds::LoseContextCHROMIUM cmd; |
| 1132 cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_GUILTY_CONTEXT_RESET_ARB); | 1132 cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_INNOCENT_CONTEXT_RESET_ARB); |
| 1133 EXPECT_EQ(error::kLostContext, ExecuteCmd(cmd)); | 1133 EXPECT_EQ(error::kLostContext, ExecuteCmd(cmd)); |
| 1134 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1134 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1135 EXPECT_TRUE(decoder_->WasContextLost()); |
| 1136 EXPECT_TRUE(decoder_->WasContextLostByRobustnessExtension()); |
| 1137 } |
| 1138 |
| 1139 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMUnkown) { |
| 1140 EXPECT_CALL(*mock_decoder_, MarkContextLost(error::kUnknown)) |
| 1141 .Times(1); |
| 1142 cmds::LoseContextCHROMIUM cmd; |
| 1143 cmd.Init(GL_UNKNOWN_CONTEXT_RESET_ARB, GL_UNKNOWN_CONTEXT_RESET_ARB); |
| 1144 EXPECT_EQ(error::kLostContext, ExecuteCmd(cmd)); |
| 1145 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1146 EXPECT_TRUE(decoder_->WasContextLost()); |
| 1147 EXPECT_TRUE(decoder_->WasContextLostByRobustnessExtension()); |
| 1135 } | 1148 } |
| 1136 | 1149 |
| 1137 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMInvalidArgs0_0) { | 1150 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMInvalidArgs0_0) { |
| 1138 EXPECT_CALL(*mock_decoder_, LoseContext(_)) | 1151 EXPECT_CALL(*mock_decoder_, MarkContextLost(_)) |
| 1139 .Times(0); | 1152 .Times(0); |
| 1140 cmds::LoseContextCHROMIUM cmd; | 1153 cmds::LoseContextCHROMIUM cmd; |
| 1141 cmd.Init(GL_NONE, GL_GUILTY_CONTEXT_RESET_ARB); | 1154 cmd.Init(GL_NONE, GL_GUILTY_CONTEXT_RESET_ARB); |
| 1142 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1155 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1143 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 1156 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 1144 } | 1157 } |
| 1145 | 1158 |
| 1146 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMInvalidArgs1_0) { | 1159 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMInvalidArgs1_0) { |
| 1147 EXPECT_CALL(*mock_decoder_, LoseContext(_)) | 1160 EXPECT_CALL(*mock_decoder_, MarkContextLost(_)) |
| 1148 .Times(0); | 1161 .Times(0); |
| 1149 cmds::LoseContextCHROMIUM cmd; | 1162 cmds::LoseContextCHROMIUM cmd; |
| 1150 cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_NONE); | 1163 cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_NONE); |
| 1151 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1164 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1152 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 1165 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| 1153 } | 1166 } |
| 1154 | 1167 |
| 1155 class GLES2DecoderDoCommandsTest : public GLES2DecoderTest { | 1168 class GLES2DecoderDoCommandsTest : public GLES2DecoderTest { |
| 1156 public: | 1169 public: |
| 1157 GLES2DecoderDoCommandsTest() { | 1170 GLES2DecoderDoCommandsTest() { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderManualInitTest, ::testing::Bool()); | 1270 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderManualInitTest, ::testing::Bool()); |
| 1258 | 1271 |
| 1259 INSTANTIATE_TEST_CASE_P(Service, | 1272 INSTANTIATE_TEST_CASE_P(Service, |
| 1260 GLES2DecoderRGBBackbufferTest, | 1273 GLES2DecoderRGBBackbufferTest, |
| 1261 ::testing::Bool()); | 1274 ::testing::Bool()); |
| 1262 | 1275 |
| 1263 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); | 1276 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); |
| 1264 | 1277 |
| 1265 } // namespace gles2 | 1278 } // namespace gles2 |
| 1266 } // namespace gpu | 1279 } // namespace gpu |
| OLD | NEW |