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

Side by Side Diff: base/trace_event/trace_config_unittest.cc

Issue 1911643002: Add configurable limit to allocations in heap profiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing comments Created 4 years, 8 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
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/json/json_reader.h" 7 #include "base/json/json_reader.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/trace_event/memory_dump_manager.h" 9 #include "base/trace_event/memory_dump_manager.h"
10 #include "base/trace_event/trace_config.h" 10 #include "base/trace_event/trace_config.h"
(...skipping 18 matching lines...) Expand all
29 "{" 29 "{"
30 "\"enable_argument_filter\":true," 30 "\"enable_argument_filter\":true,"
31 "\"enable_sampling\":true," 31 "\"enable_sampling\":true,"
32 "\"enable_systrace\":true," 32 "\"enable_systrace\":true,"
33 "\"excluded_categories\":[\"excluded\",\"exc_pattern*\"]," 33 "\"excluded_categories\":[\"excluded\",\"exc_pattern*\"],"
34 "\"included_categories\":[\"included\"," 34 "\"included_categories\":[\"included\","
35 "\"inc_pattern*\"," 35 "\"inc_pattern*\","
36 "\"disabled-by-default-cc\"," 36 "\"disabled-by-default-cc\","
37 "\"disabled-by-default-memory-infra\"]," 37 "\"disabled-by-default-memory-infra\"],"
38 "\"memory_dump_config\":{" 38 "\"memory_dump_config\":{"
39 "\"min_allocation_size_bytes\":10240,"
39 "\"triggers\":[" 40 "\"triggers\":["
40 "{\"mode\":\"light\",\"periodic_interval_ms\":50}," 41 "{\"mode\":\"light\",\"periodic_interval_ms\":50},"
41 "{\"mode\":\"detailed\",\"periodic_interval_ms\":1000}" 42 "{\"mode\":\"detailed\",\"periodic_interval_ms\":1000}"
42 "]" 43 "]"
43 "}," 44 "},"
44 "\"record_mode\":\"record-continuously\"," 45 "\"record_mode\":\"record-continuously\","
45 "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]" 46 "\"synthetic_delays\":[\"test.Delay1;16\",\"test.Delay2;32\"]"
46 "}"; 47 "}";
47 48
48 } // namespace 49 } // namespace
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 DCHECK(custom_value); 312 DCHECK(custom_value);
312 const DictionaryValue* custom_dict = nullptr; 313 const DictionaryValue* custom_dict = nullptr;
313 is_dict = custom_value->GetAsDictionary(&custom_dict); 314 is_dict = custom_value->GetAsDictionary(&custom_dict);
314 DCHECK(is_dict); 315 DCHECK(is_dict);
315 TraceConfig custom_tc(*custom_dict); 316 TraceConfig custom_tc(*custom_dict);
316 EXPECT_STREQ(kCustomTraceConfigString, custom_tc.ToString().c_str()); 317 EXPECT_STREQ(kCustomTraceConfigString, custom_tc.ToString().c_str());
317 EXPECT_EQ(RECORD_CONTINUOUSLY, custom_tc.GetTraceRecordMode()); 318 EXPECT_EQ(RECORD_CONTINUOUSLY, custom_tc.GetTraceRecordMode());
318 EXPECT_TRUE(custom_tc.IsSamplingEnabled()); 319 EXPECT_TRUE(custom_tc.IsSamplingEnabled());
319 EXPECT_TRUE(custom_tc.IsSystraceEnabled()); 320 EXPECT_TRUE(custom_tc.IsSystraceEnabled());
320 EXPECT_TRUE(custom_tc.IsArgumentFilterEnabled()); 321 EXPECT_TRUE(custom_tc.IsArgumentFilterEnabled());
322 EXPECT_EQ(10240u, custom_tc.GetMinAllocationSizeBytes());
321 EXPECT_STREQ("included,inc_pattern*," 323 EXPECT_STREQ("included,inc_pattern*,"
322 "disabled-by-default-cc,disabled-by-default-memory-infra," 324 "disabled-by-default-cc,disabled-by-default-memory-infra,"
323 "-excluded,-exc_pattern*," 325 "-excluded,-exc_pattern*,"
324 "DELAY(test.Delay1;16),DELAY(test.Delay2;32)", 326 "DELAY(test.Delay1;16),DELAY(test.Delay2;32)",
325 custom_tc.ToCategoryFilterString().c_str()); 327 custom_tc.ToCategoryFilterString().c_str());
326 } 328 }
327 329
328 TEST(TraceConfigTest, TraceConfigFromValidString) { 330 TEST(TraceConfigTest, TraceConfigFromValidString) {
329 // Using some non-empty config string. 331 // Using some non-empty config string.
330 const char config_string[] = 332 const char config_string[] =
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 593
592 TEST(TraceConfigTest, LegacyStringToMemoryDumpConfig) { 594 TEST(TraceConfigTest, LegacyStringToMemoryDumpConfig) {
593 TraceConfig tc(MemoryDumpManager::kTraceCategory, ""); 595 TraceConfig tc(MemoryDumpManager::kTraceCategory, "");
594 EXPECT_TRUE(tc.IsCategoryGroupEnabled(MemoryDumpManager::kTraceCategory)); 596 EXPECT_TRUE(tc.IsCategoryGroupEnabled(MemoryDumpManager::kTraceCategory));
595 EXPECT_NE(std::string::npos, tc.ToString().find("memory_dump_config")); 597 EXPECT_NE(std::string::npos, tc.ToString().find("memory_dump_config"));
596 EXPECT_EQ(2u, tc.memory_dump_config_.size()); 598 EXPECT_EQ(2u, tc.memory_dump_config_.size());
597 } 599 }
598 600
599 } // namespace trace_event 601 } // namespace trace_event
600 } // namespace base 602 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698