WIP(crashpad): minidump_test builds, links, and runs

Change-Id: I4b0c17511577911881873efd34f3cc069092797e
diff --git a/secondary/third_party/crashpad/crashpad/minidump/BUILD.gn b/secondary/third_party/crashpad/crashpad/minidump/BUILD.gn
index a57867d..8368bd1 100644
--- a/secondary/third_party/crashpad/crashpad/minidump/BUILD.gn
+++ b/secondary/third_party/crashpad/crashpad/minidump/BUILD.gn
@@ -69,3 +69,72 @@
     "minidump_writer_util.h",
   ]
 }
+
+static_library("test_lib") {
+  testonly = true
+
+  deps = [
+    ":minidump",
+    "../compat",
+    "../third_party/gtest",
+    "//third_party/mini_chromium/base",
+  ]
+
+  include_dirs = [ ".." ]
+
+  sources = [
+    "test/minidump_context_test_util.cc",
+    "test/minidump_context_test_util.h",
+    "test/minidump_file_writer_test_util.cc",
+    "test/minidump_file_writer_test_util.h",
+    "test/minidump_memory_writer_test_util.cc",
+    "test/minidump_memory_writer_test_util.h",
+    "test/minidump_rva_list_test_util.cc",
+    "test/minidump_rva_list_test_util.h",
+    "test/minidump_string_writer_test_util.cc",
+    "test/minidump_string_writer_test_util.h",
+    "test/minidump_user_extension_stream_util.cc",
+    "test/minidump_user_extension_stream_util.h",
+    "test/minidump_writable_test_util.cc",
+    "test/minidump_writable_test_util.h",
+  ]
+}
+
+executable("minidump_test") {
+  testonly = true
+
+  deps = [
+    "../third_party/gtest",
+    "../snapshot:test_lib",
+    "../test",
+    "../test:gtest_main",
+    "../util",
+    "//third_party/mini_chromium/base",
+    ":minidump",
+    ":test_lib",
+  ]
+
+  include_dirs = [ ".." ]
+
+  sources = [
+    "minidump_context_writer_test.cc",
+    "minidump_crashpad_info_writer_test.cc",
+    "minidump_exception_writer_test.cc",
+    "minidump_file_writer_test.cc",
+    "minidump_handle_writer_test.cc",
+    "minidump_memory_info_writer_test.cc",
+    "minidump_memory_writer_test.cc",
+    "minidump_misc_info_writer_test.cc",
+    "minidump_module_crashpad_info_writer_test.cc",
+    "minidump_module_writer_test.cc",
+    "minidump_rva_list_writer_test.cc",
+    "minidump_simple_string_dictionary_writer_test.cc",
+    "minidump_string_writer_test.cc",
+    "minidump_system_info_writer_test.cc",
+    "minidump_thread_id_map_test.cc",
+    "minidump_thread_writer_test.cc",
+    "minidump_unloaded_module_writer_test.cc",
+    "minidump_user_stream_writer_test.cc",
+    "minidump_writable_test.cc",
+  ]
+}
diff --git a/secondary/third_party/crashpad/crashpad/snapshot/BUILD.gn b/secondary/third_party/crashpad/crashpad/snapshot/BUILD.gn
index cb94b13..8c18e8f 100644
--- a/secondary/third_party/crashpad/crashpad/snapshot/BUILD.gn
+++ b/secondary/third_party/crashpad/crashpad/snapshot/BUILD.gn
@@ -134,3 +134,35 @@
   group("snapshot_api") {
   }
 }
+
+static_library("test_lib") {
+  testonly = true
+
+  deps = [
+    ":snapshot",
+    "../compat",
+    "../util",
+    "//third_party/mini_chromium/base",
+  ]
+
+  include_dirs = [ ".." ]
+
+  sources = [
+    "test/test_cpu_context.cc",
+    "test/test_cpu_context.h",
+    "test/test_exception_snapshot.cc",
+    "test/test_exception_snapshot.h",
+    "test/test_memory_map_region_snapshot.cc",
+    "test/test_memory_map_region_snapshot.h",
+    "test/test_memory_snapshot.cc",
+    "test/test_memory_snapshot.h",
+    "test/test_module_snapshot.cc",
+    "test/test_module_snapshot.h",
+    "test/test_process_snapshot.cc",
+    "test/test_process_snapshot.h",
+    "test/test_system_snapshot.cc",
+    "test/test_system_snapshot.h",
+    "test/test_thread_snapshot.cc",
+    "test/test_thread_snapshot.h",
+  ]
+}
diff --git a/secondary/third_party/crashpad/crashpad/test/BUILD.gn b/secondary/third_party/crashpad/crashpad/test/BUILD.gn
new file mode 100644
index 0000000..9097186
--- /dev/null
+++ b/secondary/third_party/crashpad/crashpad/test/BUILD.gn
@@ -0,0 +1,71 @@
+# Copyright 2015 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.
+
+static_library("test") {
+  testonly = true
+
+  deps = [
+    "../compat",
+    "../snapshot",
+    "../util",
+    "../third_party/gtest",
+    "//third_party/mini_chromium/base",
+  ]
+
+  include_dirs = [ ".." ]
+
+  sources = [
+    "errors.cc",
+    "errors.h",
+    "file.cc",
+    "file.h",
+    "gtest_death_check.h",
+    "hex_string.cc",
+    "hex_string.h",
+#    "mac/dyld.cc",
+#    "mac/dyld.h",
+#    "mac/mach_errors.cc",
+#    "mac/mach_errors.h",
+#    "mac/mach_multiprocess.cc",
+#    "mac/mach_multiprocess.h",
+    "main_arguments.cc",
+    "main_arguments.h",
+    "multiprocess.h",
+    "multiprocess_exec.h",
+    "multiprocess_exec_posix.cc",
+#    "multiprocess_exec_win.cc",
+    "multiprocess_posix.cc",
+    "scoped_module_handle.cc",
+    "scoped_module_handle.h",
+    "scoped_temp_dir.cc",
+    "scoped_temp_dir.h",
+    "scoped_temp_dir_posix.cc",
+#    "scoped_temp_dir_win.cc",
+    "test_paths.cc",
+    "test_paths.h",
+#    "win/child_launcher.cc",
+#    "win/child_launcher.h",
+#    "win/win_child_process.cc",
+#    "win/win_child_process.h",
+#    "win/win_multiprocess.cc",
+#    "win/win_multiprocess.h",
+#    "win/win_multiprocess_with_temp_dir.cc",
+#    "win/win_multiprocess_with_temp_dir.h",
+  ]
+}
+
+static_library("gtest_main") {
+  testonly = true
+
+  deps = [
+    ":test",
+    "../third_party/gtest",
+  ]
+
+  include_dirs = [ ".." ]
+
+  sources = [
+    "gtest_main.cc",
+  ]
+}
diff --git a/secondary/third_party/crashpad/crashpad/third_party/gtest/BUILD.gn b/secondary/third_party/crashpad/crashpad/third_party/gtest/BUILD.gn
new file mode 100644
index 0000000..b078684
--- /dev/null
+++ b/secondary/third_party/crashpad/crashpad/third_party/gtest/BUILD.gn
@@ -0,0 +1,11 @@
+# Copyright 2017 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.
+
+group("gtest") {
+  testonly = true
+
+  public_deps = [
+    "//third_party/gtest",
+  ]
+}