| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include "gpu/command_buffer/common/gles2_cmd_format.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 8 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 9 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" | |
| 10 #include "gpu/command_buffer/service/cmd_buffer_engine.h" | 11 #include "gpu/command_buffer/service/cmd_buffer_engine.h" |
| 11 #include "gpu/command_buffer/service/context_group.h" | 12 #include "gpu/command_buffer/service/context_group.h" |
| 13 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h" |
| 12 #include "gpu/command_buffer/service/program_manager.h" | 14 #include "gpu/command_buffer/service/program_manager.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 14 #include "ui/gl/gl_mock.h" | 16 #include "ui/gl/gl_mock.h" |
| 15 | 17 |
| 16 using ::gfx::MockGLInterface; | 18 using ::gfx::MockGLInterface; |
| 17 using ::testing::_; | 19 using ::testing::_; |
| 18 using ::testing::DoAll; | 20 using ::testing::DoAll; |
| 19 using ::testing::InSequence; | 21 using ::testing::InSequence; |
| 20 using ::testing::MatcherCast; | 22 using ::testing::MatcherCast; |
| 21 using ::testing::Pointee; | 23 using ::testing::Pointee; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 link_cmd.Init(client_program_id_); | 109 link_cmd.Init(client_program_id_); |
| 108 EXPECT_EQ(error::kNoError, ExecuteCmd(link_cmd)); | 110 EXPECT_EQ(error::kNoError, ExecuteCmd(link_cmd)); |
| 109 | 111 |
| 110 EXPECT_CALL(*gl_, | 112 EXPECT_CALL(*gl_, |
| 111 GetProgramiv(kServiceProgramId, GL_INFO_LOG_LENGTH, _)) | 113 GetProgramiv(kServiceProgramId, GL_INFO_LOG_LENGTH, _)) |
| 112 .WillOnce(SetArgumentPointee<2>(0)) | 114 .WillOnce(SetArgumentPointee<2>(0)) |
| 113 .RetiresOnSaturation(); | 115 .RetiresOnSaturation(); |
| 114 }; | 116 }; |
| 115 | 117 |
| 116 TEST_P(GLES2DecoderTest3, TraceBeginCHROMIUM) { | 118 TEST_P(GLES2DecoderTest3, TraceBeginCHROMIUM) { |
| 117 const uint32 kCategoryBucketId = 123; | 119 const uint32_t kCategoryBucketId = 123; |
| 118 const uint32 kNameBucketId = 234; | 120 const uint32_t kNameBucketId = 234; |
| 119 | 121 |
| 120 const char kCategory[] = "test_category"; | 122 const char kCategory[] = "test_category"; |
| 121 const char kName[] = "test_command"; | 123 const char kName[] = "test_command"; |
| 122 SetBucketAsCString(kCategoryBucketId, kCategory); | 124 SetBucketAsCString(kCategoryBucketId, kCategory); |
| 123 SetBucketAsCString(kNameBucketId, kName); | 125 SetBucketAsCString(kNameBucketId, kName); |
| 124 | 126 |
| 125 TraceBeginCHROMIUM begin_cmd; | 127 TraceBeginCHROMIUM begin_cmd; |
| 126 begin_cmd.Init(kCategoryBucketId, kNameBucketId); | 128 begin_cmd.Init(kCategoryBucketId, kNameBucketId); |
| 127 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); | 129 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); |
| 128 } | 130 } |
| 129 | 131 |
| 130 TEST_P(GLES2DecoderTest3, TraceEndCHROMIUM) { | 132 TEST_P(GLES2DecoderTest3, TraceEndCHROMIUM) { |
| 131 // Test end fails if no begin. | 133 // Test end fails if no begin. |
| 132 TraceEndCHROMIUM end_cmd; | 134 TraceEndCHROMIUM end_cmd; |
| 133 end_cmd.Init(); | 135 end_cmd.Init(); |
| 134 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd)); | 136 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd)); |
| 135 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 137 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 136 | 138 |
| 137 const uint32 kCategoryBucketId = 123; | 139 const uint32_t kCategoryBucketId = 123; |
| 138 const uint32 kNameBucketId = 234; | 140 const uint32_t kNameBucketId = 234; |
| 139 | 141 |
| 140 const char kCategory[] = "test_category"; | 142 const char kCategory[] = "test_category"; |
| 141 const char kName[] = "test_command"; | 143 const char kName[] = "test_command"; |
| 142 SetBucketAsCString(kCategoryBucketId, kCategory); | 144 SetBucketAsCString(kCategoryBucketId, kCategory); |
| 143 SetBucketAsCString(kNameBucketId, kName); | 145 SetBucketAsCString(kNameBucketId, kName); |
| 144 | 146 |
| 145 TraceBeginCHROMIUM begin_cmd; | 147 TraceBeginCHROMIUM begin_cmd; |
| 146 begin_cmd.Init(kCategoryBucketId, kNameBucketId); | 148 begin_cmd.Init(kCategoryBucketId, kNameBucketId); |
| 147 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); | 149 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd)); |
| 148 | 150 |
| 149 end_cmd.Init(); | 151 end_cmd.Init(); |
| 150 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd)); | 152 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd)); |
| 151 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 153 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 152 } | 154 } |
| 153 | 155 |
| 154 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h" | 156 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h" |
| 155 | 157 |
| 156 } // namespace gles2 | 158 } // namespace gles2 |
| 157 } // namespace gpu | 159 } // namespace gpu |
| OLD | NEW |