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

Side by Side Diff: base/memory/discardable_memory_provider_unittest.cc

Issue 58373003: Fix iOS device builds broken by commit d645540 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address mark's feedback about indentation Created 7 years, 1 month 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 | « no previous file | build/common.gypi » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/memory/discardable_memory_provider.h" 5 #include "base/memory/discardable_memory_provider.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/discardable_memory.h" 8 #include "base/memory/discardable_memory.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "base/synchronization/waitable_event.h" 10 #include "base/synchronization/waitable_event.h"
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 DiscardableMemory::CreateLockedMemory(size)); 275 DiscardableMemory::CreateLockedMemory(size));
276 EXPECT_TRUE(IsRegistered(discardable.get())); 276 EXPECT_TRUE(IsRegistered(discardable.get()));
277 EXPECT_NE(static_cast<void*>(NULL), Memory(discardable.get())); 277 EXPECT_NE(static_cast<void*>(NULL), Memory(discardable.get()));
278 EXPECT_EQ(1024u, BytesAllocated()); 278 EXPECT_EQ(1024u, BytesAllocated());
279 EXPECT_FALSE(CanBePurged(discardable.get())); 279 EXPECT_FALSE(CanBePurged(discardable.get()));
280 } 280 }
281 // Should have ignored the "locked" status and freed the discardable memory. 281 // Should have ignored the "locked" status and freed the discardable memory.
282 EXPECT_EQ(0u, BytesAllocated()); 282 EXPECT_EQ(0u, BytesAllocated());
283 } 283 }
284 284
285 #if !defined(NDEBUG) && !defined(OS_ANDROID) 285 #if !defined(NDEBUG) && !defined(OS_ANDROID) && !defined(OS_IOS)
286 // Death tests are not supported with Android APKs. 286 // Death tests are not supported with Android APKs.
287 TEST_F(DiscardableMemoryProviderTest, UnlockedMemoryAccessCrashesInDebugMode) { 287 TEST_F(DiscardableMemoryProviderTest, UnlockedMemoryAccessCrashesInDebugMode) {
288 size_t size = 1024; 288 size_t size = 1024;
289 const scoped_ptr<DiscardableMemory> discardable( 289 const scoped_ptr<DiscardableMemory> discardable(
290 DiscardableMemory::CreateLockedMemory(size)); 290 DiscardableMemory::CreateLockedMemory(size));
291 EXPECT_TRUE(IsRegistered(discardable.get())); 291 EXPECT_TRUE(IsRegistered(discardable.get()));
292 EXPECT_NE(static_cast<void*>(NULL), Memory(discardable.get())); 292 EXPECT_NE(static_cast<void*>(NULL), Memory(discardable.get()));
293 EXPECT_EQ(1024u, BytesAllocated()); 293 EXPECT_EQ(1024u, BytesAllocated());
294 EXPECT_FALSE(CanBePurged(discardable.get())); 294 EXPECT_FALSE(CanBePurged(discardable.get()));
295 discardable->Unlock(); 295 discardable->Unlock();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 Bind(&ThreadedDiscardableMemoryProviderTest::UseMemoryHelper, 338 Bind(&ThreadedDiscardableMemoryProviderTest::UseMemoryHelper,
339 Unretained(this))); 339 Unretained(this)));
340 memory_usage_thread_.message_loop()->PostTask( 340 memory_usage_thread_.message_loop()->PostTask(
341 FROM_HERE, 341 FROM_HERE,
342 Bind(&ThreadedDiscardableMemoryProviderTest::SignalHelper, 342 Bind(&ThreadedDiscardableMemoryProviderTest::SignalHelper,
343 Unretained(this))); 343 Unretained(this)));
344 thread_sync_.Wait(); 344 thread_sync_.Wait();
345 } 345 }
346 346
347 } // namespace base 347 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | build/common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698