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

Side by Side Diff: base/trace_event/trace_config_unittest.cc

Issue 2549103003: tracing: split trace event filter classes out of TraceLog (Closed)
Patch Set: Add BASE_EXPORT Created 4 years 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/trace_event/trace_config.cc ('k') | base/trace_event/trace_event_filter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/json/json_writer.h" 8 #include "base/json/json_writer.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/trace_event/memory_dump_manager.h" 10 #include "base/trace_event/memory_dump_manager.h"
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 EXPECT_EQ(1u, event_filter.included_categories().size()); 425 EXPECT_EQ(1u, event_filter.included_categories().size());
426 EXPECT_STREQ("*", event_filter.included_categories()[0].c_str()); 426 EXPECT_STREQ("*", event_filter.included_categories()[0].c_str());
427 EXPECT_EQ(1u, event_filter.excluded_categories().size()); 427 EXPECT_EQ(1u, event_filter.excluded_categories().size());
428 EXPECT_STREQ("unfiltered_cat", event_filter.excluded_categories()[0].c_str()); 428 EXPECT_STREQ("unfiltered_cat", event_filter.excluded_categories()[0].c_str());
429 EXPECT_TRUE(event_filter.filter_args()); 429 EXPECT_TRUE(event_filter.filter_args());
430 430
431 std::string json_out; 431 std::string json_out;
432 base::JSONWriter::Write(*event_filter.filter_args(), &json_out); 432 base::JSONWriter::Write(*event_filter.filter_args(), &json_out);
433 EXPECT_STREQ(json_out.c_str(), 433 EXPECT_STREQ(json_out.c_str(),
434 "{\"event_name_whitelist\":[\"a snake\",\"a dog\"]}"); 434 "{\"event_name_whitelist\":[\"a snake\",\"a dog\"]}");
435 std::unordered_set<std::string> filter_values;
436 EXPECT_TRUE(event_filter.GetArgAsSet("event_name_whitelist", &filter_values));
437 EXPECT_EQ(2u, filter_values.size());
438 EXPECT_EQ(1u, filter_values.count("a snake"));
439 EXPECT_EQ(1u, filter_values.count("a dog"));
435 440
436 const char config_string_2[] = "{\"included_categories\":[\"*\"]}"; 441 const char config_string_2[] = "{\"included_categories\":[\"*\"]}";
437 TraceConfig tc2(config_string_2); 442 TraceConfig tc2(config_string_2);
438 EXPECT_TRUE(tc2.IsCategoryEnabled("non-disabled-by-default-pattern")); 443 EXPECT_TRUE(tc2.IsCategoryEnabled("non-disabled-by-default-pattern"));
439 EXPECT_FALSE(tc2.IsCategoryEnabled("disabled-by-default-pattern")); 444 EXPECT_FALSE(tc2.IsCategoryEnabled("disabled-by-default-pattern"));
440 EXPECT_TRUE(tc2.IsCategoryGroupEnabled("non-disabled-by-default-pattern")); 445 EXPECT_TRUE(tc2.IsCategoryGroupEnabled("non-disabled-by-default-pattern"));
441 EXPECT_FALSE(tc2.IsCategoryGroupEnabled("disabled-by-default-pattern")); 446 EXPECT_FALSE(tc2.IsCategoryGroupEnabled("disabled-by-default-pattern"));
442 447
443 // Clear 448 // Clear
444 tc.Clear(); 449 tc.Clear();
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 EXPECT_NE(std::string::npos, tc.ToString().find("memory_dump_config")); 666 EXPECT_NE(std::string::npos, tc.ToString().find("memory_dump_config"));
662 EXPECT_EQ(2u, tc.memory_dump_config_.triggers.size()); 667 EXPECT_EQ(2u, tc.memory_dump_config_.triggers.size());
663 EXPECT_EQ(TraceConfig::MemoryDumpConfig::HeapProfiler 668 EXPECT_EQ(TraceConfig::MemoryDumpConfig::HeapProfiler
664 ::kDefaultBreakdownThresholdBytes, 669 ::kDefaultBreakdownThresholdBytes,
665 tc.memory_dump_config_.heap_profiler_options 670 tc.memory_dump_config_.heap_profiler_options
666 .breakdown_threshold_bytes); 671 .breakdown_threshold_bytes);
667 } 672 }
668 673
669 } // namespace trace_event 674 } // namespace trace_event
670 } // namespace base 675 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_config.cc ('k') | base/trace_event/trace_event_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698