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

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

Issue 1546033002: Switch to standard integer types in base/trace_event/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 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
« no previous file with comments | « base/trace_event/memory_allocator_dump_guid.cc ('k') | base/trace_event/memory_dump_manager.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/trace_event/memory_allocator_dump.h" 5 #include "base/trace_event/memory_allocator_dump.h"
6 6
7 #include <stdint.h>
8
7 #include "base/format_macros.h" 9 #include "base/format_macros.h"
8 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
9 #include "base/trace_event/memory_allocator_dump_guid.h" 11 #include "base/trace_event/memory_allocator_dump_guid.h"
10 #include "base/trace_event/memory_dump_provider.h" 12 #include "base/trace_event/memory_dump_provider.h"
11 #include "base/trace_event/memory_dump_session_state.h" 13 #include "base/trace_event/memory_dump_session_state.h"
12 #include "base/trace_event/process_memory_dump.h" 14 #include "base/trace_event/process_memory_dump.h"
13 #include "base/trace_event/trace_event_argument.h" 15 #include "base/trace_event/trace_event_argument.h"
14 #include "base/values.h" 16 #include "base/values.h"
17 #include "build/build_config.h"
15 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
16 19
17 namespace base { 20 namespace base {
18 namespace trace_event { 21 namespace trace_event {
19 22
20 namespace { 23 namespace {
21 24
22 class FakeMemoryAllocatorDumpProvider : public MemoryDumpProvider { 25 class FakeMemoryAllocatorDumpProvider : public MemoryDumpProvider {
23 public: 26 public:
24 bool OnMemoryDump(const MemoryDumpArgs& args, 27 bool OnMemoryDump(const MemoryDumpArgs& args,
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 const std::string& expected_value) { 78 const std::string& expected_value) {
76 std::string attr_str_value; 79 std::string attr_str_value;
77 auto attr_value = CheckAttribute(dump, name, expected_type, expected_units); 80 auto attr_value = CheckAttribute(dump, name, expected_type, expected_units);
78 EXPECT_TRUE(attr_value->GetAsString(&attr_str_value)); 81 EXPECT_TRUE(attr_value->GetAsString(&attr_str_value));
79 EXPECT_EQ(expected_value, attr_str_value); 82 EXPECT_EQ(expected_value, attr_str_value);
80 } 83 }
81 84
82 void CheckScalar(const MemoryAllocatorDump* dump, 85 void CheckScalar(const MemoryAllocatorDump* dump,
83 const std::string& name, 86 const std::string& name,
84 const char* expected_units, 87 const char* expected_units,
85 uint64 expected_value) { 88 uint64_t expected_value) {
86 CheckString(dump, name, MemoryAllocatorDump::kTypeScalar, expected_units, 89 CheckString(dump, name, MemoryAllocatorDump::kTypeScalar, expected_units,
87 StringPrintf("%" PRIx64, expected_value)); 90 StringPrintf("%" PRIx64, expected_value));
88 } 91 }
89 92
90 void CheckScalarF(const MemoryAllocatorDump* dump, 93 void CheckScalarF(const MemoryAllocatorDump* dump,
91 const std::string& name, 94 const std::string& name,
92 const char* expected_units, 95 const char* expected_units,
93 double expected_value) { 96 double expected_value) {
94 auto attr_value = CheckAttribute(dump, name, MemoryAllocatorDump::kTypeScalar, 97 auto attr_value = CheckAttribute(dump, name, MemoryAllocatorDump::kTypeScalar,
95 expected_units); 98 expected_units);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 pmd.CreateAllocatorDump("foo_allocator"); 179 pmd.CreateAllocatorDump("foo_allocator");
177 pmd.CreateAllocatorDump("bar_allocator/heap"); 180 pmd.CreateAllocatorDump("bar_allocator/heap");
178 ASSERT_DEATH(pmd.CreateAllocatorDump("foo_allocator"), ""); 181 ASSERT_DEATH(pmd.CreateAllocatorDump("foo_allocator"), "");
179 ASSERT_DEATH(pmd.CreateAllocatorDump("bar_allocator/heap"), ""); 182 ASSERT_DEATH(pmd.CreateAllocatorDump("bar_allocator/heap"), "");
180 ASSERT_DEATH(pmd.CreateAllocatorDump(""), ""); 183 ASSERT_DEATH(pmd.CreateAllocatorDump(""), "");
181 } 184 }
182 #endif 185 #endif
183 186
184 } // namespace trace_event 187 } // namespace trace_event
185 } // namespace base 188 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/memory_allocator_dump_guid.cc ('k') | base/trace_event/memory_dump_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698