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

Unified Diff: base/trace_event/trace_event_unittest.cc

Issue 1870563002: Escape name and category of trace events. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 91155ea1fe3456ef925b98dd98b32a22e36737d7..74adaaa93611943fa088801cd0c50b346122b8fa 100644
--- a/base/trace_event/trace_event_unittest.cc
+++ b/base/trace_event/trace_event_unittest.cc
@@ -2330,6 +2330,19 @@ TEST_F(TraceEventTestFixture, PrimitiveArgs) {
EXPECT_EQ(1, int_value);
}
+TEST_F(TraceEventTestFixture, NameAndCategoryEscapedIfNeeded) {
+ TraceLog::GetInstance()->SetEnabled(TraceConfig(kRecordAllCategoryFilter, ""),
+ TraceLog::RECORDING_MODE);
+ TRACE_EVENT0("category", "name\\with\\backspaces");
+ TRACE_EVENT0("category\\with\\backspaces", "name");
+ EndTraceAndFlush();
+
+ EXPECT_TRUE(FindMatchingValue("cat", "category"));
+ EXPECT_TRUE(FindMatchingValue("name", "name\\with\\backspaces"));
+ EXPECT_TRUE(FindMatchingValue("cat", "category\\with\\backspaces"));
+ EXPECT_TRUE(FindMatchingValue("name", "name"));
+}
+
namespace {
bool IsArgNameWhitelisted(const char* arg_name) {
« base/trace_event/trace_event_impl.cc ('K') | « 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