OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/debug/trace_event_unittest.h" | 5 #include "base/debug/trace_event_unittest.h" |
6 | 6 |
7 #include <cstdlib> | 7 #include <cstdlib> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
856 BeginTrace(); | 856 BeginTrace(); |
857 TRACE_EVENT_INSTANT0("c3", "name"); | 857 TRACE_EVENT_INSTANT0("c3", "name"); |
858 TRACE_EVENT_INSTANT0("c4", "name"); | 858 TRACE_EVENT_INSTANT0("c4", "name"); |
859 EndTraceAndFlush(); | 859 EndTraceAndFlush(); |
860 std::vector<std::string> cats; | 860 std::vector<std::string> cats; |
861 TraceLog::GetInstance()->GetKnownCategories(&cats); | 861 TraceLog::GetInstance()->GetKnownCategories(&cats); |
862 EXPECT_TRUE(std::find(cats.begin(), cats.end(), "c1") != cats.end()); | 862 EXPECT_TRUE(std::find(cats.begin(), cats.end(), "c1") != cats.end()); |
863 EXPECT_TRUE(std::find(cats.begin(), cats.end(), "c2") != cats.end()); | 863 EXPECT_TRUE(std::find(cats.begin(), cats.end(), "c2") != cats.end()); |
864 EXPECT_TRUE(std::find(cats.begin(), cats.end(), "c3") != cats.end()); | 864 EXPECT_TRUE(std::find(cats.begin(), cats.end(), "c3") != cats.end()); |
865 EXPECT_TRUE(std::find(cats.begin(), cats.end(), "c4") != cats.end()); | 865 EXPECT_TRUE(std::find(cats.begin(), cats.end(), "c4") != cats.end()); |
866 | 866 // Make sure metadata isn't returned. |
| 867 EXPECT_TRUE(std::find(cats.begin(), cats.end(), "__metadata") == cats.end()); |
867 const std::vector<std::string> empty_categories; | 868 const std::vector<std::string> empty_categories; |
868 std::vector<std::string> included_categories; | 869 std::vector<std::string> included_categories; |
869 std::vector<std::string> excluded_categories; | 870 std::vector<std::string> excluded_categories; |
870 | 871 |
871 // Test that category filtering works. | 872 // Test that category filtering works. |
872 | 873 |
873 // Include nonexistent category -> no events | 874 // Include nonexistent category -> no events |
874 Clear(); | 875 Clear(); |
875 included_categories.clear(); | 876 included_categories.clear(); |
876 included_categories.push_back("not_found823564786"); | 877 included_categories.push_back("not_found823564786"); |
(...skipping 728 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1605 TRACE_EVENT_INSTANT0("all", "after callback removed"); | 1606 TRACE_EVENT_INSTANT0("all", "after callback removed"); |
1606 EXPECT_EQ(2u, collected_events_.size()); | 1607 EXPECT_EQ(2u, collected_events_.size()); |
1607 EXPECT_EQ("event1", collected_events_[0]); | 1608 EXPECT_EQ("event1", collected_events_[0]); |
1608 EXPECT_EQ("event2", collected_events_[1]); | 1609 EXPECT_EQ("event2", collected_events_[1]); |
1609 } | 1610 } |
1610 | 1611 |
1611 // TODO(dsinclair): Continuous Tracing unit test. | 1612 // TODO(dsinclair): Continuous Tracing unit test. |
1612 | 1613 |
1613 } // namespace debug | 1614 } // namespace debug |
1614 } // namespace base | 1615 } // namespace base |
OLD | NEW |