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 // Can't check the length as I don't know what other categories may have |
nduca
2013/03/23 01:09:00
thats fine, but skip the first person voice and st
dsinclair
2013/03/25 14:22:57
Done.
| |
867 // been added, so just make sure metadata isn't returned. | |
868 EXPECT_TRUE(std::find(cats.begin(), cats.end(), "__metadata") == cats.end()); | |
867 const std::vector<std::string> empty_categories; | 869 const std::vector<std::string> empty_categories; |
868 std::vector<std::string> included_categories; | 870 std::vector<std::string> included_categories; |
869 std::vector<std::string> excluded_categories; | 871 std::vector<std::string> excluded_categories; |
870 | 872 |
871 // Test that category filtering works. | 873 // Test that category filtering works. |
872 | 874 |
873 // Include nonexistent category -> no events | 875 // Include nonexistent category -> no events |
874 Clear(); | 876 Clear(); |
875 included_categories.clear(); | 877 included_categories.clear(); |
876 included_categories.push_back("not_found823564786"); | 878 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"); | 1607 TRACE_EVENT_INSTANT0("all", "after callback removed"); |
1606 EXPECT_EQ(2u, collected_events_.size()); | 1608 EXPECT_EQ(2u, collected_events_.size()); |
1607 EXPECT_EQ("event1", collected_events_[0]); | 1609 EXPECT_EQ("event1", collected_events_[0]); |
1608 EXPECT_EQ("event2", collected_events_[1]); | 1610 EXPECT_EQ("event2", collected_events_[1]); |
1609 } | 1611 } |
1610 | 1612 |
1611 // TODO(dsinclair): Continuous Tracing unit test. | 1613 // TODO(dsinclair): Continuous Tracing unit test. |
1612 | 1614 |
1613 } // namespace debug | 1615 } // namespace debug |
1614 } // namespace base | 1616 } // namespace base |
OLD | NEW |