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

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: 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
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..33a287992d5e9ae64aa96430e85f43487e0caf38 100644
--- a/base/trace_event/trace_event_unittest.cc
+++ b/base/trace_event/trace_event_unittest.cc
@@ -2204,6 +2204,35 @@ TEST_F(TraceEventTestFixture, PrimitiveArgs) {
EXPECT_EQ(1, int_value);
}
+TEST_F(TraceEventTestFixture, ArgsWhitelisting) {
+ TraceOptions trace_options;
+ trace_options.enable_args_whitelist = true;
+ TraceLog::GetInstance()->SetEnabled(CategoryFilter("*"),
+ TraceLog::RECORDING_MODE, trace_options);
+
+ 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 {

Powered by Google App Engine
This is Rietveld 408576698