From 7018a80b36beac71761f6187813bde71fc4e941b Mon Sep 17 00:00:00 2001 From: Vlad Tsyrklevich Date: Thu, 20 Dec 2018 09:03:05 -0800 Subject: [PATCH] Simplify test set-up Use platform independent helpers to simplify initializing a ProcessMemory object in this test. Bug: crashpad:263 Change-Id: Id0f9e006f6dbaca31453803b8c790a6832e855e5 Reviewed-on: https://chromium-review.googlesource.com/c/1387264 Reviewed-by: Mark Mentovai Commit-Queue: Vlad Tsyrklevich --- util/process/process_memory_range_test.cc | 26 ++++------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/util/process/process_memory_range_test.cc b/util/process/process_memory_range_test.cc index 19de2b10..fa2a893b 100644 --- a/util/process/process_memory_range_test.cc +++ b/util/process/process_memory_range_test.cc @@ -20,18 +20,8 @@ #include "build/build_config.h" #include "gtest/gtest.h" #include "util/misc/from_pointer_cast.h" - -#if defined(OS_FUCHSIA) -#include - -#include "util/process/process_memory_fuchsia.h" -#elif defined(OS_WIN) -#include "util/process/process_memory_win.h" -#else -#include - -#include "util/process/process_memory_linux.h" -#endif +#include "util/process/process_memory_native.h" +#include "test/process_type.h" namespace crashpad { namespace test { @@ -49,16 +39,8 @@ TEST(ProcessMemoryRange, Basic) { constexpr bool is_64_bit = false; #endif // ARCH_CPU_64_BITS -#if defined(OS_FUCHSIA) - ProcessMemoryFuchsia memory; - ASSERT_TRUE(memory.Initialize(*zx::process::self())); -#elif defined(OS_WIN) - ProcessMemoryWin memory; - ASSERT_TRUE(memory.Initialize(GetCurrentProcess())); -#elif defined(OS_LINUX) || defined(OS_ANDROID) - ProcessMemoryLinux memory; - ASSERT_TRUE(memory.Initialize(getpid())); -#endif // OS_FUCHSIA + ProcessMemoryNative memory; + ASSERT_TRUE(memory.Initialize(GetSelfProcess())); ProcessMemoryRange range; ASSERT_TRUE(range.Initialize(&memory, is_64_bit));