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/query_manager.h" | 5 #include "gpu/command_buffer/service/query_manager.h" |
6 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 6 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
7 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 7 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 8 #include "gpu/command_buffer/service/error_state_mock.h" |
8 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 9 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
9 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" | 10 #include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h" |
10 #include "gpu/command_buffer/service/feature_info.h" | 11 #include "gpu/command_buffer/service/feature_info.h" |
11 #include "gpu/command_buffer/service/test_helper.h" | 12 #include "gpu/command_buffer/service/test_helper.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
13 #include "ui/gl/gl_mock.h" | 14 #include "ui/gl/gl_mock.h" |
14 | 15 |
15 using ::testing::_; | 16 using ::testing::_; |
16 using ::testing::InSequence; | 17 using ::testing::InSequence; |
17 using ::testing::Return; | 18 using ::testing::Return; |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
545 ASSERT_TRUE(query != NULL); | 546 ASSERT_TRUE(query != NULL); |
546 | 547 |
547 // Setup shared memory like client would. | 548 // Setup shared memory like client would. |
548 QuerySync* sync = decoder_->GetSharedMemoryAs<QuerySync*>( | 549 QuerySync* sync = decoder_->GetSharedMemoryAs<QuerySync*>( |
549 kSharedMemoryId, kSharedMemoryOffset, sizeof(*sync)); | 550 kSharedMemoryId, kSharedMemoryOffset, sizeof(*sync)); |
550 ASSERT_TRUE(sync != NULL); | 551 ASSERT_TRUE(sync != NULL); |
551 sync->Reset(); | 552 sync->Reset(); |
552 | 553 |
553 EXPECT_TRUE(manager->BeginQuery(query)); | 554 EXPECT_TRUE(manager->BeginQuery(query)); |
554 | 555 |
555 EXPECT_CALL(*decoder_.get(), GetGLError()) | 556 MockErrorState mock_error_state; |
| 557 EXPECT_CALL(*decoder_.get(), GetErrorState()) |
| 558 .WillRepeatedly(Return(&mock_error_state)); |
| 559 EXPECT_CALL(mock_error_state, GetGLError()) |
556 .WillOnce(Return(GL_INVALID_ENUM)) | 560 .WillOnce(Return(GL_INVALID_ENUM)) |
557 .RetiresOnSaturation(); | 561 .RetiresOnSaturation(); |
558 | 562 |
559 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount)); | 563 EXPECT_TRUE(manager->EndQuery(query, kSubmitCount)); |
560 EXPECT_FALSE(query->pending()); | 564 EXPECT_FALSE(query->pending()); |
561 | 565 |
562 EXPECT_EQ(static_cast<GLuint>(GL_INVALID_ENUM), sync->result); | 566 EXPECT_EQ(static_cast<GLuint>(GL_INVALID_ENUM), sync->result); |
563 | 567 |
564 manager->Destroy(false); | 568 manager->Destroy(false); |
565 } | 569 } |
566 | 570 |
567 } // namespace gles2 | 571 } // namespace gles2 |
568 } // namespace gpu | 572 } // namespace gpu |
569 | 573 |
570 | 574 |
OLD | NEW |