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

Side by Side Diff: third_party/crazy_linker/crazy_linker/src/crazy_linker_ashmem_unittest.cpp

Issue 23717023: Android: Add chrome-specific dynamic linker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove findbugs issues. Created 7 years, 3 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
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "crazy_linker_ashmem.h"
6
7 #include <sys/mman.h>
8
9 #include <minitest/minitest.h>
10
11 namespace crazy {
12
13 TEST(AshmemRegion, Construction) {
14 AshmemRegion region;
15 EXPECT_EQ(-1, region.Get());
16 }
17
18 TEST(AshmemRegion, Allocate) {
19 AshmemRegion region;
20 const size_t kSize = 4096*10;
21 EXPECT_TRUE(region.Allocate(kSize, __FUNCTION__));
22 void* map = ::mmap(NULL, kSize, PROT_READ|PROT_WRITE,
23 MAP_ANONYMOUS|MAP_SHARED, region.Get(), 0);
24 EXPECT_NE(MAP_FAILED, map);
25
26 for (size_t n = 0; n < kSize; ++n) {
27 TEST_TEXT << "Checking region[" << n << "]";
28 EXPECT_EQ(0, ((char*)map)[n]);
29 }
30
31 EXPECT_EQ(0, ::munmap(map, kSize));
32 }
33
34 } // namespace crazy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698