OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/json/json_reader.h" | 5 #include "base/json/json_reader.h" |
6 #include "base/trace_event/trace_config.h" | 6 #include "base/trace_event/trace_config.h" |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "content/browser/devtools/protocol/tracing_handler.h" | 8 #include "content/browser/devtools/protocol/tracing_handler.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 | 10 |
11 namespace content { | 11 namespace content { |
12 namespace devtools { | 12 namespace devtools { |
13 namespace tracing { | 13 namespace tracing { |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 const char kCustomTraceConfigString[] = | 17 const char kCustomTraceConfigString[] = |
18 "{" | 18 "{" |
19 "\"enable_argument_filter\":true," | 19 "\"enable_argument_filter\":true," |
20 "\"enable_sampling\":true," | |
21 "\"enable_systrace\":true," | 20 "\"enable_systrace\":true," |
22 "\"excluded_categories\":[\"excluded\",\"exc_pattern*\"]," | 21 "\"excluded_categories\":[\"excluded\",\"exc_pattern*\"]," |
23 "\"included_categories\":[\"included\"," | 22 "\"included_categories\":[\"included\"," |
24 "\"inc_pattern*\"," | 23 "\"inc_pattern*\"," |
25 "\"disabled-by-default-cc\"," | 24 "\"disabled-by-default-cc\"," |
26 "\"disabled-by-default-memory-infra\"]," | 25 "\"disabled-by-default-memory-infra\"]," |
27 "\"memory_dump_config\":{" | 26 "\"memory_dump_config\":{" |
28 "\"allowed_dump_modes\":[\"background\",\"light\",\"detailed\"]," | 27 "\"allowed_dump_modes\":[\"background\",\"light\",\"detailed\"]," |
29 "\"triggers\":[" | 28 "\"triggers\":[" |
30 "{\"mode\":\"light\",\"periodic_interval_ms\":50}," | 29 "{\"mode\":\"light\",\"periodic_interval_ms\":50}," |
31 "{\"mode\":\"detailed\",\"periodic_interval_ms\":1000}" | 30 "{\"mode\":\"detailed\",\"periodic_interval_ms\":1000}" |
32 "]" | 31 "]" |
33 "}," | 32 "}," |
34 "\"record_mode\":\"record-continuously\"," | 33 "\"record_mode\":\"record-continuously\"," |
35 "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]" | 34 "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]" |
36 "}"; | 35 "}"; |
37 | 36 |
38 const char kCustomTraceConfigStringDevToolsStyle[] = | 37 const char kCustomTraceConfigStringDevToolsStyle[] = |
39 "{" | 38 "{" |
40 "\"enableArgumentFilter\":true," | 39 "\"enableArgumentFilter\":true," |
41 "\"enableSampling\":true," | |
42 "\"enableSystrace\":true," | 40 "\"enableSystrace\":true," |
43 "\"excludedCategories\":[\"excluded\",\"exc_pattern*\"]," | 41 "\"excludedCategories\":[\"excluded\",\"exc_pattern*\"]," |
44 "\"includedCategories\":[\"included\"," | 42 "\"includedCategories\":[\"included\"," |
45 "\"inc_pattern*\"," | 43 "\"inc_pattern*\"," |
46 "\"disabled-by-default-cc\"," | 44 "\"disabled-by-default-cc\"," |
47 "\"disabled-by-default-memory-infra\"]," | 45 "\"disabled-by-default-memory-infra\"]," |
48 "\"memoryDumpConfig\":{" | 46 "\"memoryDumpConfig\":{" |
49 "\"allowed_dump_modes\":[\"background\",\"light\",\"detailed\"]," | 47 "\"allowed_dump_modes\":[\"background\",\"light\",\"detailed\"]," |
50 "\"triggers\":[" | 48 "\"triggers\":[" |
51 "{\"mode\":\"light\",\"periodicIntervalMs\":50}," | 49 "{\"mode\":\"light\",\"periodicIntervalMs\":50}," |
(...skipping 14 matching lines...) Expand all Loading... |
66 | 64 |
67 base::trace_event::TraceConfig trace_config = | 65 base::trace_event::TraceConfig trace_config = |
68 TracingHandler::GetTraceConfigFromDevToolsConfig(*devtools_style_dict); | 66 TracingHandler::GetTraceConfigFromDevToolsConfig(*devtools_style_dict); |
69 | 67 |
70 EXPECT_STREQ(kCustomTraceConfigString, trace_config.ToString().c_str()); | 68 EXPECT_STREQ(kCustomTraceConfigString, trace_config.ToString().c_str()); |
71 } | 69 } |
72 | 70 |
73 } // namespace tracing | 71 } // namespace tracing |
74 } // namespace devtools | 72 } // namespace devtools |
75 } // namespace content | 73 } // namespace content |
OLD | NEW |