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 <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 1406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1417 | 1417 |
1418 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMInvalidArgs1_0) { | 1418 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMInvalidArgs1_0) { |
1419 EXPECT_CALL(*mock_decoder_, MarkContextLost(_)) | 1419 EXPECT_CALL(*mock_decoder_, MarkContextLost(_)) |
1420 .Times(0); | 1420 .Times(0); |
1421 cmds::LoseContextCHROMIUM cmd; | 1421 cmds::LoseContextCHROMIUM cmd; |
1422 cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_NONE); | 1422 cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_NONE); |
1423 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1423 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1424 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); | 1424 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
1425 } | 1425 } |
1426 | 1426 |
| 1427 TEST_P(GLES3DecoderTest, TransformFeedbackStates) { |
| 1428 cmds::BeginTransformFeedback begin_cmd; |
| 1429 begin_cmd.Init(GL_POINTS); |
| 1430 cmds::EndTransformFeedback end_cmd; |
| 1431 end_cmd.Init(); |
| 1432 cmds::PauseTransformFeedback pause_cmd; |
| 1433 pause_cmd.Init(); |
| 1434 cmds::ResumeTransformFeedback resume_cmd; |
| 1435 resume_cmd.Init(); |
| 1436 |
| 1437 // Before Begin: Pause, Resume, and End is invalid. |
| 1438 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd)); |
| 1439 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1440 |
| 1441 EXPECT_EQ(error::kNoError, ExecuteCmd(pause_cmd)); |
| 1442 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1443 |
| 1444 EXPECT_EQ(error::kNoError, ExecuteCmd(resume_cmd)); |
| 1445 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1446 |
| 1447 // Begin |
| 1448 EXPECT_CALL(*gl_, BeginTransformFeedback(GL_POINTS)) |
| 1449 .Times(1) |
| 1450 .RetiresOnSaturation(); |
| 1451 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); |
| 1452 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1453 |
| 1454 // Begin again is invalid. |
| 1455 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); |
| 1456 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1457 |
| 1458 // Before Pause: Resume is invalid. |
| 1459 EXPECT_EQ(error::kNoError, ExecuteCmd(resume_cmd)); |
| 1460 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1461 |
| 1462 // Pause |
| 1463 EXPECT_CALL(*gl_, PauseTransformFeedback()) |
| 1464 .Times(1) |
| 1465 .RetiresOnSaturation(); |
| 1466 EXPECT_EQ(error::kNoError, ExecuteCmd(pause_cmd)); |
| 1467 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1468 |
| 1469 // Pause again is invalid. |
| 1470 EXPECT_EQ(error::kNoError, ExecuteCmd(pause_cmd)); |
| 1471 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1472 |
| 1473 // Resume |
| 1474 EXPECT_CALL(*gl_, ResumeTransformFeedback()) |
| 1475 .Times(1) |
| 1476 .RetiresOnSaturation(); |
| 1477 EXPECT_EQ(error::kNoError, ExecuteCmd(resume_cmd)); |
| 1478 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1479 |
| 1480 // End |
| 1481 EXPECT_CALL(*gl_, EndTransformFeedback()) |
| 1482 .Times(1) |
| 1483 .RetiresOnSaturation(); |
| 1484 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd)); |
| 1485 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1486 } |
| 1487 |
1427 class GLES2DecoderDoCommandsTest : public GLES2DecoderTest { | 1488 class GLES2DecoderDoCommandsTest : public GLES2DecoderTest { |
1428 public: | 1489 public: |
1429 GLES2DecoderDoCommandsTest() { | 1490 GLES2DecoderDoCommandsTest() { |
1430 for (int i = 0; i < 3; i++) { | 1491 for (int i = 0; i < 3; i++) { |
1431 cmds_[i].Init(GL_BLEND); | 1492 cmds_[i].Init(GL_BLEND); |
1432 } | 1493 } |
1433 entries_per_cmd_ = ComputeNumEntries(cmds_[0].ComputeSize()); | 1494 entries_per_cmd_ = ComputeNumEntries(cmds_[0].ComputeSize()); |
1434 } | 1495 } |
1435 | 1496 |
1436 void SetExpectationsForNCommands(int num_commands) { | 1497 void SetExpectationsForNCommands(int num_commands) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); | 1607 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); |
1547 | 1608 |
1548 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool()); | 1609 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool()); |
1549 | 1610 |
1550 INSTANTIATE_TEST_CASE_P(Service, | 1611 INSTANTIATE_TEST_CASE_P(Service, |
1551 GLES3DecoderWithESSL3ShaderTest, | 1612 GLES3DecoderWithESSL3ShaderTest, |
1552 ::testing::Bool()); | 1613 ::testing::Bool()); |
1553 | 1614 |
1554 } // namespace gles2 | 1615 } // namespace gles2 |
1555 } // namespace gpu | 1616 } // namespace gpu |
OLD | NEW |