Include googletest cmake support.

- Same googletest release (v1.8.0), new root in third_party.
- Update Android.mk and make build (include and file locations).
- Update cmake build (use googletest's cmake support).
- Update gtest include in all tests.

BUG=https://bugs.chromium.org/p/aomedia/issues/detail?id=76

Change-Id: I5491a2ff3c8869263cd885872c815402236c20b1
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2626f2c..f324098 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -679,10 +679,6 @@
       "${AOM_ROOT}/test/av1_quantize_test.cc")
 endif ()
 
-set(AOM_GTEST_SOURCES
-    "${AOM_ROOT}/third_party/googletest/src/src/gtest-all.cc"
-    "${AOM_ROOT}/third_party/googletest/src/include/gtest/gtest.h")
-
 set(AOM_TEST_INTRA_PRED_SPEED_SOURCES
     "${AOM_CONFIG_DIR}/usage_exit.c"
     "${AOM_ROOT}/test/test_intra_pred_speed.cc")
@@ -898,10 +894,10 @@
 endif ()
 
 if (CONFIG_UNIT_TESTS)
-  include_directories("${AOM_ROOT}/third_party/googletest/src/include"
-                      "${AOM_ROOT}/third_party/googletest/src")
-
-  add_library(aom_gtest OBJECT ${AOM_GTEST_SOURCES})
+  include_directories(
+    "${AOM_ROOT}/third_party/googletest/src/googletest/src"
+    "${AOM_ROOT}/third_party/googletest/src/googletest/include")
+  add_subdirectory("${AOM_ROOT}/third_party/googletest/src/googletest")
 
   # Generate a stub file containing the C function usage_exit(); this is
   # required because of the test dependency on aom_common_app_util.
@@ -912,15 +908,13 @@
   add_executable(test_libaom ${AOM_UNIT_TEST_SOURCES}
                  $<TARGET_OBJECTS:aom_common_app_util>
                  $<TARGET_OBJECTS:aom_decoder_app_util>
-                 $<TARGET_OBJECTS:aom_encoder_app_util>
-                 $<TARGET_OBJECTS:aom_gtest>)
-  target_link_libraries(test_libaom PUBLIC aom)
+                 $<TARGET_OBJECTS:aom_encoder_app_util>)
+  target_link_libraries(test_libaom PUBLIC aom gtest)
 
   add_executable(test_intra_pred_speed
                  ${AOM_TEST_INTRA_PRED_SPEED_SOURCES}
-                 $<TARGET_OBJECTS:aom_common_app_util>
-                 $<TARGET_OBJECTS:aom_gtest>)
-  target_link_libraries(test_intra_pred_speed PUBLIC aom)
+                 $<TARGET_OBJECTS:aom_common_app_util>)
+  target_link_libraries(test_intra_pred_speed PUBLIC aom gtest)
 
   if (CONFIG_DECODE_PERF_TESTS AND CONFIG_WEBM_IO)
     target_sources(test_libaom PUBLIC ${AOM_DECODE_PERF_TEST_SOURCES})
diff --git a/libs.mk b/libs.mk
index d4a3040..f931e12 100644
--- a/libs.mk
+++ b/libs.mk
@@ -396,8 +396,7 @@
 
 ifeq ($(CONFIG_EXTERNAL_BUILD),yes)
 ifeq ($(CONFIG_MSVS),yes)
-
-gtest.$(VCPROJ_SFX): $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc
+gtest.$(VCPROJ_SFX): $(SRC_PATH_BARE)/third_party/googletest/src/googletest/src/gtest-all.cc
 	@echo "    [CREATE] $@"
 	$(qexec)$(GEN_VCPROJ) \
             --lib \
@@ -408,8 +407,10 @@
             --ver=$(CONFIG_VS_VERSION) \
             --src-path-bare="$(SRC_PATH_BARE)" \
             -D_VARIADIC_MAX=10 \
-            --out=gtest.$(VCPROJ_SFX) $(SRC_PATH_BARE)/third_party/googletest/src/src/gtest-all.cc \
-            -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" -I"$(SRC_PATH_BARE)/third_party/googletest/src"
+            --out=gtest.$(VCPROJ_SFX) \
+	    $(SRC_PATH_BARE)/third_party/googletest/src/googletest/src/gtest-all.cc \
+            -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/googletest/include" \
+	    -I"$(SRC_PATH_BARE)/third_party/googletest/src/googletest"
 
 PROJECTS-$(CONFIG_MSVS) += gtest.$(VCPROJ_SFX)
 
@@ -425,7 +426,7 @@
             --src-path-bare="$(SRC_PATH_BARE)" \
             $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
             --out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \
-            -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
+            -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/googletest/include" \
             $(if $(CONFIG_WEBM_IO),-I"$(SRC_PATH_BARE)/third_party/libwebm") \
             -L. -l$(CODEC_LIB) -l$(GTEST_LIB) $^
 
@@ -447,21 +448,21 @@
             --src-path-bare="$(SRC_PATH_BARE)" \
             $(if $(CONFIG_STATIC_MSVCRT),--static-crt) \
             --out=$@ $(INTERNAL_CFLAGS) $(CFLAGS) \
-            -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/include" \
+            -I. -I"$(SRC_PATH_BARE)/third_party/googletest/src/googletest/include" \
             -L. -l$(CODEC_LIB) -l$(GTEST_LIB) $^
 endif  # TEST_INTRA_PRED_SPEED
 endif
 else
 
 include $(SRC_PATH_BARE)/third_party/googletest/gtest.mk
-GTEST_SRCS := $(addprefix third_party/googletest/src/,$(call enabled,GTEST_SRCS))
+GTEST_SRCS := $(addprefix third_party/,$(call enabled,GTEST_SRCS))
 GTEST_OBJS=$(call objs,$(GTEST_SRCS))
 ifeq ($(filter win%,$(TGT_OS)),$(TGT_OS))
 # Disabling pthreads globally will cause issues on darwin and possibly elsewhere
 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += -DGTEST_HAS_PTHREAD=0
 endif
-GTEST_INCLUDES := -I$(SRC_PATH_BARE)/third_party/googletest/src
-GTEST_INCLUDES += -I$(SRC_PATH_BARE)/third_party/googletest/src/include
+GTEST_INCLUDES := -I$(SRC_PATH_BARE)/third_party/googletest/src/googletest
+GTEST_INCLUDES += -I$(SRC_PATH_BARE)/third_party/googletest/src/googletest/include
 $(GTEST_OBJS) $(GTEST_OBJS:.o=.d): CXXFLAGS += $(GTEST_INCLUDES)
 OBJS-yes += $(GTEST_OBJS)
 LIBS-yes += $(BUILD_PFX)libgtest.a $(BUILD_PFX)libgtest_g.a
diff --git a/test/accounting_test.cc b/test/accounting_test.cc
index b4f7684..e8387d0 100644
--- a/test/accounting_test.cc
+++ b/test/accounting_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "test/acm_random.h"
 #include "aom/aom_integer.h"
diff --git a/test/acm_random.h b/test/acm_random.h
index eb2353d..4842345 100644
--- a/test/acm_random.h
+++ b/test/acm_random.h
@@ -12,7 +12,7 @@
 #ifndef TEST_ACM_RANDOM_H_
 #define TEST_ACM_RANDOM_H_
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "aom/aom_integer.h"
 
diff --git a/test/active_map_refresh_test.cc b/test/active_map_refresh_test.cc
index 161dc73..7ee86e7 100644
--- a/test/active_map_refresh_test.cc
+++ b/test/active_map_refresh_test.cc
@@ -10,7 +10,7 @@
 */
 
 #include <algorithm>
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/util.h"
diff --git a/test/active_map_test.cc b/test/active_map_test.cc
index 2d30480..a926b0f 100644
--- a/test/active_map_test.cc
+++ b/test/active_map_test.cc
@@ -11,7 +11,7 @@
 
 #include <climits>
 #include <vector>
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/i420_video_source.h"
diff --git a/test/altref_test.cc b/test/altref_test.cc
index be9b774..6dd8b51 100644
--- a/test/altref_test.cc
+++ b/test/altref_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/i420_video_source.h"
diff --git a/test/android/Android.mk b/test/android/Android.mk
index 9ad2a34..74f9d7c 100644
--- a/test/android/Android.mk
+++ b/test/android/Android.mk
@@ -32,9 +32,9 @@
 LOCAL_ARM_MODE := arm
 LOCAL_CPP_EXTENSION := .cc
 LOCAL_MODULE := gtest
-LOCAL_C_INCLUDES := $(LOCAL_PATH)/third_party/googletest/src/
-LOCAL_C_INCLUDES += $(LOCAL_PATH)/third_party/googletest/src/include/
-LOCAL_SRC_FILES := ./third_party/googletest/src/src/gtest-all.cc
+LOCAL_C_INCLUDES := $(LOCAL_PATH)/third_party/googletest/src/googletest/src
+LOCAL_C_INCLUDES += $(LOCAL_PATH)/third_party/googletest/src/googletest/include
+LOCAL_SRC_FILES := ./third_party/googletest/src/googletest/src/gtest-all.cc
 include $(BUILD_STATIC_LIBRARY)
 
 #libaom_test
diff --git a/test/ans_codec_test.cc b/test/ans_codec_test.cc
index 0b1650e..a1b25fb 100644
--- a/test/ans_codec_test.cc
+++ b/test/ans_codec_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
diff --git a/test/ans_test.cc b/test/ans_test.cc
index 585773f..2e513ea 100644
--- a/test/ans_test.cc
+++ b/test/ans_test.cc
@@ -16,7 +16,7 @@
 #include <utility>
 #include <vector>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "test/acm_random.h"
 #include "aom_dsp/ansreader.h"
diff --git a/test/aq_segment_test.cc b/test/aq_segment_test.cc
index e231b4e..a9bad82 100644
--- a/test/aq_segment_test.cc
+++ b/test/aq_segment_test.cc
@@ -10,7 +10,7 @@
 */
 
 #include "./aom_config.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/i420_video_source.h"
diff --git a/test/arf_freq_test.cc b/test/arf_freq_test.cc
index 3666697..cafd8e3 100644
--- a/test/arf_freq_test.cc
+++ b/test/arf_freq_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
diff --git a/test/av1_convolve_optimz_test.cc b/test/av1_convolve_optimz_test.cc
index a4bb7e7..6265c68 100644
--- a/test/av1_convolve_optimz_test.cc
+++ b/test/av1_convolve_optimz_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "test/acm_random.h"
diff --git a/test/av1_convolve_test.cc b/test/av1_convolve_test.cc
index 6de8539..225b29d 100644
--- a/test/av1_convolve_test.cc
+++ b/test/av1_convolve_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/av1_dct_test.cc b/test/av1_dct_test.cc
index defecb2..691cc8b 100644
--- a/test/av1_dct_test.cc
+++ b/test/av1_dct_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <new>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/acm_random.h"
 #include "test/util.h"
 #include "./aom_config.h"
