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

Unified Diff: base/trace_event/trace_event_unittest.cc

Issue 1067233002: Added a trace option for whitewashing trace args against a known-PII-less list. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed enable_args_whitelist Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/trace_event/trace_event_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event_unittest.cc
diff --git a/base/trace_event/trace_event_unittest.cc b/base/trace_event/trace_event_unittest.cc
index 0d3b0912ae21a15deac99aaa02b3eaede25421b8..e611caf566f2905281ef916ba80a633981636991 100644
--- a/base/trace_event/trace_event_unittest.cc
+++ b/base/trace_event/trace_event_unittest.cc
@@ -2204,6 +2204,50 @@ TEST_F(TraceEventTestFixture, PrimitiveArgs) {
EXPECT_EQ(1, int_value);
}
+namespace {
+
+bool IsTraceEventArgsWhitelisted(const char* category_group_name,
+ const char* event_name) {
+ if (MatchPattern(category_group_name, "toplevel") &&
+ MatchPattern(event_name, "*")) {
+ return true;
+ }
+
+ return false;
+}
+
+} // namespace
+
+TEST_F(TraceEventTestFixture, ArgsWhitelisting) {
+ TraceLog::GetInstance()->SetEnabled(CategoryFilter("*"),
+ TraceLog::RECORDING_MODE, TraceOptions());
+
+ TraceLog::GetInstance()->SetEventFilterPredicate(
+ base::Bind(&IsTraceEventArgsWhitelisted));
+
+ TRACE_EVENT1("toplevel", "event1", "int_one", 1);
+ TRACE_EVENT1("whitewashed", "event2", "int_two", 1);
+ EndTraceAndFlush();
+
+ const DictionaryValue* args_dict = NULL;
+ DictionaryValue* dict = NULL;
+ int int_value;
+
+ dict = FindNamePhase("event1", "X");
+ ASSERT_TRUE(dict);
+ dict->GetDictionary("args", &args_dict);
+ ASSERT_TRUE(args_dict);
+ EXPECT_TRUE(args_dict->GetInteger("int_one", &int_value));
+ EXPECT_EQ(1, int_value);
+
+ dict = FindNamePhase("event2", "X");
+ ASSERT_TRUE(dict);
+ dict->GetDictionary("args", &args_dict);
+ ASSERT_TRUE(args_dict);
+ EXPECT_FALSE(args_dict->GetInteger("int_two", &int_value));
+ EXPECT_TRUE(args_dict->GetInteger("stripped", &int_value));
+}
+
class TraceEventCallbackTest : public TraceEventTestFixture {
public:
void SetUp() override {
« no previous file with comments | « base/trace_event/trace_event_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698