| 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 protocol { |
| 13 namespace tracing { | |
| 14 | 13 |
| 15 namespace { | 14 namespace { |
| 16 | 15 |
| 17 const char kCustomTraceConfigString[] = | 16 const char kCustomTraceConfigString[] = |
| 18 "{" | 17 "{" |
| 19 "\"enable_argument_filter\":true," | 18 "\"enable_argument_filter\":true," |
| 20 "\"enable_systrace\":true," | 19 "\"enable_systrace\":true," |
| 21 "\"excluded_categories\":[\"excluded\",\"exc_pattern*\"]," | 20 "\"excluded_categories\":[\"excluded\",\"exc_pattern*\"]," |
| 22 "\"included_categories\":[\"included\"," | 21 "\"included_categories\":[\"included\"," |
| 23 "\"inc_pattern*\"," | 22 "\"inc_pattern*\"," |
| (...skipping 23 matching lines...) Expand all Loading... |
| 47 "\"allowed_dump_modes\":[\"background\",\"light\",\"detailed\"]," | 46 "\"allowed_dump_modes\":[\"background\",\"light\",\"detailed\"]," |
| 48 "\"triggers\":[" | 47 "\"triggers\":[" |
| 49 "{\"mode\":\"light\",\"periodicIntervalMs\":50}," | 48 "{\"mode\":\"light\",\"periodicIntervalMs\":50}," |
| 50 "{\"mode\":\"detailed\",\"periodicIntervalMs\":1000}" | 49 "{\"mode\":\"detailed\",\"periodicIntervalMs\":1000}" |
| 51 "]" | 50 "]" |
| 52 "}," | 51 "}," |
| 53 "\"recordMode\":\"recordContinuously\"," | 52 "\"recordMode\":\"recordContinuously\"," |
| 54 "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]" | 53 "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]" |
| 55 "}"; | 54 "}"; |
| 56 | 55 |
| 57 } | 56 } // namespace |
| 58 | 57 |
| 59 TEST(TracingHandlerTest, GetTraceConfigFromDevToolsConfig) { | 58 TEST(TracingHandlerTest, GetTraceConfigFromDevToolsConfig) { |
| 60 std::unique_ptr<base::Value> value = | 59 std::unique_ptr<base::Value> value = |
| 61 base::JSONReader::Read(kCustomTraceConfigStringDevToolsStyle); | 60 base::JSONReader::Read(kCustomTraceConfigStringDevToolsStyle); |
| 62 std::unique_ptr<base::DictionaryValue> devtools_style_dict( | 61 std::unique_ptr<base::DictionaryValue> devtools_style_dict( |
| 63 static_cast<base::DictionaryValue*>(value.release())); | 62 static_cast<base::DictionaryValue*>(value.release())); |
| 64 | 63 |
| 65 base::trace_event::TraceConfig trace_config = | 64 base::trace_event::TraceConfig trace_config = |
| 66 TracingHandler::GetTraceConfigFromDevToolsConfig(*devtools_style_dict); | 65 TracingHandler::GetTraceConfigFromDevToolsConfig(*devtools_style_dict); |
| 67 | 66 |
| 68 EXPECT_STREQ(kCustomTraceConfigString, trace_config.ToString().c_str()); | 67 EXPECT_STREQ(kCustomTraceConfigString, trace_config.ToString().c_str()); |
| 69 } | 68 } |
| 70 | 69 |
| 71 } // namespace tracing | 70 } // namespace protocol |
| 72 } // namespace devtools | |
| 73 } // namespace content | 71 } // namespace content |
| OLD | NEW |