diff --git a/test/av1_ext_tile_test.cc b/test/av1_ext_tile_test.cc
index 679a6ed..cf70734 100644
--- a/test/av1_ext_tile_test.cc
+++ b/test/av1_ext_tile_test.cc
@@ -12,7 +12,7 @@
 #include <assert.h>
 #include <string>
 #include <vector>
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/i420_video_source.h"
diff --git a/test/av1_fht16x16_test.cc b/test/av1_fht16x16_test.cc
index a776618..0eee35b 100644
--- a/test/av1_fht16x16_test.cc
+++ b/test/av1_fht16x16_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/av1_fht16x32_test.cc b/test/av1_fht16x32_test.cc
index aea3024..43d0253 100644
--- a/test/av1_fht16x32_test.cc
+++ b/test/av1_fht16x32_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_dsp_rtcd.h"
 #include "./av1_rtcd.h"
diff --git a/test/av1_fht16x8_test.cc b/test/av1_fht16x8_test.cc
index e0fbb95..d99bec5 100644
--- a/test/av1_fht16x8_test.cc
+++ b/test/av1_fht16x8_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_dsp_rtcd.h"
 #include "./av1_rtcd.h"
diff --git a/test/av1_fht32x16_test.cc b/test/av1_fht32x16_test.cc
index ae7f0be86..e38283f 100644
--- a/test/av1_fht32x16_test.cc
+++ b/test/av1_fht32x16_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_dsp_rtcd.h"
 #include "./av1_rtcd.h"
diff --git a/test/av1_fht4x4_test.cc b/test/av1_fht4x4_test.cc
index 913add4..611b867 100644
--- a/test/av1_fht4x4_test.cc
+++ b/test/av1_fht4x4_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/av1_fht4x8_test.cc b/test/av1_fht4x8_test.cc
index ddb2929..a899c87 100644
--- a/test/av1_fht4x8_test.cc
+++ b/test/av1_fht4x8_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_dsp_rtcd.h"
 #include "./av1_rtcd.h"
diff --git a/test/av1_fht8x16_test.cc b/test/av1_fht8x16_test.cc
index 9e92913..601fa32 100644
--- a/test/av1_fht8x16_test.cc
+++ b/test/av1_fht8x16_test.cc
@@ -8,7 +8,7 @@
  * Media Patent License 1.0 was not distributed with this source code in the
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_dsp_rtcd.h"
 #include "./av1_rtcd.h"
diff --git a/test/av1_fht8x4_test.cc b/test/av1_fht8x4_test.cc
index dc63c0b..9bf4ff6 100644
--- a/test/av1_fht8x4_test.cc
+++ b/test/av1_fht8x4_test.cc
@@ -8,7 +8,7 @@
  * Media Patent License 1.0 was not distributed with this source code in the
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_dsp_rtcd.h"
 #include "./av1_rtcd.h"
diff --git a/test/av1_fht8x8_test.cc b/test/av1_fht8x8_test.cc
index 90a7e44..29ca004 100644
--- a/test/av1_fht8x8_test.cc
+++ b/test/av1_fht8x8_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/av1_highbd_iht_test.cc b/test/av1_highbd_iht_test.cc
index 94d178d..422cca5 100644
--- a/test/av1_highbd_iht_test.cc
+++ b/test/av1_highbd_iht_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "test/acm_random.h"
diff --git a/test/av1_inv_txfm_test.cc b/test/av1_inv_txfm_test.cc
index f5b33d2..af3fee8 100644
--- a/test/av1_inv_txfm_test.cc
+++ b/test/av1_inv_txfm_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/av1_quantize_test.cc b/test/av1_quantize_test.cc
index 667b558..43acd6f 100644
--- a/test/av1_quantize_test.cc
+++ b/test/av1_quantize_test.cc
@@ -10,7 +10,7 @@
  */
 #include <stdlib.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "./av1_rtcd.h"
diff --git a/test/av1_txfm_test.h b/test/av1_txfm_test.h
index b786665..a62d060 100644
--- a/test/av1_txfm_test.h
+++ b/test/av1_txfm_test.h
@@ -19,7 +19,7 @@
 #endif
 #include <math.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "test/acm_random.h"
 #include "av1/common/enums.h"
diff --git a/test/av1_wedge_utils_test.cc b/test/av1_wedge_utils_test.cc
index 52b9fc0..d4b560f 100644
--- a/test/av1_wedge_utils_test.cc
+++ b/test/av1_wedge_utils_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 
diff --git a/test/avg_test.cc b/test/avg_test.cc
index b7a707d..529672d 100644
--- a/test/avg_test.cc
+++ b/test/avg_test.cc
@@ -13,7 +13,7 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/blend_a64_mask_1d_test.cc b/test/blend_a64_mask_1d_test.cc
index 684cbed..25a22e5 100644
--- a/test/blend_a64_mask_1d_test.cc
+++ b/test/blend_a64_mask_1d_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/register_state_check.h"
 #include "test/function_equivalence_test.h"
 
diff --git a/test/blend_a64_mask_test.cc b/test/blend_a64_mask_test.cc
index 0cfee2e..21c3721 100644
--- a/test/blend_a64_mask_test.cc
+++ b/test/blend_a64_mask_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/register_state_check.h"
 #include "test/function_equivalence_test.h"
 
diff --git a/test/boolcoder_test.cc b/test/boolcoder_test.cc
index c6a3288..4d9d7aa 100644
--- a/test/boolcoder_test.cc
+++ b/test/boolcoder_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "test/acm_random.h"
 #include "aom/aom_integer.h"
diff --git a/test/borders_test.cc b/test/borders_test.cc
index 16830b4..076f914 100644
--- a/test/borders_test.cc
+++ b/test/borders_test.cc
@@ -11,7 +11,7 @@
 
 #include <climits>
 #include <vector>
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/i420_video_source.h"
diff --git a/test/clpf_test.cc b/test/clpf_test.cc
index 8d6dd75..dfcde50 100644
--- a/test/clpf_test.cc
+++ b/test/clpf_test.cc
@@ -12,7 +12,7 @@
 #include <cstdlib>
 #include <string>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/convolve_test.cc b/test/convolve_test.cc
index 12af4fd..62749a0 100644
--- a/test/convolve_test.cc
+++ b/test/convolve_test.cc
@@ -11,7 +11,7 @@
 
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/cpu_speed_test.cc b/test/cpu_speed_test.cc
index 558068e..9b79664 100644
--- a/test/cpu_speed_test.cc
+++ b/test/cpu_speed_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/i420_video_source.h"
diff --git a/test/datarate_test.cc b/test/datarate_test.cc
index ec86604..48be4a4 100644
--- a/test/datarate_test.cc
+++ b/test/datarate_test.cc
@@ -10,7 +10,7 @@
 */
 
 #include "./aom_config.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/i420_video_source.h"
diff --git a/test/dct16x16_test.cc b/test/dct16x16_test.cc
index 9928b0c..0fba26c 100644
--- a/test/dct16x16_test.cc
+++ b/test/dct16x16_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/dct32x32_test.cc b/test/dct32x32_test.cc
index cb2fbd5..a9c4c0b 100644
--- a/test/dct32x32_test.cc
+++ b/test/dct32x32_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "./aom_config.h"
diff --git a/test/decode_api_test.cc b/test/decode_api_test.cc
index d62fced..6bd72a4 100644
--- a/test/decode_api_test.cc
+++ b/test/decode_api_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "test/ivf_video_source.h"
diff --git a/test/decode_test_driver.cc b/test/decode_test_driver.cc
index 7adb9d6..782f58e 100644
--- a/test/decode_test_driver.cc
+++ b/test/decode_test_driver.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "test/codec_factory.h"
 #include "test/decode_test_driver.h"
diff --git a/test/decode_test_driver.h b/test/decode_test_driver.h
index b8f8d1a..153ff5d 100644
--- a/test/decode_test_driver.h
+++ b/test/decode_test_driver.h
@@ -12,7 +12,7 @@
 #ifndef TEST_DECODE_TEST_DRIVER_H_
 #define TEST_DECODE_TEST_DRIVER_H_
 #include <cstring>
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "./aom_config.h"
 #include "aom/aom_decoder.h"
 
diff --git a/test/divu_small_test.cc b/test/divu_small_test.cc
index d3a134a..064f8ee 100644
--- a/test/divu_small_test.cc
+++ b/test/divu_small_test.cc
@@ -11,7 +11,7 @@
 
 #include <stdlib.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "test/acm_random.h"
 #include "av1/common/odintrin.h"
diff --git a/test/encode_api_test.cc b/test/encode_api_test.cc
index 49fac27..14e43c8 100644
--- a/test/encode_api_test.cc
+++ b/test/encode_api_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "aom/aomcx.h"
diff --git a/test/encode_perf_test.cc b/test/encode_perf_test.cc
index 732e2a1..e2a4f2b 100644
--- a/test/encode_perf_test.cc
+++ b/test/encode_perf_test.cc
@@ -10,7 +10,7 @@
 */
 
 #include <string>
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "./aom_config.h"
 #include "./aom_version.h"
 #include "test/codec_factory.h"
diff --git a/test/encode_test_driver.cc b/test/encode_test_driver.cc
index 092e669..626ca52 100644
--- a/test/encode_test_driver.cc
+++ b/test/encode_test_driver.cc
@@ -11,7 +11,7 @@
 
 #include <string>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "aom_ports/mem.h"
diff --git a/test/encode_test_driver.h b/test/encode_test_driver.h
index 45a080e..5de949d 100644
--- a/test/encode_test_driver.h
+++ b/test/encode_test_driver.h
@@ -14,7 +14,7 @@
 #include <string>
 #include <vector>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #if CONFIG_AV1_ENCODER
diff --git a/test/encoder_parms_get_to_decoder.cc b/test/encoder_parms_get_to_decoder.cc
index 8d8e2b2..4c04869 100644
--- a/test/encoder_parms_get_to_decoder.cc
+++ b/test/encoder_parms_get_to_decoder.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
diff --git a/test/end_to_end_test.cc b/test/end_to_end_test.cc
index e9e7d42..9769d6e 100644
--- a/test/end_to_end_test.cc
+++ b/test/end_to_end_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
diff --git a/test/error_block_test.cc b/test/error_block_test.cc
index 3de35c7..1c98557 100644
--- a/test/error_block_test.cc
+++ b/test/error_block_test.cc
@@ -13,7 +13,7 @@
 #include <cstdlib>
 #include <string>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "./av1_rtcd.h"
