• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 
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"
15 
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;
26 
27 namespace gpu {
28 namespace gles2 {
29 
30 using namespace cmds;
31 
32 class GLES2DecoderTest3 : public GLES2DecoderTestBase {
33  public:
GLES2DecoderTest3()34   GLES2DecoderTest3() { }
35 };
36 
37 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderTest3, ::testing::Bool());
38 
TEST_P(GLES2DecoderTest3,TraceBeginCHROMIUM)39 TEST_P(GLES2DecoderTest3, TraceBeginCHROMIUM) {
40   const uint32 kBucketId = 123;
41   const char kName[] = "test_command";
42   SetBucketAsCString(kBucketId, kName);
43 
44   TraceBeginCHROMIUM begin_cmd;
45   begin_cmd.Init(kBucketId);
46   EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd));
47 }
48 
TEST_P(GLES2DecoderTest3,TraceEndCHROMIUM)49 TEST_P(GLES2DecoderTest3, TraceEndCHROMIUM) {
50   // Test end fails if no begin.
51   TraceEndCHROMIUM end_cmd;
52   end_cmd.Init();
53   EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd));
54   EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
55 
56   const uint32 kBucketId = 123;
57   const char kName[] = "test_command";
58   SetBucketAsCString(kBucketId, kName);
59 
60   TraceBeginCHROMIUM begin_cmd;
61   begin_cmd.Init(kBucketId);
62   EXPECT_EQ(error::kNoError, ExecuteCmd(begin_cmd));
63 
64   end_cmd.Init();
65   EXPECT_EQ(error::kNoError, ExecuteCmd(end_cmd));
66   EXPECT_EQ(GL_NO_ERROR, GetGLError());
67 }
68 
69 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest_3_autogen.h"
70 
71 }  // namespace gles2
72 }  // namespace gpu
73