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

Side by Side Diff: content/browser/devtools/protocol/tracing_handler_unittest.cc

Issue 1765153002: Update DevTools Tracing.Start to accept trace config as a parameter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix link error Created 4 years, 9 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/json/json_reader.h"
6 #include "base/trace_event/trace_config.h"
7 #include "base/values.h"
8 #include "content/browser/devtools/protocol/tracing_handler.h"
9 #include "testing/gtest/include/gtest/gtest.h"
10
11 namespace content {
12 namespace devtools {
13 namespace tracing {
14
15 namespace {
16
17 const char kCustomTraceConfigString[] =
18 "{"
19 "\"enable_argument_filter\":true,"
20 "\"enable_sampling\":true,"
21 "\"enable_systrace\":true,"
22 "\"excluded_categories\":[\"excluded\",\"exc_pattern*\"],"
23 "\"included_categories\":[\"included\","
24 "\"inc_pattern*\","
25 "\"disabled-by-default-cc\","
26 "\"disabled-by-default-memory-infra\"],"
27 "\"memory_dump_config\":{"
28 "\"triggers\":["
29 "{\"mode\":\"light\",\"periodic_interval_ms\":50},"
30 "{\"mode\":\"detailed\",\"periodic_interval_ms\":1000}"
31 "]"
32 "},"
33 "\"record_mode\":\"record-continuously\","
34 "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]"
35 "}";
36
37 const char kCustomTraceConfigStringDevtoolsStyle[] =
38 "{"
39 "\"enableArgumentFilter\":true,"
40 "\"enableSampling\":true,"
41 "\"enableSystrace\":true,"
42 "\"excludedCategories\":[\"excluded\",\"exc_pattern*\"],"
43 "\"includedCategories\":[\"included\","
44 "\"inc_pattern*\","
45 "\"disabled-by-default-cc\","
46 "\"disabled-by-default-memory-infra\"],"
47 "\"memoryDumpConfig\":{"
48 "\"triggers\":["
49 "{\"mode\":\"light\",\"periodicIntervalMs\":50},"
50 "{\"mode\":\"detailed\",\"periodicIntervalMs\":1000}"
51 "]"
52 "},"
53 "\"recordMode\":\"recordContinuously\","
54 "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]"
55 "}";
56
57 }
58
59 TEST(TracingHandlerTest, GetTraceConfigFromDevtoolsConfig) {
60 scoped_ptr<base::Value> value = base::JSONReader::Read(
61 kCustomTraceConfigStringDevtoolsStyle);
62 scoped_ptr<base::DictionaryValue> devtools_style_dict(
63 static_cast<base::DictionaryValue*>(value.release()));
64
65 base::trace_event::TraceConfig trace_config =
66 TracingHandler::GetTraceConfigFromDevtoolsConfig(*devtools_style_dict);
67
68 EXPECT_STREQ(kCustomTraceConfigString, trace_config.ToString().c_str());
69 }
70
71 } // namespace tracing
72 } // namespace devtools
73 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698