diff --git a/test/error_resilience_test.cc b/test/error_resilience_test.cc
index 07b6039..63f1001 100644
--- a/test/error_resilience_test.cc
+++ b/test/error_resilience_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/i420_video_source.h"
diff --git a/test/ethread_test.cc b/test/ethread_test.cc
index 5ea73f6..5b519f8 100644
--- a/test/ethread_test.cc
+++ b/test/ethread_test.cc
@@ -11,7 +11,7 @@
 
 #include <string>
 #include <vector>
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/md5_helper.h"
diff --git a/test/fdct4x4_test.cc b/test/fdct4x4_test.cc
index c22abb5e..b191a97 100644
--- a/test/fdct4x4_test.cc
+++ b/test/fdct4x4_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/fdct8x8_test.cc b/test/fdct8x8_test.cc
index bbfb7f1..61d8da3 100644
--- a/test/fdct8x8_test.cc
+++ b/test/fdct8x8_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/fht32x32_test.cc b/test/fht32x32_test.cc
index 039a9ec..160bd5b 100644
--- a/test/fht32x32_test.cc
+++ b/test/fht32x32_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/filterintra_predictors_test.cc b/test/filterintra_predictors_test.cc
index d09b63d..d722f53 100644
--- a/test/filterintra_predictors_test.cc
+++ b/test/filterintra_predictors_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "test/acm_random.h"
diff --git a/test/frame_size_tests.cc b/test/frame_size_tests.cc
index 843c68b..1b58fec 100644
--- a/test/frame_size_tests.cc
+++ b/test/frame_size_tests.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/video_source.h"
 
diff --git a/test/function_equivalence_test.h b/test/function_equivalence_test.h
index 472d4ce..4b22c74 100644
--- a/test/function_equivalence_test.h
+++ b/test/function_equivalence_test.h
@@ -12,7 +12,7 @@
 #ifndef TEST_FUNCTION_EQUIVALENCE_TEST_H_
 #define TEST_FUNCTION_EQUIVALENCE_TEST_H_
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/acm_random.h"
 #include "test/clear_system_state.h"
 #include "test/util.h"
diff --git a/test/hadamard_test.cc b/test/hadamard_test.cc
index 792e0ab..db5cb74 100644
--- a/test/hadamard_test.cc
+++ b/test/hadamard_test.cc
@@ -11,7 +11,7 @@
 
 #include <algorithm>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_dsp_rtcd.h"
 
diff --git a/test/hbd_metrics_test.cc b/test/hbd_metrics_test.cc
index 455e180..4def53b 100644
--- a/test/hbd_metrics_test.cc
+++ b/test/hbd_metrics_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <new>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/acm_random.h"
 #include "test/util.h"
 #include "./aom_config.h"
diff --git a/test/idct8x8_test.cc b/test/idct8x8_test.cc
index ff43464..f99a407 100644
--- a/test/idct8x8_test.cc
+++ b/test/idct8x8_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_dsp_rtcd.h"
 #include "test/acm_random.h"
diff --git a/test/idct_test.cc b/test/idct_test.cc
index 009f4b0..a880a91 100644
--- a/test/idct_test.cc
+++ b/test/idct_test.cc
@@ -12,7 +12,7 @@
 #include "./aom_config.h"
 #include "./aom_rtcd.h"
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "test/clear_system_state.h"
 #include "test/register_state_check.h"
diff --git a/test/intrapred_test.cc b/test/intrapred_test.cc
index 12eabcf..e3bd763 100644
--- a/test/intrapred_test.cc
+++ b/test/intrapred_test.cc
@@ -11,7 +11,7 @@
 
 #include <string>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/level_test.cc b/test/level_test.cc
index af63556..1049d49 100644
--- a/test/level_test.cc
+++ b/test/level_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/i420_video_source.h"
diff --git a/test/lossless_test.cc b/test/lossless_test.cc
index 9fd5bea..5c5b32d 100644
--- a/test/lossless_test.cc
+++ b/test/lossless_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "test/codec_factory.h"
diff --git a/test/lpf_8_test.cc b/test/lpf_8_test.cc
index dfaaed5..be6afbf 100644
--- a/test/lpf_8_test.cc
+++ b/test/lpf_8_test.cc
@@ -13,7 +13,7 @@
 #include <cstdlib>
 #include <string>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/masked_sad_test.cc b/test/masked_sad_test.cc
index 95b4544..996f912 100644
--- a/test/masked_sad_test.cc
+++ b/test/masked_sad_test.cc
@@ -12,7 +12,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/acm_random.h"
 #include "test/clear_system_state.h"
 #include "test/register_state_check.h"
diff --git a/test/masked_variance_test.cc b/test/masked_variance_test.cc
index cecaf27..8515c7e 100644
--- a/test/masked_variance_test.cc
+++ b/test/masked_variance_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/acm_random.h"
 #include "test/clear_system_state.h"
 #include "test/register_state_check.h"
diff --git a/test/minmax_test.cc b/test/minmax_test.cc
index 8613f4b..f825291 100644
--- a/test/minmax_test.cc
+++ b/test/minmax_test.cc
@@ -12,7 +12,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_dsp_rtcd.h"
 #include "aom/aom_integer.h"
diff --git a/test/obmc_sad_test.cc b/test/obmc_sad_test.cc
index 1814cdd..811c35b 100644
--- a/test/obmc_sad_test.cc
+++ b/test/obmc_sad_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "test/function_equivalence_test.h"
 #include "test/register_state_check.h"
diff --git a/test/obmc_variance_test.cc b/test/obmc_variance_test.cc
index 41e399a..777e8f3 100644
--- a/test/obmc_variance_test.cc
+++ b/test/obmc_variance_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/acm_random.h"
 
 #include "test/function_equivalence_test.h"
diff --git a/test/partial_idct_test.cc b/test/partial_idct_test.cc
index 7eedfaf..22750c3 100644
--- a/test/partial_idct_test.cc
+++ b/test/partial_idct_test.cc
@@ -13,7 +13,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/quantize_test.cc b/test/quantize_test.cc
index 4908e99..4f61484 100644
--- a/test/quantize_test.cc
+++ b/test/quantize_test.cc
@@ -11,7 +11,7 @@
 
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "test/acm_random.h"
diff --git a/test/realtime_test.cc b/test/realtime_test.cc
index f6f3f52..ffe4a31 100644
--- a/test/realtime_test.cc
+++ b/test/realtime_test.cc
@@ -13,7 +13,7 @@
 #include "test/encode_test_driver.h"
 #include "test/util.h"
 #include "test/video_source.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 namespace {
 
diff --git a/test/register_state_check.h b/test/register_state_check.h
index 3ff41d1..3308201 100644
--- a/test/register_state_check.h
+++ b/test/register_state_check.h
@@ -12,7 +12,7 @@
 #ifndef TEST_REGISTER_STATE_CHECK_H_
 #define TEST_REGISTER_STATE_CHECK_H_
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "./aom_config.h"
 #include "aom/aom_integer.h"
 
diff --git a/test/resize_test.cc b/test/resize_test.cc
index 9cee841..9932e99 100644
--- a/test/resize_test.cc
+++ b/test/resize_test.cc
@@ -11,7 +11,7 @@
 
 #include <climits>
 #include <vector>
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/i420_video_source.h"
diff --git a/test/sad_test.cc b/test/sad_test.cc
index bacf539..ef637fb 100644
--- a/test/sad_test.cc
+++ b/test/sad_test.cc
@@ -13,7 +13,7 @@
 #include <limits.h>
 #include <stdio.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/scan_test.cc b/test/scan_test.cc
