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
3 // found in the LICENSE file.
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
7 #include "gpu/command_buffer/common/gles2_cmd_format.h"
8 #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/context_group.h"
12 #include "gpu/command_buffer/service/program_manager.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "ui/gl/gl_mock.h"
16 using ::gfx::MockGLInterface
;
18 using ::testing::DoAll
;
19 using ::testing::InSequence
;
20 using ::testing::MatcherCast
;
21 using ::testing::Pointee
;
22 using ::testing::Return
;
23 using ::testing::SetArrayArgument
;
24 using ::testing::SetArgumentPointee
;
25 using ::testing::StrEq
;
32 class GLES2DecoderTest3
: public GLES2DecoderTestBase
{
34 GLES2DecoderTest3() { }
37 INSTANTIATE_TEST_CASE_P(Service
, GLES2DecoderTest3
, ::testing::Bool());
39 TEST_P(GLES2DecoderTest3
, TraceBeginCHROMIUM
) {
40 const uint32 kCategoryBucketId
= 123;
41 const uint32 kNameBucketId
= 234;
43 const char kCategory
[] = "test_category";
44 const char kName
[] = "test_command";
45 SetBucketAsCString(kCategoryBucketId
, kCategory
);
46 SetBucketAsCString(kNameBucketId
, kName
);
48 TraceBeginCHROMIUM begin_cmd
;
49 begin_cmd
.Init(kCategoryBucketId
, kNameBucketId
);
50 EXPECT_EQ(error::kNoError
, ExecuteCmd(begin_cmd
));
53 TEST_P(GLES2DecoderTest3
, TraceEndCHROMIUM
) {
54 // Test end fails if no begin.
55 TraceEndCHROMIUM end_cmd
;
57 EXPECT_EQ(error::kNoError
, ExecuteCmd(end_cmd
));
58 EXPECT_EQ(GL_INVALID_OPERATION
, GetGLError());
60 const uint32 kCategoryBucketId
= 123;
61 const uint32 kNameBucketId
= 234;
63 const char kCategory
[] = "test_category";
64 const char kName
[] = "test_command";
65 SetBucketAsCString(kCategoryBucketId
, kCategory
);
66 SetBucketAsCString(kNameBucketId
, kName
);
68 TraceBeginCHROMIUM begin_cmd
;
69 begin_cmd
.Init(kCategoryBucketId
, kNameBucketId
);
70 EXPECT_EQ(error::kNoError
, ExecuteCmd(begin_cmd
));
73 EXPECT_EQ(error::kNoError
, ExecuteCmd(end_cmd
));
74 EXPECT_EQ(GL_NO_ERROR
, GetGLError());
77 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h"