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

Side by Side Diff: base/allocator/malloc_zone_functions_mac_unittest.cc

Issue 2727463002: mac: Several minor fixes to allocator shim. (Closed)
Patch Set: more compile error. Created 3 years, 9 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 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/allocator/malloc_zone_functions_mac.h" 5 #include "base/allocator/malloc_zone_functions_mac.h"
6 #include "testing/gtest/include/gtest/gtest.h" 6 #include "testing/gtest/include/gtest/gtest.h"
7 7
8 namespace base { 8 namespace base {
9 namespace allocator { 9 namespace allocator {
10 10
11 class MallocZoneFunctionsTest : public testing::Test { 11 class MallocZoneFunctionsTest : public testing::Test {
12 protected: 12 protected:
13 void SetUp() override { ClearAllMallocZonesForTesting(); } 13 void TearDown() override { ClearAllMallocZonesForTesting(); }
14 }; 14 };
15 15
16 TEST_F(MallocZoneFunctionsTest, TestDefaultZoneMallocFree) { 16 TEST_F(MallocZoneFunctionsTest, TestDefaultZoneMallocFree) {
17 ChromeMallocZone* malloc_zone = 17 ChromeMallocZone* malloc_zone =
18 reinterpret_cast<ChromeMallocZone*>(malloc_default_zone()); 18 reinterpret_cast<ChromeMallocZone*>(malloc_default_zone());
19 StoreMallocZone(malloc_zone); 19 StoreMallocZone(malloc_zone);
20 int* test = reinterpret_cast<int*>( 20 int* test = reinterpret_cast<int*>(
21 g_malloc_zones[0].malloc(malloc_default_zone(), 33)); 21 g_malloc_zones[0].malloc(malloc_default_zone(), 33));
22 test[0] = 1; 22 test[0] = 1;
23 test[1] = 2; 23 test[1] = 2;
(...skipping 24 matching lines...) Expand all
48 memcpy(&zone, malloc_default_zone(), sizeof(ChromeMallocZone)); 48 memcpy(&zone, malloc_default_zone(), sizeof(ChromeMallocZone));
49 StoreMallocZone(&zone); 49 StoreMallocZone(&zone);
50 } 50 }
51 51
52 int max_zone_count = kMaxZoneCount; 52 int max_zone_count = kMaxZoneCount;
53 EXPECT_EQ(max_zone_count, GetMallocZoneCountForTesting()); 53 EXPECT_EQ(max_zone_count, GetMallocZoneCountForTesting());
54 } 54 }
55 55
56 } // namespace allocator 56 } // namespace allocator
57 } // namespace base 57 } // namespace base
OLDNEW
« no previous file with comments | « base/allocator/malloc_zone_functions_mac.cc ('k') | base/debug/thread_heap_usage_tracker_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698