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

Unified 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: Rebase to fix build. 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 side-by-side diff with in-line comments
Download patch
Index: third_party/crazy_linker/crazy_linker/src/crazy_linker_ashmem_unittest.cpp
diff --git a/third_party/crazy_linker/crazy_linker/src/crazy_linker_ashmem_unittest.cpp b/third_party/crazy_linker/crazy_linker/src/crazy_linker_ashmem_unittest.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..4a89111e567e3eeb837d18713715845f028ac0dd
--- /dev/null
+++ b/third_party/crazy_linker/crazy_linker/src/crazy_linker_ashmem_unittest.cpp
@@ -0,0 +1,38 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "crazy_linker_ashmem.h"
+
+#include <sys/mman.h>
+
+#include <minitest/minitest.h>
+
+namespace crazy {
+
+TEST(AshmemRegion, Construction) {
+ AshmemRegion region;
+ EXPECT_EQ(-1, region.fd());
+}
+
+TEST(AshmemRegion, Allocate) {
+ AshmemRegion region;
+ const size_t kSize = 4096 * 10;
+ EXPECT_TRUE(region.Allocate(kSize, __FUNCTION__));
+ void* map = ::mmap(NULL,
+ kSize,
+ PROT_READ | PROT_WRITE,
+ MAP_ANONYMOUS | MAP_SHARED,
+ region.fd(),
+ 0);
+ EXPECT_NE(MAP_FAILED, map);
+
+ for (size_t n = 0; n < kSize; ++n) {
+ TEST_TEXT << "Checking region[" << n << "]";
+ EXPECT_EQ(0, ((char*)map)[n]);
+ }
+
+ EXPECT_EQ(0, ::munmap(map, kSize));
+}
+
+} // namespace crazy

Powered by Google App Engine
This is Rietveld 408576698