| 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/metrics/persistent_memory_allocator.h" | 5 #include "base/metrics/persistent_memory_allocator.h" | 
| 6 | 6 | 
| 7 #include <memory> | 7 #include <memory> | 
| 8 | 8 | 
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" | 
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" | 
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 575 | 575 | 
| 576   // Interconnectivity test. | 576   // Interconnectivity test. | 
| 577   Reference obj = shalloc3.Allocate(42, 42); | 577   Reference obj = shalloc3.Allocate(42, 42); | 
| 578   ASSERT_TRUE(obj); | 578   ASSERT_TRUE(obj); | 
| 579   shalloc3.MakeIterable(obj); | 579   shalloc3.MakeIterable(obj); | 
| 580   EXPECT_EQ(obj, iter2.GetNext(&type)); | 580   EXPECT_EQ(obj, iter2.GetNext(&type)); | 
| 581   EXPECT_EQ(42U, type); | 581   EXPECT_EQ(42U, type); | 
| 582 } | 582 } | 
| 583 | 583 | 
| 584 | 584 | 
|  | 585 #if !defined(OS_NACL) | 
| 585 //----- FilePersistentMemoryAllocator ------------------------------------------ | 586 //----- FilePersistentMemoryAllocator ------------------------------------------ | 
| 586 | 587 | 
| 587 TEST(FilePersistentMemoryAllocatorTest, CreationTest) { | 588 TEST(FilePersistentMemoryAllocatorTest, CreationTest) { | 
| 588   ScopedTempDir temp_dir; | 589   ScopedTempDir temp_dir; | 
| 589   ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 590   ASSERT_TRUE(temp_dir.CreateUniqueTempDir()); | 
| 590   FilePath file_path = temp_dir.path().AppendASCII("persistent_memory"); | 591   FilePath file_path = temp_dir.path().AppendASCII("persistent_memory"); | 
| 591 | 592 | 
| 592   PersistentMemoryAllocator::MemoryInfo meminfo1; | 593   PersistentMemoryAllocator::MemoryInfo meminfo1; | 
| 593   Reference r123, r456, r789; | 594   Reference r123, r456, r789; | 
| 594   { | 595   { | 
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 777                                               read_only); | 778                                               read_only); | 
| 778       EXPECT_TRUE(allocator.IsCorrupt());  // Garbage data so it should be. | 779       EXPECT_TRUE(allocator.IsCorrupt());  // Garbage data so it should be. | 
| 779     } else { | 780     } else { | 
| 780       // For filesize >= minsize, the file must be acceptable. This | 781       // For filesize >= minsize, the file must be acceptable. This | 
| 781       // else clause (file-not-acceptable) should be reached only if | 782       // else clause (file-not-acceptable) should be reached only if | 
| 782       // filesize < minsize. | 783       // filesize < minsize. | 
| 783       EXPECT_GT(minsize, filesize); | 784       EXPECT_GT(minsize, filesize); | 
| 784     } | 785     } | 
| 785   } | 786   } | 
| 786 } | 787 } | 
|  | 788 #endif  // !defined(OS_NACL) | 
| 787 | 789 | 
| 788 }  // namespace base | 790 }  // namespace base | 
| OLD | NEW | 
|---|