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

Unified Diff: base/trace_event/trace_config_unittest.cc

Issue 1335503003: [tracing] Add test for memory-infra startup tracing (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@startup_tracing
Patch Set: Nit Created 5 years, 3 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_config_memory_test_util.h ('k') | base/trace_event/trace_event.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_config_unittest.cc
diff --git a/base/trace_event/trace_config_unittest.cc b/base/trace_event/trace_config_unittest.cc
index fdfb8803f48102cd7feddcfee0e9446f36965786..d66b8e8b8608a50d505335f869b203d8d426b272 100644
--- a/base/trace_event/trace_config_unittest.cc
+++ b/base/trace_event/trace_config_unittest.cc
@@ -1,9 +1,10 @@
-// Copyright (c) 2015 The Chromium Authors. All rights reserved.
+// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/trace_config.h"
+#include "base/trace_event/trace_config_memory_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace base {
@@ -19,45 +20,6 @@ const char kDefaultTraceConfigString[] =
"\"excluded_categories\":[\"*Debug\",\"*Test\"],"
"\"record_mode\":\"record-until-full\""
"}";
-
-const char kMemoryDumpTraceConfigString[] =
- "{"
- "\"enable_argument_filter\":false,"
- "\"enable_sampling\":false,"
- "\"enable_systrace\":false,"
- "\"included_categories\":["
- "\"disabled-by-default-memory-infra\""
- "],"
- "\"memory_dump_config\":{"
- "\"triggers\":["
- "{"
- "\"mode\":\"light\","
- "\"periodic_interval_ms\":200"
- "},"
- "{"
- "\"mode\":\"detailed\","
- "\"periodic_interval_ms\":2000"
- "}"
- "]"
- "},"
- "\"record_mode\":\"record-until-full\""
- "}";
-
-const char kTraceConfigStringWithEmptyTriggers[] =
- "{"
- "\"enable_argument_filter\":false,"
- "\"enable_sampling\":false,"
- "\"enable_systrace\":false,"
- "\"included_categories\":["
- "\"disabled-by-default-memory-infra\""
- "],"
- "\"memory_dump_config\":{"
- "\"triggers\":["
- "]"
- "},"
- "\"record_mode\":\"record-until-full\""
- "}";
-
} // namespace
TEST(TraceConfigTest, TraceConfigFromValidLegacyFormat) {
@@ -528,8 +490,10 @@ TEST(TraceConfigTest, SetTraceOptionValues) {
}
TEST(TraceConfigTest, TraceConfigFromMemoryConfigString) {
- TraceConfig tc(kMemoryDumpTraceConfigString);
- EXPECT_STREQ(kMemoryDumpTraceConfigString, tc.ToString().c_str());
+ std::string tc_str =
+ TraceConfigMemoryTestUtil::GetTraceConfig_PeriodicTriggers(200, 2000);
+ TraceConfig tc(tc_str);
+ EXPECT_EQ(tc_str, tc.ToString());
EXPECT_TRUE(tc.IsCategoryGroupEnabled(MemoryDumpManager::kTraceCategory));
EXPECT_EQ(2u, tc.memory_dump_config_.size());
@@ -544,8 +508,9 @@ TEST(TraceConfigTest, TraceConfigFromMemoryConfigString) {
TEST(TraceConfigTest, EmptyMemoryDumpConfigTest) {
// Empty trigger list should also be specified when converting back to string.
- TraceConfig tc(kTraceConfigStringWithEmptyTriggers);
- EXPECT_STREQ(kTraceConfigStringWithEmptyTriggers, tc.ToString().c_str());
+ TraceConfig tc(TraceConfigMemoryTestUtil::GetTraceConfig_EmptyTriggers());
+ EXPECT_EQ(TraceConfigMemoryTestUtil::GetTraceConfig_EmptyTriggers(),
+ tc.ToString());
EXPECT_EQ(0u, tc.memory_dump_config_.size());
}
« no previous file with comments | « base/trace_event/trace_config_memory_test_util.h ('k') | base/trace_event/trace_event.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698