| OLD | NEW | 
|---|
| 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> | 7 #include <stdint.h> | 
| 8 | 8 | 
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" | 
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" | 
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 165   DictionaryValue* attrs = nullptr; | 165   DictionaryValue* attrs = nullptr; | 
| 166   ASSERT_TRUE(raw_attrs->GetAsDictionary(&attrs)); | 166   ASSERT_TRUE(raw_attrs->GetAsDictionary(&attrs)); | 
| 167   ASSERT_FALSE(attrs->HasKey(MemoryAllocatorDump::kNameSize)); | 167   ASSERT_FALSE(attrs->HasKey(MemoryAllocatorDump::kNameSize)); | 
| 168   ASSERT_FALSE(attrs->HasKey(MemoryAllocatorDump::kNameObjectCount)); | 168   ASSERT_FALSE(attrs->HasKey(MemoryAllocatorDump::kNameObjectCount)); | 
| 169 | 169 | 
| 170   // Check that the AsValueInfo doesn't hit any DCHECK. | 170   // Check that the AsValueInfo doesn't hit any DCHECK. | 
| 171   std::unique_ptr<TracedValue> traced_value(new TracedValue); | 171   std::unique_ptr<TracedValue> traced_value(new TracedValue); | 
| 172   pmd.AsValueInto(traced_value.get()); | 172   pmd.AsValueInto(traced_value.get()); | 
| 173 } | 173 } | 
| 174 | 174 | 
| 175 // DEATH tests are not supported in Android / iOS. | 175 // DEATH tests are not supported in Android/iOS/Fuchsia. | 
| 176 #if !defined(NDEBUG) && !defined(OS_ANDROID) && !defined(OS_IOS) | 176 #if !defined(NDEBUG) && !defined(OS_ANDROID) && !defined(OS_IOS) && \ | 
|  | 177     !defined(OS_FUCHSIA) | 
| 177 TEST(MemoryAllocatorDumpTest, ForbidDuplicatesDeathTest) { | 178 TEST(MemoryAllocatorDumpTest, ForbidDuplicatesDeathTest) { | 
| 178   FakeMemoryAllocatorDumpProvider fmadp; | 179   FakeMemoryAllocatorDumpProvider fmadp; | 
| 179   MemoryDumpArgs dump_args = {MemoryDumpLevelOfDetail::DETAILED}; | 180   MemoryDumpArgs dump_args = {MemoryDumpLevelOfDetail::DETAILED}; | 
| 180   ProcessMemoryDump pmd(new MemoryDumpSessionState, dump_args); | 181   ProcessMemoryDump pmd(new MemoryDumpSessionState, dump_args); | 
| 181   pmd.CreateAllocatorDump("foo_allocator"); | 182   pmd.CreateAllocatorDump("foo_allocator"); | 
| 182   pmd.CreateAllocatorDump("bar_allocator/heap"); | 183   pmd.CreateAllocatorDump("bar_allocator/heap"); | 
| 183   ASSERT_DEATH(pmd.CreateAllocatorDump("foo_allocator"), ""); | 184   ASSERT_DEATH(pmd.CreateAllocatorDump("foo_allocator"), ""); | 
| 184   ASSERT_DEATH(pmd.CreateAllocatorDump("bar_allocator/heap"), ""); | 185   ASSERT_DEATH(pmd.CreateAllocatorDump("bar_allocator/heap"), ""); | 
| 185   ASSERT_DEATH(pmd.CreateAllocatorDump(""), ""); | 186   ASSERT_DEATH(pmd.CreateAllocatorDump(""), ""); | 
| 186 } | 187 } | 
| 187 #endif | 188 #endif | 
| 188 | 189 | 
| 189 }  // namespace trace_event | 190 }  // namespace trace_event | 
| 190 }  // namespace base | 191 }  // namespace base | 
| OLD | NEW | 
|---|