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

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

Issue 298753004: Fix an early return and the error status in glLoseContextCHROMIUM impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cmd-buffer-missing-early-returns
Patch Set: Created 6 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 (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 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 storage_cmd.Init(kTarget, kLevel, kSizedInternalFormat, kWidth, kHeight); 1250 storage_cmd.Init(kTarget, kLevel, kSizedInternalFormat, kWidth, kHeight);
1251 EXPECT_EQ(error::kNoError, ExecuteCmd(storage_cmd)); 1251 EXPECT_EQ(error::kNoError, ExecuteCmd(storage_cmd));
1252 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 1252 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1253 1253
1254 // This should not invoke CopyTexImage2D. 1254 // This should not invoke CopyTexImage2D.
1255 copy_cmd.Init(kTarget, kLevel, kInternalFormat, 0, 0, kWidth, kHeight); 1255 copy_cmd.Init(kTarget, kLevel, kInternalFormat, 0, 0, kWidth, kHeight);
1256 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_cmd)); 1256 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_cmd));
1257 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); 1257 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
1258 } 1258 }
1259 1259
1260 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMValidArgs) {
1261 EXPECT_CALL(*mock_decoder_, LoseContext(GL_GUILTY_CONTEXT_RESET_ARB))
1262 .Times(1);
1263 cmds::LoseContextCHROMIUM cmd;
1264 cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_GUILTY_CONTEXT_RESET_ARB);
1265 EXPECT_EQ(error::kLostContext, ExecuteCmd(cmd));
1266 EXPECT_EQ(GL_NO_ERROR, GetGLError());
1267 }
1268
1269 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMInvalidArgs0_0) {
1270 EXPECT_CALL(*mock_decoder_, LoseContext(_))
1271 .Times(0);
1272 cmds::LoseContextCHROMIUM cmd;
1273 cmd.Init(GL_NONE, GL_GUILTY_CONTEXT_RESET_ARB);
1274 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1275 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1276 }
1277
1278 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMInvalidArgs1_0) {
1279 EXPECT_CALL(*mock_decoder_, LoseContext(_))
1280 .Times(0);
1281 cmds::LoseContextCHROMIUM cmd;
1282 cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_NONE);
1283 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
1284 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
1285 }
1286
1260 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderTest, ::testing::Bool()); 1287 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderTest, ::testing::Bool());
1261 1288
1262 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderWithShaderTest, ::testing::Bool()); 1289 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderWithShaderTest, ::testing::Bool());
1263 1290
1264 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderManualInitTest, ::testing::Bool()); 1291 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderManualInitTest, ::testing::Bool());
1265 1292
1266 INSTANTIATE_TEST_CASE_P(Service, 1293 INSTANTIATE_TEST_CASE_P(Service,
1267 GLES2DecoderRGBBackbufferTest, 1294 GLES2DecoderRGBBackbufferTest,
1268 ::testing::Bool()); 1295 ::testing::Bool());
1269 1296
1270 } // namespace gles2 1297 } // namespace gles2
1271 } // namespace gpu 1298 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698