| 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 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 "{" | 38 "{" |
| 39 "\"enableArgumentFilter\":true," | 39 "\"enableArgumentFilter\":true," |
| 40 "\"enableSampling\":true," | 40 "\"enableSampling\":true," |
| 41 "\"enableSystrace\":true," | 41 "\"enableSystrace\":true," |
| 42 "\"excludedCategories\":[\"excluded\",\"exc_pattern*\"]," | 42 "\"excludedCategories\":[\"excluded\",\"exc_pattern*\"]," |
| 43 "\"includedCategories\":[\"included\"," | 43 "\"includedCategories\":[\"included\"," |
| 44 "\"inc_pattern*\"," | 44 "\"inc_pattern*\"," |
| 45 "\"disabled-by-default-cc\"," | 45 "\"disabled-by-default-cc\"," |
| 46 "\"disabled-by-default-memory-infra\"]," | 46 "\"disabled-by-default-memory-infra\"]," |
| 47 "\"memoryDumpConfig\":{" | 47 "\"memoryDumpConfig\":{" |
| 48 "\"min_allocation_size_bytes\":10240," |
| 48 "\"triggers\":[" | 49 "\"triggers\":[" |
| 49 "{\"mode\":\"light\",\"periodicIntervalMs\":50}," | 50 "{\"mode\":\"light\",\"periodicIntervalMs\":50}," |
| 50 "{\"mode\":\"detailed\",\"periodicIntervalMs\":1000}" | 51 "{\"mode\":\"detailed\",\"periodicIntervalMs\":1000}" |
| 51 "]" | 52 "]" |
| 52 "}," | 53 "}," |
| 53 "\"recordMode\":\"recordContinuously\"," | 54 "\"recordMode\":\"recordContinuously\"," |
| 54 "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]" | 55 "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]" |
| 55 "}"; | 56 "}"; |
| 56 | 57 |
| 57 } | 58 } |
| 58 | 59 |
| 59 TEST(TracingHandlerTest, GetTraceConfigFromDevToolsConfig) { | 60 TEST(TracingHandlerTest, GetTraceConfigFromDevToolsConfig) { |
| 60 std::unique_ptr<base::Value> value = | 61 std::unique_ptr<base::Value> value = |
| 61 base::JSONReader::Read(kCustomTraceConfigStringDevToolsStyle); | 62 base::JSONReader::Read(kCustomTraceConfigStringDevToolsStyle); |
| 62 std::unique_ptr<base::DictionaryValue> devtools_style_dict( | 63 std::unique_ptr<base::DictionaryValue> devtools_style_dict( |
| 63 static_cast<base::DictionaryValue*>(value.release())); | 64 static_cast<base::DictionaryValue*>(value.release())); |
| 64 | 65 |
| 65 base::trace_event::TraceConfig trace_config = | 66 base::trace_event::TraceConfig trace_config = |
| 66 TracingHandler::GetTraceConfigFromDevToolsConfig(*devtools_style_dict); | 67 TracingHandler::GetTraceConfigFromDevToolsConfig(*devtools_style_dict); |
| 67 | 68 |
| 68 EXPECT_STREQ(kCustomTraceConfigString, trace_config.ToString().c_str()); | 69 EXPECT_STREQ(kCustomTraceConfigString, trace_config.ToString().c_str()); |
| 69 } | 70 } |
| 70 | 71 |
| 71 } // namespace tracing | 72 } // namespace tracing |
| 72 } // namespace devtools | 73 } // namespace devtools |
| 73 } // namespace content | 74 } // namespace content |
| OLD | NEW |