Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(764)

Side by Side Diff: base/debug/trace_event_unittest.cc

Issue 12676007: Skip default categories when getting known categories. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/debug/trace_event_impl.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « base/debug/trace_event_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698