Revert "Reland c91b178b07b0d - Delete dead signin code (SigninGlobalError)"
[chromium-blink-merge.git] / gpu / command_buffer / service / gles2_cmd_decoder_unittest_3.cc
blobb705f6021084a45a04737759e2ae252afd9c3cf5
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;
17 using ::testing::_;
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;
27 namespace gpu {
28 namespace gles2 {
30 using namespace cmds;
32 class GLES2DecoderTest3 : public GLES2DecoderTestBase {
33 public:
34 GLES2DecoderTest3() { }
37 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderTest3, ::testing::Bool());
39 template <>
40 void GLES2DecoderTestBase::SpecializedSetup<cmds::UniformMatrix3fvImmediate, 0>(
41 bool /* valid */) {
42 SetupShaderForUniform(GL_FLOAT_MAT3);
45 template <>
46 void GLES2DecoderTestBase::SpecializedSetup<cmds::UniformMatrix4fvImmediate, 0>(
47 bool /* valid */) {
48 SetupShaderForUniform(GL_FLOAT_MAT4);
52 template <>
53 void GLES2DecoderTestBase::SpecializedSetup<cmds::UseProgram, 0>(
54 bool /* valid */) {
55 // Needs the same setup as LinkProgram.
56 SpecializedSetup<cmds::LinkProgram, 0>(false);
58 EXPECT_CALL(*gl_, LinkProgram(kServiceProgramId))
59 .Times(1)
60 .RetiresOnSaturation();
62 cmds::LinkProgram link_cmd;
63 link_cmd.Init(client_program_id_);
64 EXPECT_EQ(error::kNoError, ExecuteCmd(link_cmd));
67 template <>
68 void GLES2DecoderTestBase::SpecializedSetup<cmds::ValidateProgram, 0>(
69 bool /* valid */) {
70 // Needs the same setup as LinkProgram.
71 SpecializedSetup<cmds::LinkProgram, 0>(false);
73 EXPECT_CALL(*gl_, LinkProgram(kServiceProgramId))
74 .Times(1)
75 .RetiresOnSaturation();
77 cmds::LinkProgram link_cmd;
78 link_cmd.Init(client_program_id_);
79 EXPECT_EQ(error::kNoError, ExecuteCmd(link_cmd));
81 EXPECT_CALL(*gl_,
82 GetProgramiv(kServiceProgramId, GL_INFO_LOG_LENGTH, _))
83 .WillOnce(SetArgumentPointee<2>(0))
84 .RetiresOnSaturation();
87 TEST_P(GLES2DecoderTest3, TraceBeginCHROMIUM) {
88 const uint32 kCategoryBucketId = 123;
89 const uint32 kNameBucketId = 234;
91 const char kCategory[] = "test_category";
92 const char kName[] = "test_command";
93 SetBucketAsCString(kCategoryBucketId, kCategory);
94 SetBucketAsCString(kNameBucketId, kName);
96 TraceBeginCHROMIUM begin_cmd;
97 begin_cmd.Init(kCategoryBucketId, kNameBucketId);
98 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd));
101 TEST_P(GLES2DecoderTest3, TraceEndCHROMIUM) {
102 // Test end fails if no begin.
103 TraceEndCHROMIUM end_cmd;
104 end_cmd.Init();
105 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd));
106 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
108 const uint32 kCategoryBucketId = 123;
109 const uint32 kNameBucketId = 234;
111 const char kCategory[] = "test_category";
112 const char kName[] = "test_command";
113 SetBucketAsCString(kCategoryBucketId, kCategory);
114 SetBucketAsCString(kNameBucketId, kName);
116 TraceBeginCHROMIUM begin_cmd;
117 begin_cmd.Init(kCategoryBucketId, kNameBucketId);
118 EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd));
120 end_cmd.Init();
121 EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd));
122 EXPECT_EQ(GL_NO_ERROR, GetGLError());
125 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h"
127 } // namespace gles2
128 } // namespace gpu