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 "base/files/memory_mapped_file.h" | 5 #include "base/files/memory_mapped_file.h" |
6 | 6 |
7 #include "base/file_util.h" | |
8 #include "base/files/file_path.h" | 7 #include "base/files/file_path.h" |
| 8 #include "base/files/file_util.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "testing/platform_test.h" | 10 #include "testing/platform_test.h" |
11 | 11 |
12 namespace base { | 12 namespace base { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Create a temporary buffer and fill it with a watermark sequence. | 16 // Create a temporary buffer and fill it with a watermark sequence. |
17 scoped_ptr<uint8[]> CreateTestBuffer(size_t size, size_t offset) { | 17 scoped_ptr<uint8[]> CreateTestBuffer(size_t size, size_t offset) { |
18 scoped_ptr<uint8[]> buf(new uint8[size]); | 18 scoped_ptr<uint8[]> buf(new uint8[size]); |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 map.Initialize(file.Pass(), MemoryMappedFile::Region(kOffset, kPartialSize)); | 157 map.Initialize(file.Pass(), MemoryMappedFile::Region(kOffset, kPartialSize)); |
158 ASSERT_EQ(kPartialSize, map.length()); | 158 ASSERT_EQ(kPartialSize, map.length()); |
159 ASSERT_TRUE(map.data() != NULL); | 159 ASSERT_TRUE(map.data() != NULL); |
160 EXPECT_TRUE(map.IsValid()); | 160 EXPECT_TRUE(map.IsValid()); |
161 ASSERT_TRUE(CheckBufferContents(map.data(), kPartialSize, kOffset)); | 161 ASSERT_TRUE(CheckBufferContents(map.data(), kPartialSize, kOffset)); |
162 } | 162 } |
163 | 163 |
164 } // namespace | 164 } // namespace |
165 | 165 |
166 } // namespace base | 166 } // namespace base |
OLD | NEW |