| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stdint.h> | 5 #include <stdint.h> |
| 6 #include <string.h> | 6 #include <string.h> |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 #include "tools/android/heap_profiler/heap_profiler.h" | 11 #include "tools/android/heap_profiler/heap_profiler.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class HeapProfilerTest : public testing::Test { | 15 class HeapProfilerTest : public testing::Test { |
| 16 public: | 16 public: |
| 17 virtual void SetUp() OVERRIDE { heap_profiler_init(&stats_); } | 17 virtual void SetUp() override { heap_profiler_init(&stats_); } |
| 18 | 18 |
| 19 virtual void TearDown() OVERRIDE { | 19 virtual void TearDown() override { |
| 20 CheckAllocVsStacktaceConsistency(); | 20 CheckAllocVsStacktaceConsistency(); |
| 21 heap_profiler_cleanup(); | 21 heap_profiler_cleanup(); |
| 22 } | 22 } |
| 23 | 23 |
| 24 protected: | 24 protected: |
| 25 struct StackTrace { | 25 struct StackTrace { |
| 26 uintptr_t frames[HEAP_PROFILER_MAX_DEPTH]; | 26 uintptr_t frames[HEAP_PROFILER_MAX_DEPTH]; |
| 27 size_t depth; | 27 size_t depth; |
| 28 }; | 28 }; |
| 29 | 29 |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 EXPECT_EQ(4096, stats_.total_alloc_bytes); | 449 EXPECT_EQ(4096, stats_.total_alloc_bytes); |
| 450 | 450 |
| 451 heap_profiler_free((void*)0xfffffffffffff000L, 4096, NULL); | 451 heap_profiler_free((void*)0xfffffffffffff000L, 4096, NULL); |
| 452 EXPECT_EQ(0, stats_.num_allocs); | 452 EXPECT_EQ(0, stats_.num_allocs); |
| 453 EXPECT_EQ(0, stats_.num_stack_traces); | 453 EXPECT_EQ(0, stats_.num_stack_traces); |
| 454 EXPECT_EQ(0, stats_.total_alloc_bytes); | 454 EXPECT_EQ(0, stats_.total_alloc_bytes); |
| 455 } | 455 } |
| 456 #endif | 456 #endif |
| 457 | 457 |
| 458 } // namespace | 458 } // namespace |
| OLD | NEW |