Chromium Code Reviews| Index: content/browser/devtools/protocol/tracing_handler_unittest.cc |
| diff --git a/content/browser/devtools/protocol/tracing_handler_unittest.cc b/content/browser/devtools/protocol/tracing_handler_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..94937b42f3664adbee66ae4ad4edd500f8ec50ea |
| --- /dev/null |
| +++ b/content/browser/devtools/protocol/tracing_handler_unittest.cc |
| @@ -0,0 +1,73 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/json/json_reader.h" |
| +#include "base/trace_event/trace_config.h" |
| +#include "base/values.h" |
| +#include "content/browser/devtools/protocol/tracing_handler.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace content { |
| +namespace devtools { |
| +namespace tracing { |
| + |
| +namespace { |
| + |
| +const char kCustomTraceConfigString[] = |
| + "{" |
| + "\"enable_argument_filter\":true," |
| + "\"enable_sampling\":true," |
| + "\"enable_systrace\":true," |
| + "\"excluded_categories\":[\"excluded\",\"exc_pattern*\"]," |
| + "\"included_categories\":[\"included\"," |
| + "\"inc_pattern*\"," |
| + "\"disabled-by-default-cc\"," |
| + "\"disabled-by-default-memory-infra\"]," |
| + "\"memory_dump_config\":{" |
| + "\"triggers\":[" |
| + "{\"mode\":\"light\",\"periodic_interval_ms\":50}," |
| + "{\"mode\":\"detailed\",\"periodic_interval_ms\":1000}" |
| + "]" |
| + "}," |
| + "\"record_mode\":\"record-continuously\"," |
| + "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]" |
| + "}"; |
| + |
| +const char kCustomTraceConfigStringDevtoolsStyle[] = |
| + "{" |
| + "\"enableArgumentFilter\":true," |
| + "\"enableSampling\":true," |
| + "\"enableSystrace\":true," |
| + "\"excludedCategories\":[\"excluded\",\"exc_pattern*\"]," |
| + "\"includedCategories\":[\"included\"," |
| + "\"inc_pattern*\"," |
| + "\"disabled-by-default-cc\"," |
| + "\"disabled-by-default-memory-infra\"]," |
| + "\"memoryDumpConfig\":{" |
| + "\"triggers\":[" |
| + "{\"mode\":\"light\",\"periodicIntervalMs\":50}," |
| + "{\"mode\":\"detailed\",\"periodicIntervalMs\":1000}" |
| + "]" |
| + "}," |
| + "\"recordMode\":\"recordContinuously\"," |
| + "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]" |
| + "}"; |
| + |
| +} |
| + |
| +TEST(TracingHandlerTest, GetTraceConfigFromDevtoolsConfig) { |
| + scoped_ptr<base::Value> value = base::JSONReader::Read( |
| + kCustomTraceConfigStringDevtoolsStyle); |
| + scoped_ptr<base::DictionaryValue> devtools_style_dict( |
| + static_cast<base::DictionaryValue*>(value.release())); |
| + |
| + base::trace_event::TraceConfig trace_config = |
| + TracingHandler::GetTraceConfigFromDevtoolsConfig(*devtools_style_dict); |
|
Zhen Wang
2016/03/08 00:41:52
Andrey, I get link error here. Do you have any ide
Primiano Tucci (use gerrit)
2016/03/08 21:30:12
You need to CONTENT_EXPORT (or whatever is the rig
Zhen Wang
2016/03/08 22:09:40
Ah, I see. Thanks! Fixed.
|
| + |
| + EXPECT_STREQ(kCustomTraceConfigString, trace_config.ToString().c_str()); |
| +} |
| + |
| +} // namespace tracing |
| +} // namespace devtools |
| +} // namespace content |