1 // Copyright (c) 2012 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/common/debug_marker_manager.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7 #include "ui/gl/gl_mock.h"
12 class DebugMarkerManagerTest
: public testing::Test
{
14 void SetUp() override
{}
16 void TearDown() override
{}
18 DebugMarkerManager manager_
;
21 TEST_F(DebugMarkerManagerTest
, Basic
) {
22 // Test we can get root
23 EXPECT_STREQ("", manager_
.GetMarker().c_str());
24 // Test it's safe to pop an empty stack.
26 // Test we can still get root.
27 EXPECT_STREQ("", manager_
.GetMarker().c_str());
28 // Test setting a marker.
29 manager_
.SetMarker("mark1");
30 EXPECT_STREQ(".mark1", manager_
.GetMarker().c_str());
31 manager_
.SetMarker("mark2");
32 EXPECT_STREQ(".mark2", manager_
.GetMarker().c_str());
33 // Test pushing a group.
34 manager_
.PushGroup("abc");
35 EXPECT_STREQ(".abc", manager_
.GetMarker().c_str());
36 // Test setting a marker on the group
37 manager_
.SetMarker("mark3");
38 EXPECT_STREQ(".abc.mark3", manager_
.GetMarker().c_str());
39 manager_
.SetMarker("mark4");
40 EXPECT_STREQ(".abc.mark4", manager_
.GetMarker().c_str());
41 // Test pushing a 2nd group.
42 manager_
.PushGroup("def");
43 EXPECT_STREQ(".abc.def", manager_
.GetMarker().c_str());
44 // Test setting a marker on the group
45 manager_
.SetMarker("mark5");
46 EXPECT_STREQ(".abc.def.mark5", manager_
.GetMarker().c_str());
47 manager_
.SetMarker("mark6");
48 EXPECT_STREQ(".abc.def.mark6", manager_
.GetMarker().c_str());
49 // Test poping 2nd group.
51 EXPECT_STREQ(".abc.mark4", manager_
.GetMarker().c_str());
53 EXPECT_STREQ(".mark2", manager_
.GetMarker().c_str());
55 EXPECT_STREQ(".mark2", manager_
.GetMarker().c_str());