index 5724883..16c831c 100644
--- a/test/scan_test.cc
+++ b/test/scan_test.cc
@@ -11,7 +11,7 @@
 
 #include "av1/common/common_data.h"
 #include "av1/common/scan.h"
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 namespace {
 
diff --git a/test/simd_impl.h b/test/simd_impl.h
index 26a8c67..dd09c88 100644
--- a/test/simd_impl.h
+++ b/test/simd_impl.h
@@ -10,7 +10,7 @@
 */
 
 #define SIMD_CHECK 1
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/clear_system_state.h"
 #include "test/register_state_check.h"
 #include "aom_dsp/aom_simd_inline.h"
diff --git a/test/subtract_test.cc b/test/subtract_test.cc
index d1b5186..202594c 100644
--- a/test/subtract_test.cc
+++ b/test/subtract_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
 */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/sum_squares_test.cc b/test/sum_squares_test.cc
index 943b28f..5f23a99 100644
--- a/test/sum_squares_test.cc
+++ b/test/sum_squares_test.cc
@@ -13,7 +13,7 @@
 #include <cstdlib>
 #include <string>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/superframe_test.cc b/test/superframe_test.cc
index e9b7826..0f54bae 100644
--- a/test/superframe_test.cc
+++ b/test/superframe_test.cc
@@ -10,7 +10,7 @@
 */
 
 #include <climits>
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/i420_video_source.h"
diff --git a/test/test_intra_pred_speed.cc b/test/test_intra_pred_speed.cc
index ce4b3c1..5c8c554 100644
--- a/test/test_intra_pred_speed.cc
+++ b/test/test_intra_pred_speed.cc
@@ -14,7 +14,7 @@
 #include <stdio.h>
 #include <string.h>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_dsp_rtcd.h"
 #include "test/acm_random.h"
diff --git a/test/test_libaom.cc b/test/test_libaom.cc
index 745ee63..6d83ce6 100644
--- a/test/test_libaom.cc
+++ b/test/test_libaom.cc
@@ -11,7 +11,7 @@
 
 #include <string>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #if ARCH_X86 || ARCH_X86_64
diff --git a/test/tile_independence_test.cc b/test/tile_independence_test.cc
index f5f8436..a98faff 100644
--- a/test/tile_independence_test.cc
+++ b/test/tile_independence_test.cc
@@ -12,7 +12,7 @@
 #include <cstdio>
 #include <cstdlib>
 #include <string>
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "test/codec_factory.h"
 #include "test/encode_test_driver.h"
 #include "test/i420_video_source.h"
diff --git a/test/user_priv_test.cc b/test/user_priv_test.cc
index 11657fb..3052b27 100644
--- a/test/user_priv_test.cc
+++ b/test/user_priv_test.cc
@@ -12,7 +12,7 @@
 #include <cstdio>
 #include <cstdlib>
 #include <string>
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "./aom_config.h"
 #include "test/acm_random.h"
 #include "test/codec_factory.h"
diff --git a/test/util.h b/test/util.h
index f63fda1..a20fab6 100644
--- a/test/util.h
+++ b/test/util.h
@@ -14,7 +14,7 @@
 
 #include <stdio.h>
 #include <math.h>
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 #include "aom/aom_image.h"
 
 // Macros
diff --git a/test/variance_test.cc b/test/variance_test.cc
index 7848e20..2ae9bd9 100644
--- a/test/variance_test.cc
+++ b/test/variance_test.cc
@@ -12,7 +12,7 @@
 #include <cstdlib>
 #include <new>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/warp_filter_test.cc b/test/warp_filter_test.cc
index 7e7aba6..9dfee61 100644
--- a/test/warp_filter_test.cc
+++ b/test/warp_filter_test.cc
@@ -9,7 +9,7 @@
  * PATENTS file, you can obtain it at www.aomedia.org/license/patent.
  */
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./av1_rtcd.h"
 #include "./aom_dsp_rtcd.h"
diff --git a/test/y4m_test.cc b/test/y4m_test.cc
index c4755f7..fc9fff5 100644
--- a/test/y4m_test.cc
+++ b/test/y4m_test.cc
@@ -11,7 +11,7 @@
 
 #include <string>
 
-#include "third_party/googletest/src/include/gtest/gtest.h"
+#include "third_party/googletest/src/googletest/include/gtest/gtest.h"
 
 #include "./aom_config.h"
 #include "./y4menc.h"
diff --git a/third_party/googletest/gtest.mk b/third_party/googletest/gtest.mk
index 0de3113..fc4dbdc 100644
--- a/third_party/googletest/gtest.mk
+++ b/third_party/googletest/gtest.mk
@@ -1 +1 @@
-GTEST_SRCS-yes += src/gtest-all.cc 
+GTEST_SRCS-yes += googletest/src/googletest/src/gtest-all.cc
diff --git a/third_party/googletest/src/.gitignore b/third_party/googletest/src/.gitignore
new file mode 100644
index 0000000..ce310bc
--- /dev/null
+++ b/third_party/googletest/src/.gitignore
@@ -0,0 +1,2 @@
+# Ignore CI build directory
+build/
diff --git a/third_party/googletest/src/.travis.yml b/third_party/googletest/src/.travis.yml
new file mode 100644
index 0000000..3204dfa
--- /dev/null
+++ b/third_party/googletest/src/.travis.yml
@@ -0,0 +1,46 @@
+# Build matrix / environment variable are explained on:
+# http://about.travis-ci.org/docs/user/build-configuration/
+# This file can be validated on:
+# http://lint.travis-ci.org/
+
+install:
+# /usr/bin/gcc is 4.6 always, but gcc-X.Y is available.
+- if [ "$CXX" = "g++" ]; then export CXX="g++-4.9" CC="gcc-4.9"; fi
+# /usr/bin/clang is 3.4, lets override with modern one.
+- if [ "$CXX" = "clang++" ] && [ "$TRAVIS_OS_NAME" = "linux" ]; then export CXX="clang++-3.7" CC="clang-3.7"; fi
+- echo ${PATH}
+- echo ${CXX}
+- ${CXX} --version
+- ${CXX} -v
+addons:
+  apt:
+    # List of whitelisted in travis packages for ubuntu-precise can be found here:
+    #   https://github.com/travis-ci/apt-package-whitelist/blob/master/ubuntu-precise
+    # List of whitelisted in travis apt-sources:
+    #   https://github.com/travis-ci/apt-source-whitelist/blob/master/ubuntu.json
+    sources:
+    - ubuntu-toolchain-r-test
+    - llvm-toolchain-precise-3.7
+    packages:
+    - gcc-4.9
+    - g++-4.9
+    - clang-3.7
+    - valgrind
+os:
+  - linux
+  - osx
+language: cpp
+compiler:
+  - gcc
+  - clang
+script: ./travis.sh
+env:
+  matrix:
+    - GTEST_TARGET=googletest SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug   VERBOSE_MAKE=true VERBOSE
+    - GTEST_TARGET=googlemock SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug   VERBOSE_MAKE=true VERBOSE
+    - GTEST_TARGET=googlemock SHARED_LIB=OFF STATIC_LIB=ON CMAKE_PKG=OFF BUILD_TYPE=debug CXX_FLAGS=-std=c++11  VERBOSE_MAKE=true VERBOSE
+#    - GTEST_TARGET=googletest SHARED_LIB=ON  STATIC_LIB=ON CMAKE_PKG=ON  BUILD_TYPE=release VERBOSE_MAKE=false
+#    - GTEST_TARGET=googlemock SHARED_LIB=ON  STATIC_LIB=ON CMAKE_PKG=ON  BUILD_TYPE=release VERBOSE_MAKE=false
+notifications:
+  email: false
+sudo: false
diff --git a/third_party/googletest/src/googletest/.gitignore b/third_party/googletest/src/googletest/.gitignore
new file mode 100644
index 0000000..4b7be4b
--- /dev/null
+++ b/third_party/googletest/src/googletest/.gitignore
@@ -0,0 +1,2 @@
+# python
+*.pyc
diff --git a/third_party/googletest/src/CHANGES b/third_party/googletest/src/googletest/CHANGES
similarity index 100%
rename from third_party/googletest/src/CHANGES
rename to third_party/googletest/src/googletest/CHANGES
diff --git a/third_party/googletest/src/googletest/CMakeLists.txt b/third_party/googletest/src/googletest/CMakeLists.txt
new file mode 100644
index 0000000..621d0f0
--- /dev/null
+++ b/third_party/googletest/src/googletest/CMakeLists.txt
@@ -0,0 +1,286 @@
+########################################################################
+# CMake build script for Google Test.
+#
+# To run the tests for Google Test itself on Linux, use 'make test' or
+# ctest.  You can select which tests to run using 'ctest -R regex'.
+# For more options, run 'ctest --help'.
+
+# BUILD_SHARED_LIBS is a standard CMake variable, but we declare it here to
+# make it prominent in the GUI.
+option(BUILD_SHARED_LIBS "Build shared libraries (DLLs)." OFF)
+
+# When other libraries are using a shared version of runtime libraries,
+# Google Test also has to use one.
+option(
+  gtest_force_shared_crt
+  "Use shared (DLL) run-time lib even when Google Test is built as static lib."
+  OFF)
+
+option(gtest_build_tests "Build all of gtest's own tests." OFF)
+
+option(gtest_build_samples "Build gtest's sample programs." OFF)
+
+option(gtest_disable_pthreads "Disable uses of pthreads in gtest." OFF)
+
+option(
+  gtest_hide_internal_symbols
+  "Build gtest with internal symbols hidden in shared libraries."
+  OFF)
+
+# Defines pre_project_set_up_hermetic_build() and set_up_hermetic_build().
+include(cmake/hermetic_build.cmake OPTIONAL)
+
+if (COMMAND pre_project_set_up_hermetic_build)
+  pre_project_set_up_hermetic_build()
+endif()
+
+########################################################################
+#
+# Project-wide settings
+
+# Name of the project.
+#
+# CMake files in this project can refer to the root source directory
+# as ${gtest_SOURCE_DIR} and to the root binary directory as
+# ${gtest_BINARY_DIR}.
+# Language "C" is required for find_package(Threads).
+project(gtest CXX C)
+cmake_minimum_required(VERSION 2.6.2)
+
+if (COMMAND set_up_hermetic_build)
+  set_up_hermetic_build()
+endif()
+
+if (gtest_hide_internal_symbols)
+  set(CMAKE_CXX_VISIBILITY_PRESET hidden)
+  set(CMAKE_VISIBILITY_INLINES_HIDDEN 1)
+endif()
+
+# Define helper functions and macros used by Google Test.
+include(cmake/internal_utils.cmake)
+
+config_compiler_and_linker()  # Defined in internal_utils.cmake.
+
+# Where Google Test's .h files can be found.
+include_directories(
+  ${gtest_SOURCE_DIR}/include
+  ${gtest_SOURCE_DIR})
+
+# Where Google Test's libraries can be found.
+link_directories(${gtest_BINARY_DIR}/src)
+
+# Summary of tuple support for Microsoft Visual Studio:
+# Compiler    version(MS)  version(cmake)  Support
+# ----------  -----------  --------------  -----------------------------
+# <= VS 2010  <= 10        <= 1600         Use Google Tests's own tuple.
+# VS 2012     11           1700            std::tr1::tuple + _VARIADIC_MAX=10
+# VS 2013     12           1800            std::tr1::tuple
+if (MSVC AND MSVC_VERSION EQUAL 1700)
+  add_definitions(/D _VARIADIC_MAX=10)
+endif()
+
+########################################################################
+#
+# Defines the gtest & gtest_main libraries.  User tests should link
+# with one of them.
+
+# Google Test libraries.  We build them using more strict warnings than what
+# are used for other targets, to ensure that gtest can be compiled by a user
+# aggressive about warnings.
+cxx_library(gtest "${cxx_strict}" src/gtest-all.cc)
+cxx_library(gtest_main "${cxx_strict}" src/gtest_main.cc)
+target_link_libraries(gtest_main gtest)
+
+# If the CMake version supports it, attach header directory information
+# to the targets for when we are part of a parent build (ie being pulled
+# in via add_subdirectory() rather than being a standalone build).
+if (DEFINED CMAKE_VERSION AND NOT "${CMAKE_VERSION}" VERSION_LESS "2.8.11")
+  target_include_directories(gtest      INTERFACE "${gtest_SOURCE_DIR}/include")
+  target_include_directories(gtest_main INTERFACE "${gtest_SOURCE_DIR}/include")
+endif()
+
+########################################################################
+#
+# Install rules
+install(TARGETS gtest gtest_main
+  DESTINATION lib)
+install(DIRECTORY ${gtest_SOURCE_DIR}/include/gtest
+  DESTINATION include)
+
+########################################################################
+#
+# Samples on how to link user tests with gtest or gtest_main.
+#
+# They are not built by default.  To build them, set the
+# gtest_build_samples option to ON.  You can do it by running ccmake
+# or specifying the -Dgtest_build_samples=ON flag when running cmake.
+
+if (gtest_build_samples)
+  cxx_executable(sample1_unittest samples gtest_main samples/sample1.cc)
+  cxx_executable(sample2_unittest samples gtest_main samples/sample2.cc)
+  cxx_executable(sample3_unittest samples gtest_main)
+  cxx_executable(sample4_unittest samples gtest_main samples/sample4.cc)
+  cxx_executable(sample5_unittest samples gtest_main samples/sample1.cc)
+  cxx_executable(sample6_unittest samples gtest_main)
+  cxx_executable(sample7_unittest samples gtest_main)
+  cxx_executable(sample8_unittest samples gtest_main)
+  cxx_executable(sample9_unittest samples gtest)
+  cxx_executable(sample10_unittest samples gtest)
+endif()
+
+########################################################################
+#
+# Google Test's own tests.
+#
+# You can skip this section if you aren't interested in testing
+# Google Test itself.
+#
+# The tests are not built by default.  To build them, set the
+# gtest_build_tests option to ON.  You can do it by running ccmake
+# or specifying the -Dgtest_build_tests=ON flag when running cmake.
+
+if (gtest_build_tests)
+  # This must be set in the root directory for the tests to be run by
+  # 'make test' or ctest.
+  enable_testing()
+
+  ############################################################
+  # C++ tests built with standard compiler flags.
+
+  cxx_test(gtest-death-test_test gtest_main)
+  cxx_test(gtest_environment_test gtest)
+  cxx_test(gtest-filepath_test gtest_main)
+  cxx_test(gtest-linked_ptr_test gtest_main)
+  cxx_test(gtest-listener_test gtest_main)
+  cxx_test(gtest_main_unittest gtest_main)
+  cxx_test(gtest-message_test gtest_main)
+  cxx_test(gtest_no_test_unittest gtest)
+  cxx_test(gtest-options_test gtest_main)
+  cxx_test(gtest-param-test_test gtest
+    test/gtest-param-test2_test.cc)
+  cxx_test(gtest-port_test gtest_main)
+  cxx_test(gtest_pred_impl_unittest gtest_main)
+  cxx_test(gtest_premature_exit_test gtest
+    test/gtest_premature_exit_test.cc)
+  cxx_test(gtest-printers_test gtest_main)
+  cxx_test(gtest_prod_test gtest_main
+    test/production.cc)
+  cxx_test(gtest_repeat_test gtest)
+  cxx_test(gtest_sole_header_test gtest_main)
+  cxx_test(gtest_stress_test gtest)
+  cxx_test(gtest-test-part_test gtest_main)
+  cxx_test(gtest_throw_on_failure_ex_test gtest)
+  cxx_test(gtest-typed-test_test gtest_main
+    test/gtest-typed-test2_test.cc)
+  cxx_test(gtest_unittest gtest_main)
+  cxx_test(gtest-unittest-api_test gtest)
+
+  ############################################################
+  # C++ tests built with non-standard compiler flags.
+
+  # MSVC 7.1 does not support STL with exceptions disabled.
+  if (NOT MSVC OR MSVC_VERSION GREATER 1310)
+    cxx_library(gtest_no_exception "${cxx_no_exception}"
+      src/gtest-all.cc)
+    cxx_library(gtest_main_no_exception "${cxx_no_exception}"
+      src/gtest-all.cc src/gtest_main.cc)
+  endif()
+  cxx_library(gtest_main_no_rtti "${cxx_no_rtti}"
+    src/gtest-all.cc src/gtest_main.cc)
+
+  cxx_test_with_flags(gtest-death-test_ex_nocatch_test
+    "${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=0"
+    gtest test/gtest-death-test_ex_test.cc)
+  cxx_test_with_flags(gtest-death-test_ex_catch_test
+    "${cxx_exception} -DGTEST_ENABLE_CATCH_EXCEPTIONS_=1"
+    gtest test/gtest-death-test_ex_test.cc)
+
+  cxx_test_with_flags(gtest_no_rtti_unittest "${cxx_no_rtti}"
+    gtest_main_no_rtti test/gtest_unittest.cc)
+
+  cxx_shared_library(gtest_dll "${cxx_default}"
+    src/gtest-all.cc src/gtest_main.cc)
+
+  cxx_executable_with_flags(gtest_dll_test_ "${cxx_default}"
+    gtest_dll test/gtest_all_test.cc)
+  set_target_properties(gtest_dll_test_
+                        PROPERTIES
+                        COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
+
+  if (NOT MSVC OR MSVC_VERSION LESS 1600)  # 1600 is Visual Studio 2010.
+    # Visual Studio 2010, 2012, and 2013 define symbols in std::tr1 that
+    # conflict with our own definitions. Therefore using our own tuple does not
+    # work on those compilers.
+    cxx_library(gtest_main_use_own_tuple "${cxx_use_own_tuple}"
+      src/gtest-all.cc src/gtest_main.cc)
+
+    cxx_test_with_flags(gtest-tuple_test "${cxx_use_own_tuple}"
+      gtest_main_use_own_tuple test/gtest-tuple_test.cc)
+
+    cxx_test_with_flags(gtest_use_own_tuple_test "${cxx_use_own_tuple}"
+      gtest_main_use_own_tuple
+      test/gtest-param-test_test.cc test/gtest-param-test2_test.cc)
+  endif()
+
+  ############################################################
+  # Python tests.
+
+  cxx_executable(gtest_break_on_failure_unittest_ test gtest)
+  py_test(gtest_break_on_failure_unittest)
+
+  # Visual Studio .NET 2003 does not support STL with exceptions disabled.
+  if (NOT MSVC OR MSVC_VERSION GREATER 1310)  # 1310 is Visual Studio .NET 2003
+    cxx_executable_with_flags(
+      gtest_catch_exceptions_no_ex_test_
+      "${cxx_no_exception}"
+      gtest_main_no_exception
+      test/gtest_catch_exceptions_test_.cc)
+  endif()
+
+  cxx_executable_with_flags(
+    gtest_catch_exceptions_ex_test_
+    "${cxx_exception}"
+    gtest_main
+    test/gtest_catch_exceptions_test_.cc)
+  py_test(gtest_catch_exceptions_test)
+
+  cxx_executable(gtest_color_test_ test gtest)
+  py_test(gtest_color_test)
+
+  cxx_executable(gtest_env_var_test_ test gtest)
+  py_test(gtest_env_var_test)
+
+  cxx_executable(gtest_filter_unittest_ test gtest)
+  py_test(gtest_filter_unittest)
+
+  cxx_executable(gtest_help_test_ test gtest_main)
+  py_test(gtest_help_test)
+
+  cxx_executable(gtest_list_tests_unittest_ test gtest)
+  py_test(gtest_list_tests_unittest)
+
+  cxx_executable(gtest_output_test_ test gtest)
+  py_test(gtest_output_test)
+
+  cxx_executable(gtest_shuffle_test_ test gtest)
+  py_test(gtest_shuffle_test)
+
+  # MSVC 7.1 does not support STL with exceptions disabled.
+  if (NOT MSVC OR MSVC_VERSION GREATER 1310)
+    cxx_executable(gtest_throw_on_failure_test_ test gtest_no_exception)
+    set_target_properties(gtest_throw_on_failure_test_
+      PROPERTIES
+      COMPILE_FLAGS "${cxx_no_exception}")
+    py_test(gtest_throw_on_failure_test)
+  endif()
+
+  cxx_executable(gtest_uninitialized_test_ test gtest)
+  py_test(gtest_uninitialized_test)
+
+  cxx_executable(gtest_xml_outfile1_test_ test gtest_main)
+  cxx_executable(gtest_xml_outfile2_test_ test gtest_main)
+  py_test(gtest_xml_outfiles_test)
+
+  cxx_executable(gtest_xml_output_unittest_ test gtest)
+  py_test(gtest_xml_output_unittest)
+endif()
diff --git a/third_party/googletest/src/CONTRIBUTORS b/third_party/googletest/src/googletest/CONTRIBUTORS
similarity index 100%
rename from third_party/googletest/src/CONTRIBUTORS
rename to third_party/googletest/src/googletest/CONTRIBUTORS
diff --git a/third_party/googletest/src/LICENSE b/third_party/googletest/src/googletest/LICENSE
similarity index 100%
rename from third_party/googletest/src/LICENSE
rename to third_party/googletest/src/googletest/LICENSE
diff --git a/third_party/googletest/src/googletest/Makefile.am b/third_party/googletest/src/googletest/Makefile.am
new file mode 100644
index 0000000..29797e4
--- /dev/null
+++ b/third_party/googletest/src/googletest/Makefile.am
@@ -0,0 +1,310 @@
+# Automake file
+
+ACLOCAL_AMFLAGS = -I m4
+
+# Nonstandard package files for distribution
+EXTRA_DIST = \
+  CHANGES \
+  CONTRIBUTORS \
+  LICENSE \
+  include/gtest/gtest-param-test.h.pump \
+  include/gtest/internal/gtest-param-util-generated.h.pump \
+  include/gtest/internal/gtest-tuple.h.pump \
+  include/gtest/internal/gtest-type-util.h.pump \
+  make/Makefile \
+  scripts/fuse_gtest_files.py \
+  scripts/gen_gtest_pred_impl.py \
+  scripts/pump.py \
+  scripts/test/Makefile
+
+# gtest source files that we don't compile directly.  They are
+# #included by gtest-all.cc.
+GTEST_SRC = \
+  src/gtest-death-test.cc \
+  src/gtest-filepath.cc \
+  src/gtest-internal-inl.h \
+  src/gtest-port.cc \
+  src/gtest-printers.cc \
+  src/gtest-test-part.cc \
+  src/gtest-typed-test.cc \
+  src/gtest.cc
+
+EXTRA_DIST += $(GTEST_SRC)
+
+# Sample files that we don't compile.
+EXTRA_DIST += \
+  samples/prime_tables.h \
+  samples/sample2_unittest.cc \
+  samples/sample3_unittest.cc \
+  samples/sample4_unittest.cc \
+  samples/sample5_unittest.cc \
+  samples/sample6_unittest.cc \
+  samples/sample7_unittest.cc \
+  samples/sample8_unittest.cc \
+  samples/sample9_unittest.cc
+
+# C++ test files that we don't compile directly.
+EXTRA_DIST += \
+  test/gtest-death-test_ex_test.cc \
+  test/gtest-death-test_test.cc \
+  test/gtest-filepath_test.cc \
+  test/gtest-linked_ptr_test.cc \
+  test/gtest-listener_test.cc \
+  test/gtest-message_test.cc \
+  test/gtest-options_test.cc \
+  test/gtest-param-test2_test.cc \
+  test/gtest-param-test2_test.cc \
+  test/gtest-param-test_test.cc \
+  test/gtest-param-test_test.cc \
+  test/gtest-param-test_test.h \
+  test/gtest-port_test.cc \
+  test/gtest_premature_exit_test.cc \
+  test/gtest-printers_test.cc \
+  test/gtest-test-part_test.cc \
+  test/gtest-tuple_test.cc \
+  test/gtest-typed-test2_test.cc \
+  test/gtest-typed-test_test.cc \
+  test/gtest-typed-test_test.h \
+  test/gtest-unittest-api_test.cc \
+  test/gtest_break_on_failure_unittest_.cc \
+  test/gtest_catch_exceptions_test_.cc \
+  test/gtest_color_test_.cc \
+  test/gtest_env_var_test_.cc \
+  test/gtest_environment_test.cc \
+  test/gtest_filter_unittest_.cc \
+  test/gtest_help_test_.cc \
+  test/gtest_list_tests_unittest_.cc \
+  test/gtest_main_unittest.cc \
+  test/gtest_no_test_unittest.cc \
+  test/gtest_output_test_.cc \
+  test/gtest_pred_impl_unittest.cc \
+  test/gtest_prod_test.cc \
+  test/gtest_repeat_test.cc \
+  test/gtest_shuffle_test_.cc \
+  test/gtest_sole_header_test.cc \
+  test/gtest_stress_test.cc \
+  test/gtest_throw_on_failure_ex_test.cc \
+  test/gtest_throw_on_failure_test_.cc \
+  test/gtest_uninitialized_test_.cc \
+  test/gtest_unittest.cc \
+  test/gtest_unittest.cc \
+  test/gtest_xml_outfile1_test_.cc \
+  test/gtest_xml_outfile2_test_.cc \
+  test/gtest_xml_output_unittest_.cc \
+  test/production.cc \
+  test/production.h
+
+# Python tests that we don't run.
+EXTRA_DIST += \
+  test/gtest_break_on_failure_unittest.py \
+  test/gtest_catch_exceptions_test.py \
+  test/gtest_color_test.py \
+  test/gtest_env_var_test.py \
+  test/gtest_filter_unittest.py \
+  test/gtest_help_test.py \
+  test/gtest_list_tests_unittest.py \
+  test/gtest_output_test.py \
+  test/gtest_output_test_golden_lin.txt \
+  test/gtest_shuffle_test.py \
+  test/gtest_test_utils.py \
+  test/gtest_throw_on_failure_test.py \
+  test/gtest_uninitialized_test.py \
+  test/gtest_xml_outfiles_test.py \
+  test/gtest_xml_output_unittest.py \
+  test/gtest_xml_test_utils.py
+
+# CMake script
+EXTRA_DIST += \
+  CMakeLists.txt \
+  cmake/internal_utils.cmake
+
+# MSVC project files
+EXTRA_DIST += \
+  msvc/gtest-md.sln \
+  msvc/gtest-md.vcproj \
+  msvc/gtest.sln \
+  msvc/gtest.vcproj \
+  msvc/gtest_main-md.vcproj \
+  msvc/gtest_main.vcproj \
+  msvc/gtest_prod_test-md.vcproj \
+  msvc/gtest_prod_test.vcproj \
+  msvc/gtest_unittest-md.vcproj \
+  msvc/gtest_unittest.vcproj
+
+# xcode project files
+EXTRA_DIST += \
+  xcode/Config/DebugProject.xcconfig \
+  xcode/Config/FrameworkTarget.xcconfig \
+  xcode/Config/General.xcconfig \
+  xcode/Config/ReleaseProject.xcconfig \
+  xcode/Config/StaticLibraryTarget.xcconfig \
+  xcode/Config/TestTarget.xcconfig \
+  xcode/Resources/Info.plist \
+  xcode/Scripts/runtests.sh \
+  xcode/Scripts/versiongenerate.py \
+  xcode/gtest.xcodeproj/project.pbxproj
+
+# xcode sample files
+EXTRA_DIST += \
+  xcode/Samples/FrameworkSample/Info.plist \
+  xcode/Samples/FrameworkSample/WidgetFramework.xcodeproj/project.pbxproj \
+  xcode/Samples/FrameworkSample/runtests.sh \
+  xcode/Samples/FrameworkSample/widget.cc \
+  xcode/Samples/FrameworkSample/widget.h \
+  xcode/Samples/FrameworkSample/widget_test.cc
+
+# C++Builder project files
+EXTRA_DIST += \
+  codegear/gtest.cbproj \
+  codegear/gtest.groupproj \
+  codegear/gtest_all.cc \
+  codegear/gtest_link.cc \
+  codegear/gtest_main.cbproj \
+  codegear/gtest_unittest.cbproj
+
+# Distribute and install M4 macro
+m4datadir = $(datadir)/aclocal
+m4data_DATA = m4/gtest.m4
+EXTRA_DIST += $(m4data_DATA)
+
+# We define the global AM_CPPFLAGS as everything we compile includes from these
+# directories.
+AM_CPPFLAGS = -I$(srcdir) -I$(srcdir)/include
+
+# Modifies compiler and linker flags for pthreads compatibility.
+if HAVE_PTHREADS
+  AM_CXXFLAGS = @PTHREAD_CFLAGS@ -DGTEST_HAS_PTHREAD=1
+  AM_LIBS = @PTHREAD_LIBS@
+else
+  AM_CXXFLAGS = -DGTEST_HAS_PTHREAD=0
+endif
+
+# Build rules for libraries.
+lib_LTLIBRARIES = lib/libgtest.la lib/libgtest_main.la
+
+lib_libgtest_la_SOURCES = src/gtest-all.cc
+
+pkginclude_HEADERS = \
+  include/gtest/gtest-death-test.h \
+  include/gtest/gtest-message.h \
+  include/gtest/gtest-param-test.h \
+  include/gtest/gtest-printers.h \
+  include/gtest/gtest-spi.h \
+  include/gtest/gtest-test-part.h \
+  include/gtest/gtest-typed-test.h \
+  include/gtest/gtest.h \
+  include/gtest/gtest_pred_impl.h \
+  include/gtest/gtest_prod.h
+
+pkginclude_internaldir = $(pkgincludedir)/internal
+pkginclude_internal_HEADERS = \
+  include/gtest/internal/gtest-death-test-internal.h \
+  include/gtest/internal/gtest-filepath.h \
+  include/gtest/internal/gtest-internal.h \
+  include/gtest/internal/gtest-linked_ptr.h \
+  include/gtest/internal/gtest-param-util-generated.h \
+  include/gtest/internal/gtest-param-util.h \
+  include/gtest/internal/gtest-port.h \
+  include/gtest/internal/gtest-port-arch.h \
+  include/gtest/internal/gtest-string.h \
+  include/gtest/internal/gtest-tuple.h \
+  include/gtest/internal/gtest-type-util.h \
+  include/gtest/internal/custom/gtest.h \
+  include/gtest/internal/custom/gtest-port.h \
+  include/gtest/internal/custom/gtest-printers.h
+
+lib_libgtest_main_la_SOURCES = src/gtest_main.cc
+lib_libgtest_main_la_LIBADD = lib/libgtest.la
+
+# Bulid rules for samples and tests. Automake's naming for some of
+# these variables isn't terribly obvious, so this is a brief
+# reference:
+#
+# TESTS -- Programs run automatically by "make check"
+# check_PROGRAMS -- Programs built by "make check" but not necessarily run
+
+noinst_LTLIBRARIES = samples/libsamples.la
+
+samples_libsamples_la_SOURCES = \
+  samples/sample1.cc \
+  samples/sample1.h \
+  samples/sample2.cc \
+  samples/sample2.h \
+  samples/sample3-inl.h \
+  samples/sample4.cc \
+  samples/sample4.h
+
+TESTS=
+TESTS_ENVIRONMENT = GTEST_SOURCE_DIR="$(srcdir)/test" \
+                    GTEST_BUILD_DIR="$(top_builddir)/test"
+check_PROGRAMS=
+
+# A simple sample on using gtest.
+TESTS += samples/sample1_unittest
+check_PROGRAMS += samples/sample1_unittest
+samples_sample1_unittest_SOURCES = samples/sample1_unittest.cc
+samples_sample1_unittest_LDADD = lib/libgtest_main.la \
+                                 lib/libgtest.la \
+                                 samples/libsamples.la
+
+# Another sample.  It also verifies that libgtest works.
+TESTS += samples/sample10_unittest
+check_PROGRAMS += samples/sample10_unittest
+samples_sample10_unittest_SOURCES = samples/sample10_unittest.cc
+samples_sample10_unittest_LDADD = lib/libgtest.la
+
+# This tests most constructs of gtest and verifies that libgtest_main
+# and libgtest work.
+TESTS += test/gtest_all_test
+check_PROGRAMS += test/gtest_all_test
+test_gtest_all_test_SOURCES = test/gtest_all_test.cc
+test_gtest_all_test_LDADD = lib/libgtest_main.la \
+                            lib/libgtest.la
+
+# Tests that fused gtest files compile and work.
+FUSED_GTEST_SRC = \
+  fused-src/gtest/gtest-all.cc \
+  fused-src/gtest/gtest.h \
+  fused-src/gtest/gtest_main.cc
+
+if HAVE_PYTHON
+TESTS += test/fused_gtest_test
+check_PROGRAMS += test/fused_gtest_test
+test_fused_gtest_test_SOURCES = $(FUSED_GTEST_SRC) \
+                                samples/sample1.cc samples/sample1_unittest.cc
+test_fused_gtest_test_CPPFLAGS = -I"$(srcdir)/fused-src"
+
+# Build rules for putting fused Google Test files into the distribution
+# package. The user can also create those files by manually running
+# scripts/fuse_gtest_files.py.
+$(test_fused_gtest_test_SOURCES): fused-gtest
+
+fused-gtest: $(pkginclude_HEADERS) $(pkginclude_internal_HEADERS) \
+             $(GTEST_SRC) src/gtest-all.cc src/gtest_main.cc \
+             scripts/fuse_gtest_files.py
+	mkdir -p "$(srcdir)/fused-src"
+	chmod -R u+w "$(srcdir)/fused-src"
+	rm -f "$(srcdir)/fused-src/gtest/gtest-all.cc"
+	rm -f "$(srcdir)/fused-src/gtest/gtest.h"
+	"$(srcdir)/scripts/fuse_gtest_files.py" "$(srcdir)/fused-src"
+	cp -f "$(srcdir)/src/gtest_main.cc" "$(srcdir)/fused-src/gtest/"
+
+maintainer-clean-local:
+	rm -rf "$(srcdir)/fused-src"
+endif
+
+# Death tests may produce core dumps in the build directory. In case
+# this happens, clean them to keep distcleancheck happy.
+CLEANFILES = core
+
+# Disables 'make install' as installing a compiled version of Google
+# Test can lead to undefined behavior due to violation of the
+# One-Definition Rule.
+
+install-exec-local:
+	echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system."
+	false
+
+install-data-local:
+	echo "'make install' is dangerous and not supported. Instead, see README for how to integrate Google Test into your build system."
+	false
diff --git a/third_party/googletest/src/README.md b/third_party/googletest/src/googletest/README.md
similarity index 100%
rename from third_party/googletest/src/README.md
rename to third_party/googletest/src/googletest/README.md
diff --git a/third_party/googletest/src/googletest/cmake/internal_utils.cmake b/third_party/googletest/src/googletest/cmake/internal_utils.cmake
new file mode 100644
index 0000000..777b91e
--- /dev/null
+++ b/third_party/googletest/src/googletest/cmake/internal_utils.cmake
@@ -0,0 +1,254 @@
+# Defines functions and macros useful for building Google Test and
+# Google Mock.
+#
+# Note:
+#
+# - This file will be run twice when building Google Mock (once via
+#   Google Test's CMakeLists.txt, and once via Google Mock's).
+#   Therefore it shouldn't have any side effects other than defining
+#   the functions and macros.
+#
+# - The functions/macros defined in this file may depend on Google
+#   Test and Google Mock's option() definitions, and thus must be
+#   called *after* the options have been defined.
+
+# Tweaks CMake's default compiler/linker settings to suit Google Test's needs.
+#
+# This must be a macro(), as inside a function string() can only
+# update variables in the function scope.
+macro(fix_default_compiler_settings_)
+  if (MSVC)
+    # For MSVC, CMake sets certain flags to defaults we want to override.
+    # This replacement code is taken from sample in the CMake Wiki at
+    # http://www.cmake.org/Wiki/CMake_FAQ#Dynamic_Replace.
+    foreach (flag_var
+             CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE
+             CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO)
+      if (NOT BUILD_SHARED_LIBS AND NOT gtest_force_shared_crt)
+        # When Google Test is built as a shared library, it should also use
+        # shared runtime libraries.  Otherwise, it may end up with multiple
+        # copies of runtime library data in different modules, resulting in
+        # hard-to-find crashes. When it is built as a static library, it is
+        # preferable to use CRT as static libraries, as we don't have to rely
+        # on CRT DLLs being available. CMake always defaults to using shared
+        # CRT libraries, so we override that default here.
+        string(REPLACE "/MD" "-MT" ${flag_var} "${${flag_var}}")
+      endif()
+
+      # We prefer more strict warning checking for building Google Test.
+      # Replaces /W3 with /W4 in defaults.
+      string(REPLACE "/W3" "/W4" ${flag_var} "${${flag_var}}")
+    endforeach()
+  endif()
+endmacro()
+
+# Defines the compiler/linker flags used to build Google Test and
+# Google Mock.  You can tweak these definitions to suit your need.  A
+# variable's value is empty before it's explicitly assigned to.
+macro(config_compiler_and_linker)
+  if (NOT gtest_disable_pthreads)
+    # Defines CMAKE_USE_PTHREADS_INIT and CMAKE_THREAD_LIBS_INIT.
+    find_package(Threads)
+  endif()
+
+  fix_default_compiler_settings_()
+  if (MSVC)
+    # Newlines inside flags variables break CMake's NMake generator.
+    # TODO(vladl@google.com): Add -RTCs and -RTCu to debug builds.
+    set(cxx_base_flags "-GS -W4 -WX -wd4251 -wd4275 -nologo -J -Zi")
+    if (MSVC_VERSION LESS 1400)  # 1400 is Visual Studio 2005
+      # Suppress spurious warnings MSVC 7.1 sometimes issues.
+      # Forcing value to bool.
+      set(cxx_base_flags "${cxx_base_flags} -wd4800")
+      # Copy constructor and assignment operator could not be generated.
+      set(cxx_base_flags "${cxx_base_flags} -wd4511 -wd4512")
+      # Compatibility warnings not applicable to Google Test.
+      # Resolved overload was found by argument-dependent lookup.
+      set(cxx_base_flags "${cxx_base_flags} -wd4675")
+    endif()
+    if (MSVC_VERSION LESS 1500)  # 1500 is Visual Studio 2008
+      # Conditional expression is constant.
+      # When compiling with /W4, we get several instances of C4127
+      # (Conditional expression is constant). In our code, we disable that
+      # warning on a case-by-case basis. However, on Visual Studio 2005,
+      # the warning fires on std::list. Therefore on that compiler and earlier,
+      # we disable the warning project-wide.
+      set(cxx_base_flags "${cxx_base_flags} -wd4127")
+    endif()
+    if (NOT (MSVC_VERSION LESS 1700))  # 1700 is Visual Studio 2012.
+      # Suppress "unreachable code" warning on VS 2012 and later.
+      # http://stackoverflow.com/questions/3232669 explains the issue.
+      set(cxx_base_flags "${cxx_base_flags} -wd4702")
+    endif()
+    if (NOT (MSVC_VERSION GREATER 1900))  # 1900 is Visual Studio 2015
+      # BigObj required for tests.
+      set(cxx_base_flags "${cxx_base_flags} -bigobj")
+    endif()
+
+    set(cxx_base_flags "${cxx_base_flags} -D_UNICODE -DUNICODE -DWIN32 -D_WIN32")
+    set(cxx_base_flags "${cxx_base_flags} -DSTRICT -DWIN32_LEAN_AND_MEAN")
+    set(cxx_exception_flags "-EHsc -D_HAS_EXCEPTIONS=1")
+    set(cxx_no_exception_flags "-D_HAS_EXCEPTIONS=0")
+    set(cxx_no_rtti_flags "-GR-")
+  elseif (CMAKE_COMPILER_IS_GNUCXX)
+    set(cxx_base_flags "-Wall -Wshadow")
+    set(cxx_exception_flags "-fexceptions")
+    set(cxx_no_exception_flags "-fno-exceptions")
+    # Until version 4.3.2, GCC doesn't define a macro to indicate
+    # whether RTTI is enabled.  Therefore we define GTEST_HAS_RTTI
+    # explicitly.
+    set(cxx_no_rtti_flags "-fno-rtti -DGTEST_HAS_RTTI=0")
+    set(cxx_strict_flags
+      "-Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
+  elseif (CMAKE_CXX_COMPILER_ID STREQUAL "SunPro")
+    set(cxx_exception_flags "-features=except")
+    # Sun Pro doesn't provide macros to indicate whether exceptions and
+    # RTTI are enabled, so we define GTEST_HAS_* explicitly.
+    set(cxx_no_exception_flags "-features=no%except -DGTEST_HAS_EXCEPTIONS=0")
+    set(cxx_no_rtti_flags "-features=no%rtti -DGTEST_HAS_RTTI=0")
+  elseif (CMAKE_CXX_COMPILER_ID STREQUAL "VisualAge" OR
+      CMAKE_CXX_COMPILER_ID STREQUAL "XL")
+    # CMake 2.8 changes Visual Age's compiler ID to "XL".
+    set(cxx_exception_flags "-qeh")
+    set(cxx_no_exception_flags "-qnoeh")
+    # Until version 9.0, Visual Age doesn't define a macro to indicate
+    # whether RTTI is enabled.  Therefore we define GTEST_HAS_RTTI
+    # explicitly.
+    set(cxx_no_rtti_flags "-qnortti -DGTEST_HAS_RTTI=0")
+  elseif (CMAKE_CXX_COMPILER_ID STREQUAL "HP")
+    set(cxx_base_flags "-AA -mt")
+    set(cxx_exception_flags "-DGTEST_HAS_EXCEPTIONS=1")
+    set(cxx_no_exception_flags "+noeh -DGTEST_HAS_EXCEPTIONS=0")
+    # RTTI can not be disabled in HP aCC compiler.
+    set(cxx_no_rtti_flags "")
+  endif()
+
+  if (CMAKE_USE_PTHREADS_INIT)  # The pthreads library is available and allowed.
+    set(cxx_base_flags "${cxx_base_flags} -DGTEST_HAS_PTHREAD=1")
+  else()
+    set(cxx_base_flags "${cxx_base_flags} -DGTEST_HAS_PTHREAD=0")
+  endif()
+
+  # For building gtest's own tests and samples.
+  set(cxx_exception "${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_exception_flags}")
+  set(cxx_no_exception
+    "${CMAKE_CXX_FLAGS} ${cxx_base_flags} ${cxx_no_exception_flags}")
+  set(cxx_default "${cxx_exception}")
+  set(cxx_no_rtti "${cxx_default} ${cxx_no_rtti_flags}")
+  set(cxx_use_own_tuple "${cxx_default} -DGTEST_USE_OWN_TR1_TUPLE=1")
+
+  # For building the gtest libraries.
+  set(cxx_strict "${cxx_default} ${cxx_strict_flags}")
+endmacro()
+
+# Defines the gtest & gtest_main libraries.  User tests should link
+# with one of them.
+function(cxx_library_with_type name type cxx_flags)
+  # type can be either STATIC or SHARED to denote a static or shared library.
+  # ARGN refers to additional arguments after 'cxx_flags'.
+  add_library(${name} ${type} ${ARGN})
+  set_target_properties(${name}
+    PROPERTIES
+    COMPILE_FLAGS "${cxx_flags}")
+  if (BUILD_SHARED_LIBS OR type STREQUAL "SHARED")
+    set_target_properties(${name}
+      PROPERTIES
+      COMPILE_DEFINITIONS "GTEST_CREATE_SHARED_LIBRARY=1")
+  endif()
+  if (CMAKE_USE_PTHREADS_INIT)
+    target_link_libraries(${name} ${CMAKE_THREAD_LIBS_INIT})
+  endif()
+endfunction()
+
+########################################################################
+#
+# Helper functions for creating build targets.
+
+function(cxx_shared_library name cxx_flags)
+  cxx_library_with_type(${name} SHARED "${cxx_flags}" ${ARGN})
+endfunction()
+
+function(cxx_library name cxx_flags)
+  cxx_library_with_type(${name} "" "${cxx_flags}" ${ARGN})
+endfunction()
+
+# cxx_executable_with_flags(name cxx_flags libs srcs...)
+#
+# creates a named C++ executable that depends on the given libraries and
+# is built from the given source files with the given compiler flags.
+function(cxx_executable_with_flags name cxx_flags libs)
+  add_executable(${name} ${ARGN})
+  if (cxx_flags)
+    set_target_properties(${name}
+      PROPERTIES
+      COMPILE_FLAGS "${cxx_flags}")
+  endif()
+  if (BUILD_SHARED_LIBS)
+    set_target_properties(${name}
+      PROPERTIES
+      COMPILE_DEFINITIONS "GTEST_LINKED_AS_SHARED_LIBRARY=1")
+  endif()
+  # To support mixing linking in static and dynamic libraries, link each
+  # library in with an extra call to target_link_libraries.
+  foreach (lib "${libs}")
+    target_link_libraries(${name} ${lib})
+  endforeach()
+endfunction()
+
+# cxx_executable(name dir lib srcs...)
+#
+# creates a named target that depends on the given libs and is built
+# from the given source files.  dir/name.cc is implicitly included in
+# the source file list.
+function(cxx_executable name dir libs)
+  cxx_executable_with_flags(
+    ${name} "${cxx_default}" "${libs}" "${dir}/${name}.cc" ${ARGN})
+endfunction()
+
+# Sets PYTHONINTERP_FOUND and PYTHON_EXECUTABLE.
+find_package(PythonInterp)
+
+# cxx_test_with_flags(name cxx_flags libs srcs...)
+#
+# creates a named C++ test that depends on the given libs and is built
+# from the given source files with the given compiler flags.
+function(cxx_test_with_flags name cxx_flags libs)
+  cxx_executable_with_flags(${name} "${cxx_flags}" "${libs}" ${ARGN})
+  add_test(${name} ${name})
+endfunction()
+
+# cxx_test(name libs srcs...)
+#
+# creates a named test target that depends on the given libs and is
+# built from the given source files.  Unlike cxx_test_with_flags,
+# test/name.cc is already implicitly included in the source file list.
+function(cxx_test name libs)
+  cxx_test_with_flags("${name}" "${cxx_default}" "${libs}"
+    "test/${name}.cc" ${ARGN})
+endfunction()
+
+# py_test(name)
+#
+# creates a Python test with the given name whose main module is in
+# test/name.py.  It does nothing if Python is not installed.
+function(py_test name)
+  # We are not supporting Python tests on Linux yet as they consider
+  # all Linux environments to be google3 and try to use google3 features.
+  if (PYTHONINTERP_FOUND)
+    # ${CMAKE_BINARY_DIR} is known at configuration time, so we can
+    # directly bind it from cmake. ${CTEST_CONFIGURATION_TYPE} is known
+    # only at ctest runtime (by calling ctest -c <Configuration>), so
+    # we have to escape $ to delay variable substitution here.
+    if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
+      add_test(
+        NAME ${name}
+        COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
+            --build_dir=${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>)
+    else (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
+      add_test(
+        ${name}
+        ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test/${name}.py
+          --build_dir=${CMAKE_CURRENT_BINARY_DIR}/\${CTEST_CONFIGURATION_TYPE})
+    endif (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 3.1)
+  endif()
+endfunction()
diff --git a/third_party/googletest/src/include/gtest/gtest-death-test.h b/third_party/googletest/src/googletest/include/gtest/gtest-death-test.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/gtest-death-test.h
rename to third_party/googletest/src/googletest/include/gtest/gtest-death-test.h
diff --git a/third_party/googletest/src/include/gtest/gtest-message.h b/third_party/googletest/src/googletest/include/gtest/gtest-message.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/gtest-message.h
rename to third_party/googletest/src/googletest/include/gtest/gtest-message.h
diff --git a/third_party/googletest/src/include/gtest/gtest-param-test.h b/third_party/googletest/src/googletest/include/gtest/gtest-param-test.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/gtest-param-test.h
rename to third_party/googletest/src/googletest/include/gtest/gtest-param-test.h
diff --git a/third_party/googletest/src/include/gtest/gtest-param-test.h.pump b/third_party/googletest/src/googletest/include/gtest/gtest-param-test.h.pump
similarity index 100%
rename from third_party/googletest/src/include/gtest/gtest-param-test.h.pump
rename to third_party/googletest/src/googletest/include/gtest/gtest-param-test.h.pump
diff --git a/third_party/googletest/src/include/gtest/gtest-printers.h b/third_party/googletest/src/googletest/include/gtest/gtest-printers.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/gtest-printers.h
rename to third_party/googletest/src/googletest/include/gtest/gtest-printers.h
diff --git a/third_party/googletest/src/include/gtest/gtest-spi.h b/third_party/googletest/src/googletest/include/gtest/gtest-spi.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/gtest-spi.h
rename to third_party/googletest/src/googletest/include/gtest/gtest-spi.h
diff --git a/third_party/googletest/src/include/gtest/gtest-test-part.h b/third_party/googletest/src/googletest/include/gtest/gtest-test-part.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/gtest-test-part.h
rename to third_party/googletest/src/googletest/include/gtest/gtest-test-part.h
diff --git a/third_party/googletest/src/include/gtest/gtest-typed-test.h b/third_party/googletest/src/googletest/include/gtest/gtest-typed-test.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/gtest-typed-test.h
rename to third_party/googletest/src/googletest/include/gtest/gtest-typed-test.h
diff --git a/third_party/googletest/src/include/gtest/gtest.h b/third_party/googletest/src/googletest/include/gtest/gtest.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/gtest.h
rename to third_party/googletest/src/googletest/include/gtest/gtest.h
diff --git a/third_party/googletest/src/include/gtest/gtest_pred_impl.h b/third_party/googletest/src/googletest/include/gtest/gtest_pred_impl.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/gtest_pred_impl.h
rename to third_party/googletest/src/googletest/include/gtest/gtest_pred_impl.h
diff --git a/third_party/googletest/src/include/gtest/gtest_prod.h b/third_party/googletest/src/googletest/include/gtest/gtest_prod.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/gtest_prod.h
rename to third_party/googletest/src/googletest/include/gtest/gtest_prod.h
diff --git a/third_party/googletest/src/include/gtest/internal/custom/gtest-port.h b/third_party/googletest/src/googletest/include/gtest/internal/custom/gtest-port.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/custom/gtest-port.h
rename to third_party/googletest/src/googletest/include/gtest/internal/custom/gtest-port.h
diff --git a/third_party/googletest/src/include/gtest/internal/custom/gtest-printers.h b/third_party/googletest/src/googletest/include/gtest/internal/custom/gtest-printers.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/custom/gtest-printers.h
rename to third_party/googletest/src/googletest/include/gtest/internal/custom/gtest-printers.h
diff --git a/third_party/googletest/src/include/gtest/internal/custom/gtest.h b/third_party/googletest/src/googletest/include/gtest/internal/custom/gtest.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/custom/gtest.h
rename to third_party/googletest/src/googletest/include/gtest/internal/custom/gtest.h
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-death-test-internal.h b/third_party/googletest/src/googletest/include/gtest/internal/gtest-death-test-internal.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-death-test-internal.h
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-death-test-internal.h
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-filepath.h b/third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-filepath.h
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-filepath.h
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-internal.h b/third_party/googletest/src/googletest/include/gtest/internal/gtest-internal.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-internal.h
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-internal.h
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-linked_ptr.h b/third_party/googletest/src/googletest/include/gtest/internal/gtest-linked_ptr.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-linked_ptr.h
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-linked_ptr.h
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-param-util-generated.h b/third_party/googletest/src/googletest/include/gtest/internal/gtest-param-util-generated.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-param-util-generated.h
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-param-util-generated.h
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-param-util-generated.h.pump b/third_party/googletest/src/googletest/include/gtest/internal/gtest-param-util-generated.h.pump
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-param-util-generated.h.pump
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-param-util-generated.h.pump
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-param-util.h b/third_party/googletest/src/googletest/include/gtest/internal/gtest-param-util.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-param-util.h
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-param-util.h
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-port-arch.h b/third_party/googletest/src/googletest/include/gtest/internal/gtest-port-arch.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-port-arch.h
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-port-arch.h
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-port.h b/third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-port.h
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-port.h
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-string.h b/third_party/googletest/src/googletest/include/gtest/internal/gtest-string.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-string.h
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-string.h
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-tuple.h b/third_party/googletest/src/googletest/include/gtest/internal/gtest-tuple.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-tuple.h
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-tuple.h
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-tuple.h.pump b/third_party/googletest/src/googletest/include/gtest/internal/gtest-tuple.h.pump
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-tuple.h.pump
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-tuple.h.pump
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-type-util.h b/third_party/googletest/src/googletest/include/gtest/internal/gtest-type-util.h
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-type-util.h
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-type-util.h
diff --git a/third_party/googletest/src/include/gtest/internal/gtest-type-util.h.pump b/third_party/googletest/src/googletest/include/gtest/internal/gtest-type-util.h.pump
similarity index 100%
rename from third_party/googletest/src/include/gtest/internal/gtest-type-util.h.pump
rename to third_party/googletest/src/googletest/include/gtest/internal/gtest-type-util.h.pump
diff --git a/third_party/googletest/src/src/gtest-all.cc b/third_party/googletest/src/googletest/src/gtest-all.cc
similarity index 100%
rename from third_party/googletest/src/src/gtest-all.cc
rename to third_party/googletest/src/googletest/src/gtest-all.cc
diff --git a/third_party/googletest/src/src/gtest-death-test.cc b/third_party/googletest/src/googletest/src/gtest-death-test.cc
similarity index 100%
rename from third_party/googletest/src/src/gtest-death-test.cc
rename to third_party/googletest/src/googletest/src/gtest-death-test.cc
diff --git a/third_party/googletest/src/src/gtest-filepath.cc b/third_party/googletest/src/googletest/src/gtest-filepath.cc
similarity index 100%
rename from third_party/googletest/src/src/gtest-filepath.cc
rename to third_party/googletest/src/googletest/src/gtest-filepath.cc
diff --git a/third_party/googletest/src/src/gtest-internal-inl.h b/third_party/googletest/src/googletest/src/gtest-internal-inl.h
similarity index 100%
rename from third_party/googletest/src/src/gtest-internal-inl.h
rename to third_party/googletest/src/googletest/src/gtest-internal-inl.h
diff --git a/third_party/googletest/src/src/gtest-port.cc b/third_party/googletest/src/googletest/src/gtest-port.cc
similarity index 100%
rename from third_party/googletest/src/src/gtest-port.cc
rename to third_party/googletest/src/googletest/src/gtest-port.cc
diff --git a/third_party/googletest/src/src/gtest-printers.cc b/third_party/googletest/src/googletest/src/gtest-printers.cc
similarity index 100%
rename from third_party/googletest/src/src/gtest-printers.cc
rename to third_party/googletest/src/googletest/src/gtest-printers.cc
diff --git a/third_party/googletest/src/src/gtest-test-part.cc b/third_party/googletest/src/googletest/src/gtest-test-part.cc
similarity index 100%
rename from third_party/googletest/src/src/gtest-test-part.cc
rename to third_party/googletest/src/googletest/src/gtest-test-part.cc
diff --git a/third_party/googletest/src/src/gtest-typed-test.cc b/third_party/googletest/src/googletest/src/gtest-typed-test.cc
similarity index 100%
rename from third_party/googletest/src/src/gtest-typed-test.cc
rename to third_party/googletest/src/googletest/src/gtest-typed-test.cc
diff --git a/third_party/googletest/src/src/gtest.cc b/third_party/googletest/src/googletest/src/gtest.cc
similarity index 100%
rename from third_party/googletest/src/src/gtest.cc
rename to third_party/googletest/src/googletest/src/gtest.cc
diff --git a/third_party/googletest/src/src/gtest_main.cc b/third_party/googletest/src/googletest/src/gtest_main.cc
similarity index 100%
rename from third_party/googletest/src/src/gtest_main.cc
rename to third_party/googletest/src/googletest/src/gtest_main.cc