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

Unified Diff: content/browser/tracing/tracing_ui_unittest.cc

Issue 2954603002: Extend unit test for json/begin_recording endpoint. (Closed)
Patch Set: Created 3 years, 6 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/tracing/tracing_ui_unittest.cc
diff --git a/content/browser/tracing/tracing_ui_unittest.cc b/content/browser/tracing/tracing_ui_unittest.cc
index 5fd6a5d52d94ac0ef07030b7a006343f226fa29d..c671230b7288a8b3cde5e50ebc81a53c6e63bc19 100644
--- a/content/browser/tracing/tracing_ui_unittest.cc
+++ b/content/browser/tracing/tracing_ui_unittest.cc
@@ -7,6 +7,7 @@
#include "base/base64.h"
#include "base/json/json_reader.h"
#include "base/json/json_writer.h"
+#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/trace_config.h"
#include "base/values.h"
#include "content/browser/tracing/tracing_ui.h"
@@ -36,7 +37,8 @@ std::string GetOldStyleConfig() {
std::string GetNewStyleConfig() {
std::unique_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
- std::unique_ptr<base::Value> filter1(new base::Value("filter1"));
+ std::unique_ptr<base::Value> filter1(
+ new base::Value(base::trace_event::MemoryDumpManager::kTraceCategory));
std::unique_ptr<base::Value> filter2(new base::Value("filter2"));
std::unique_ptr<base::ListValue> included(new base::ListValue);
included->Append(std::move(filter1));
@@ -48,6 +50,16 @@ std::string GetNewStyleConfig() {
dict->SetString("record_mode", "record-continuously");
dict->SetBoolean("enable_systrace", true);
+ std::unique_ptr<base::DictionaryValue> memory_config(
+ new base::DictionaryValue());
+ std::unique_ptr<base::DictionaryValue> trigger(new base::DictionaryValue());
+ trigger->SetString("mode", "detailed");
+ trigger->SetInteger("periodic_interval_ms", 10000);
+ std::unique_ptr<base::ListValue> triggers(new base::ListValue);
Primiano Tucci (use gerrit) 2017/06/23 09:43:42 /me pretends to not realize that new DictionaryVal
+ triggers->Append(std::move(trigger));
+ memory_config->SetList("triggers", std::move(triggers));
+ dict->SetDictionary("memory_dump_config", std::move(memory_config));
+
std::string results;
if (!base::JSONWriter::Write(*dict.get(), &results))
return "";
@@ -71,8 +83,16 @@ TEST_F(TracingUITest, NewStyleConfig) {
ASSERT_TRUE(TracingUI::GetTracingOptions(GetNewStyleConfig(), &config));
EXPECT_EQ(config.GetTraceRecordMode(),
base::trace_event::RECORD_CONTINUOUSLY);
- EXPECT_EQ(config.ToCategoryFilterString(), "filter1,-filter2");
+ std::string expected(base::trace_event::MemoryDumpManager::kTraceCategory);
+ expected += ",-filter2";
+ EXPECT_EQ(config.ToCategoryFilterString(), expected);
EXPECT_TRUE(config.IsSystraceEnabled());
+
+ ASSERT_EQ(config.memory_dump_config().triggers.size(), 1u);
+ EXPECT_EQ(config.memory_dump_config().triggers[0].min_time_between_dumps_ms,
+ 10000u);
+ EXPECT_EQ(config.memory_dump_config().triggers[0].level_of_detail,
+ base::trace_event::MemoryDumpLevelOfDetail::DETAILED);
}
} // namespace content
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698