OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "gpu/command_buffer/service/gpu_service_test.h" |
| 6 #include "gpu/command_buffer/service/test_helper.h" |
| 7 #include "gpu/command_buffer/service/transform_feedback_manager.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gl/gl_mock.h" |
| 10 |
| 11 using ::testing::_; |
| 12 |
| 13 namespace gpu { |
| 14 namespace gles2 { |
| 15 |
| 16 namespace { |
| 17 const GLuint kTransformFeedbackClientId = 76; |
| 18 const GLuint kTransformFeedbackServiceId = 1076; |
| 19 } // anonymous |
| 20 |
| 21 class TransformFeedbackManagerTest : public GpuServiceTest { |
| 22 public: |
| 23 TransformFeedbackManagerTest() { |
| 24 } |
| 25 |
| 26 ~TransformFeedbackManagerTest() override {} |
| 27 |
| 28 protected: |
| 29 void SetUp() override { |
| 30 const GLuint kMaxTransformFeedbackSeparateAttribs = 16; |
| 31 GpuServiceTest::SetUpWithGLVersion("4.1", ""); |
| 32 manager_.reset(new TransformFeedbackManager( |
| 33 kMaxTransformFeedbackSeparateAttribs, true)); |
| 34 } |
| 35 |
| 36 void TearDown() override { |
| 37 manager_.reset(); |
| 38 GpuServiceTest::TearDown(); |
| 39 } |
| 40 |
| 41 std::unique_ptr<TransformFeedbackManager> manager_; |
| 42 }; |
| 43 |
| 44 TEST_F(TransformFeedbackManagerTest, LifeTime) { |
| 45 manager_->CreateTransformFeedback( |
| 46 kTransformFeedbackClientId, kTransformFeedbackServiceId); |
| 47 scoped_refptr<TransformFeedback> transform_feedback = |
| 48 manager_->GetTransformFeedback(kTransformFeedbackClientId); |
| 49 EXPECT_TRUE(transform_feedback.get()); |
| 50 |
| 51 manager_->RemoveTransformFeedback(kTransformFeedbackClientId); |
| 52 EXPECT_FALSE(manager_->GetTransformFeedback(kTransformFeedbackClientId)); |
| 53 |
| 54 EXPECT_CALL(*gl_, DeleteTransformFeedbacks(1, _)) |
| 55 .Times(1) |
| 56 .RetiresOnSaturation(); |
| 57 transform_feedback = nullptr; |
| 58 } |
| 59 |
| 60 } // namespace gles2 |
| 61 } // namespace gpu |
| 62 |
| 63 |
OLD | NEW |