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. 4 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" 8 9 namespace gpu { 10 namespace gles2 { 11 12 class DebugMarkerManagerTest : public testing::Test { 13 protected: 14 virtual void SetUp() { 15 } 16 17 virtual void TearDown() { 18 } 19 20 DebugMarkerManager manager_; 21 }; 22 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. 27 manager_.PopGroup(); 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. 52 manager_.PopGroup(); 53 EXPECT_STREQ(".abc.mark4", manager_.GetMarker().c_str()); 54 manager_.PopGroup(); 55 EXPECT_STREQ(".mark2", manager_.GetMarker().c_str()); 56 manager_.PopGroup(); 57 EXPECT_STREQ(".mark2", manager_.GetMarker().c_str()); 58 } 59 60 } // namespace gles2 61 } // namespace gpu 62 63 64