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 virtual void SetUp() {
17 virtual void TearDown() {
20 DebugMarkerManager manager_
;
23 TEST_F(DebugMarkerManagerTest
, Basic
) {
24 // Test we can get root
25 EXPECT_STREQ("", manager_
.GetMarker().c_str());
26 // Test it's safe to pop an empty stack.
28 // Test we can still get root.
29 EXPECT_STREQ("", manager_
.GetMarker().c_str());
30 // Test setting a marker.
31 manager_
.SetMarker("mark1");
32 EXPECT_STREQ(".mark1", manager_
.GetMarker().c_str());
33 manager_
.SetMarker("mark2");
34 EXPECT_STREQ(".mark2", manager_
.GetMarker().c_str());
35 // Test pushing a group.
36 manager_
.PushGroup("abc");
37 EXPECT_STREQ(".abc", manager_
.GetMarker().c_str());
38 // Test setting a marker on the group
39 manager_
.SetMarker("mark3");
40 EXPECT_STREQ(".abc.mark3", manager_
.GetMarker().c_str());
41 manager_
.SetMarker("mark4");
42 EXPECT_STREQ(".abc.mark4", manager_
.GetMarker().c_str());
43 // Test pushing a 2nd group.
44 manager_
.PushGroup("def");
45 EXPECT_STREQ(".abc.def", manager_
.GetMarker().c_str());
46 // Test setting a marker on the group
47 manager_
.SetMarker("mark5");
48 EXPECT_STREQ(".abc.def.mark5", manager_
.GetMarker().c_str());
49 manager_
.SetMarker("mark6");
50 EXPECT_STREQ(".abc.def.mark6", manager_
.GetMarker().c_str());
51 // Test poping 2nd group.
53 EXPECT_STREQ(".abc.mark4", manager_
.GetMarker().c_str());
55 EXPECT_STREQ(".mark2", manager_
.GetMarker().c_str());
57 EXPECT_STREQ(".mark2", manager_
.GetMarker().c_str());