Android APK tests built from a normal WebRTC checkout.

Restructure how the Android APK tests are compiled now
that we have a Chromium checkout available (since r6938).

This removes the need of several hacks that were needed when
building these targets from inside a Chromium checkout.
By creating a symlink to Chromium's base we can compile the required
targets. This also removes the need of the previously precompiled
binaries we keep in /deps/tools/android at Google code.

All the user needs to do is to add the target_os = ["android"]
entry to his .gclient as described at
https://code.google.com/p/chromium/wiki/AndroidBuildInstructions

Before committing this CL, the Android APK buildbots will need
to be updated.
This also solves http://crbug.com/402594 since the apply_svn_patch.py
usage will be similar to the other standalone bots.
It also solves http://crbug.com/399297

BUG=chromium:399297, chromium:402594
TESTED=Locally compiled all APK targets by running:
GYP_DEFINES="OS=android include_tests=1 enable_tracing=1" gclient runhooks
ninja -C out/Release

checkdeps

R=henrike@webrtc.org, tommi@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/22149004

git-svn-id: http://webrtc.googlecode.com/svn/trunk/webrtc@7014 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/build/apk_tests.gyp b/build/apk_tests.gyp
deleted file mode 100644
index 0185975..0000000
--- a/build/apk_tests.gyp
+++ /dev/null
@@ -1,235 +0,0 @@
-# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS.  All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-
-# This file exists in two versions. A no-op version under
-# webrtc/build/apk_tests_noop.gyp and this one. This gyp file builds the apk
-# unit tests (for Android) assuming that WebRTC is built inside a Chromium
-# workspace. The no-op version is included when building WebRTC without
-# Chromium. This is a workaround for the fact that 'includes' don't expand
-# variables and that the relative location of apk_test.gypi is different for
-# WebRTC when built as part of Chromium and when it is built without Chromium.
-{
-  'includes': [
-    'common.gypi',
-  ],
-  'targets': [
-    {
-      'target_name': 'audio_decoder_unittests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'audio_decoder_unittests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)audio_decoder_unittests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/modules/modules.gyp:audio_decoder_unittests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-    },
-    {
-      'target_name': 'common_audio_unittests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'common_audio_unittests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)common_audio_unittests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/common_audio/common_audio.gyp:common_audio_unittests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-    },
-    {
-      'target_name': 'common_video_unittests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'common_video_unittests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)common_video_unittests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/common_video/common_video_unittests.gyp:common_video_unittests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-    },
-    {
-      'target_name': 'modules_tests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'modules_tests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)modules_tests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/modules/modules.gyp:modules_tests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-    },
-    {
-      'target_name': 'modules_unittests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'modules_unittests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)modules_unittests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/modules/modules.gyp:modules_unittests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-    },
-    {
-      'target_name': 'system_wrappers_unittests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'system_wrappers_unittests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)system_wrappers_unittests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/system_wrappers/source/system_wrappers_tests.gyp:system_wrappers_unittests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-    },
-    {
-      'target_name': 'test_support_unittests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'test_support_unittests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)test_support_unittests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/test/test.gyp:test_support_unittests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-    },
-    {
-      'target_name': 'tools_unittests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'tools_unittests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)tools_unittests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/tools/tools.gyp:tools_unittests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-    },
-    {
-      'target_name': 'video_engine_core_unittests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'video_engine_core_unittests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)video_engine_core_unittests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/video_engine/video_engine.gyp:video_engine_core_unittests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-    },
-    {
-      'target_name': 'video_engine_tests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'video_engine_tests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)video_engine_tests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/webrtc.gyp:video_engine_tests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-     },
-     {
-      'target_name': 'voice_engine_unittests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'voice_engine_unittests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)voice_engine_unittests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine_unittests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-    },
-    {
-      'target_name': 'webrtc_perf_tests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'webrtc_perf_tests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)webrtc_perf_tests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/webrtc.gyp:webrtc_perf_tests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-    },
-    {
-      'target_name': 'audio_codec_speed_tests_apk',
-      'type': 'none',
-      'variables': {
-        'test_suite_name': 'audio_codec_speed_tests',
-        'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)audio_codec_speed_tests<(SHARED_LIB_SUFFIX)',
-      },
-      'dependencies': [
-        '<(webrtc_root)/modules/modules.gyp:audio_codec_speed_tests',
-      ],
-      'includes': [
-        '../../../build/apk_test.gypi',
-      ],
-    },
-    {
-      'target_name': 'video_capture_tests_apk',
-      'type': 'none',
-       'variables': {
-         'test_suite_name': 'video_capture_tests',
-         'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)video_capture_tests<(SHARED_LIB_SUFFIX)',
-       },
-       'dependencies': [
-         '<(webrtc_root)/modules/modules.gyp:video_capture_tests',
-         'video_capture_java',
-       ],
-       'includes': [
-         '../../../build/apk_test.gypi',
-       ],
-    },
-    {
-      # Used only by video_capture_tests_apk above, and impossible to use in the
-      # standalone build, which is why it's declared here instead of under
-      # modules/video_capture/ (to avoid the need for a forked _noop.gyp file
-      # like this file has; see comment at the top of this file).
-      'target_name': 'video_capture_java',
-      'type': 'none',
-      'variables': {
-        'java_in_dir': '<(webrtc_root)/modules/video_capture/android/java',
-      },
-      'includes': [
-        '../../../build/java.gypi',
-      ],
-    },
-  ],
-}
-
-
diff --git a/build/apk_tests_noop.gyp b/build/apk_tests_noop.gyp
deleted file mode 100644
index 3523e79..0000000
--- a/build/apk_tests_noop.gyp
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright (c) 2013 The WebRTC project authors. All Rights Reserved.
-#
-# Use of this source code is governed by a BSD-style license
-# that can be found in the LICENSE file in the root of the source
-# tree. An additional intellectual property rights grant can be found
-# in the file PATENTS.  All contributing project authors may
-# be found in the AUTHORS file in the root of the source tree.
-
-# See webrtc/build/apk_tests.gyp for more information about this file.
-{
-  'targets': [
-    {
-      'target_name': 'audio_decoder_unittests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'common_audio_unittests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'common_video_unittests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'modules_tests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'modules_unittests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'system_wrappers_unittests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'test_support_unittests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'tools_unittests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'video_engine_core_unittests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'video_engine_tests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'voice_engine_unittests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'webrtc_perf_tests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'audio_codec_speed_tests_apk',
-      'type': 'none',
-    },
-    {
-      'target_name': 'video_capture_tests_apk',
-      'type': 'none',
-    },
-  ],
-}
diff --git a/build/common.gypi b/build/common.gypi
index 00bd4d4..8376ef8 100644
--- a/build/common.gypi
+++ b/build/common.gypi
@@ -23,13 +23,11 @@
           ['build_with_chromium==1', {
             'build_with_libjingle': 1,
             'webrtc_root%': '<(DEPTH)/third_party/webrtc',
-            'apk_tests_path%': '<(DEPTH)/third_party/webrtc/build/apk_tests.gyp',
             'modules_java_gyp_path%': '<(DEPTH)/third_party/webrtc/modules/modules_java_chromium.gyp',
             'gen_core_neon_offsets_gyp%': '<(DEPTH)/third_party/webrtc/modules/audio_processing/gen_core_neon_offsets_chromium.gyp',
           }, {
             'build_with_libjingle%': 0,
             'webrtc_root%': '<(DEPTH)/webrtc',
-            'apk_tests_path%': '<(DEPTH)/webrtc/build/apk_test_noop.gyp',
             'modules_java_gyp_path%': '<(DEPTH)/webrtc/modules/modules_java.gyp',
             'gen_core_neon_offsets_gyp%':'<(DEPTH)/webrtc/modules/audio_processing/gen_core_neon_offsets.gyp',
           }],
@@ -38,7 +36,6 @@
       'build_with_chromium%': '<(build_with_chromium)',
       'build_with_libjingle%': '<(build_with_libjingle)',
       'webrtc_root%': '<(webrtc_root)',
-      'apk_tests_path%': '<(apk_tests_path)',
       'modules_java_gyp_path%': '<(modules_java_gyp_path)',
       'gen_core_neon_offsets_gyp%': '<(gen_core_neon_offsets_gyp)',
       'webrtc_vp8_dir%': '<(webrtc_root)/modules/video_coding/codecs/vp8',
@@ -48,7 +45,6 @@
     'build_with_chromium%': '<(build_with_chromium)',
     'build_with_libjingle%': '<(build_with_libjingle)',
     'webrtc_root%': '<(webrtc_root)',
-    'apk_tests_path%': '<(apk_tests_path)',
     'modules_java_gyp_path%': '<(modules_java_gyp_path)',
     'gen_core_neon_offsets_gyp%': '<(gen_core_neon_offsets_gyp)',
     'webrtc_vp8_dir%': '<(webrtc_vp8_dir)',
diff --git a/common_audio/common_audio.gyp b/common_audio/common_audio.gyp
index ae3bacb..699a7eb 100644
--- a/common_audio/common_audio.gyp
+++ b/common_audio/common_audio.gyp
@@ -228,9 +228,7 @@
             'wav_writer_unittest.cc',
           ],
           'conditions': [
-            # TODO(henrike): remove build_with_chromium==1 when the bots are
-            # using Chromium's buildbots.
-            ['build_with_chromium==1 and OS=="android"', {
+            ['OS=="android"', {
               'dependencies': [
                 '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
               ],
@@ -239,15 +237,20 @@
         },
       ],  # targets
       'conditions': [
-        # TODO(henrike): remove build_with_chromium==1 when the bots are using
-        # Chromium's buildbots.
-        ['build_with_chromium==1 and OS=="android"', {
+        ['OS=="android"', {
           'targets': [
             {
-              'target_name': 'common_audio_unittests_apk_target',
+              'target_name': 'common_audio_unittests_apk',
               'type': 'none',
+              'variables': {
+                'test_suite_name': 'common_audio_unittests',
+                'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)common_audio_unittests<(SHARED_LIB_SUFFIX)',
+              },
               'dependencies': [
-                '<(apk_tests_path):common_audio_unittests_apk',
+                'common_audio_unittests',
+              ],
+              'includes': [
+                '../../build/apk_test.gypi',
               ],
             },
           ],
diff --git a/common_video/common_video_unittests.gyp b/common_video/common_video_unittests.gyp
index 91a11ed..b839e85 100644
--- a/common_video/common_video_unittests.gyp
+++ b/common_video/common_video_unittests.gyp
@@ -30,9 +30,7 @@
         4267,  # size_t to int truncation.
       ],
       'conditions': [
-        # TODO(henrike): remove build_with_chromium==1 when the bots are
-        # using Chromium's buildbots.
-        ['build_with_chromium==1 and OS=="android"', {
+        ['OS=="android"', {
           'dependencies': [
             '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
           ],
@@ -41,15 +39,20 @@
     },
   ],  # targets
   'conditions': [
-    # TODO(henrike): remove build_with_chromium==1 when the bots are using
-    # Chromium's buildbots.
-    ['build_with_chromium==1 and OS=="android"', {
+    ['OS=="android"', {
       'targets': [
         {
-          'target_name': 'common_video_unittests_apk_target',
+          'target_name': 'common_video_unittests_apk',
           'type': 'none',
+          'variables': {
+            'test_suite_name': 'common_video_unittests',
+            'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)common_video_unittests<(SHARED_LIB_SUFFIX)',
+          },
           'dependencies': [
-            '<(apk_tests_path):common_video_unittests_apk',
+            'common_video_unittests',
+          ],
+          'includes': [
+            '../../build/apk_test.gypi',
           ],
         },
       ],
diff --git a/modules/audio_coding/codecs/tools/audio_codec_speed_tests.gypi b/modules/audio_coding/codecs/tools/audio_codec_speed_tests.gypi
index 4d675e1..30a8715 100644
--- a/modules/audio_coding/codecs/tools/audio_codec_speed_tests.gypi
+++ b/modules/audio_coding/codecs/tools/audio_codec_speed_tests.gypi
@@ -26,9 +26,7 @@
       '<(webrtc_root)/modules/audio_coding/codecs/isac/fix/test/isac_speed_test.cc',
     ],
     'conditions': [
-      # TODO(henrike): remove build_with_chromium==1 when the bots are
-      # using Chromium's buildbots.
-      ['build_with_chromium==1 and OS=="android"', {
+      ['OS=="android"', {
         'dependencies': [
           '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
         ],
@@ -36,15 +34,20 @@
     ],
   }],
   'conditions': [
-    # TODO(henrike): remove build_with_chromium==1 when the bots are using
-    # Chromium's buildbots.
-    ['build_with_chromium==1 and OS=="android"', {
+    ['OS=="android"', {
       'targets': [
         {
-          'target_name': 'audio_codec_speed_tests_apk_target',
+          'target_name': 'audio_codec_speed_tests_apk',
           'type': 'none',
+          'variables': {
+            'test_suite_name': 'audio_codec_speed_tests',
+            'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)audio_codec_speed_tests<(SHARED_LIB_SUFFIX)',
+          },
           'dependencies': [
-            '<(apk_tests_path):audio_codec_speed_tests_apk',
+            'audio_codec_speed_tests',
+          ],
+          'includes': [
+            '../../../../../build/apk_test.gypi',
           ],
         },
       ],
diff --git a/modules/audio_coding/neteq/neteq.gypi b/modules/audio_coding/neteq/neteq.gypi
index 21ccee4..2bdb359 100644
--- a/modules/audio_coding/neteq/neteq.gypi
+++ b/modules/audio_coding/neteq/neteq.gypi
@@ -157,9 +157,7 @@
             'interface/audio_decoder.h',
           ],
           'conditions': [
-            # TODO(henrike): remove build_with_chromium==1 when the bots are
-            # using Chromium's buildbots.
-            ['build_with_chromium==1 and OS=="android"', {
+            ['OS=="android"', {
               'dependencies': [
                 '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
               ],
@@ -200,15 +198,20 @@
         }, # neteq_unittest_tools
       ], # targets
       'conditions': [
-        # TODO(henrike): remove build_with_chromium==1 when the bots are using
-        # Chromium's buildbots.
-        ['build_with_chromium==1 and OS=="android"', {
+        ['OS=="android"', {
           'targets': [
             {
-              'target_name': 'audio_decoder_unittests_apk_target',
+              'target_name': 'audio_decoder_unittests_apk',
               'type': 'none',
+              'variables': {
+                'test_suite_name': 'audio_decoder_unittests',
+                'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)audio_decoder_unittests<(SHARED_LIB_SUFFIX)',
+              },
               'dependencies': [
-                '<(apk_tests_path):audio_decoder_unittests_apk',
+                'audio_decoder_unittests',
+              ],
+              'includes': [
+                '../../../../build/apk_test.gypi',
               ],
             },
           ],
diff --git a/modules/modules.gyp b/modules/modules.gyp
index 138c73b..426ab08 100644
--- a/modules/modules.gyp
+++ b/modules/modules.gyp
@@ -356,9 +356,7 @@
             'video_coding/codecs/vp8/test/vp8_impl_unittest.cc',
           ],
           'conditions': [
-            # TODO(henrike): remove build_with_chromium==1 when the bots are
-            # using Chromium's buildbots.
-            ['build_with_chromium==1 and OS=="android"', {
+            ['OS=="android"', {
               'dependencies': [
                 '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
               ],
@@ -367,22 +365,34 @@
         },
       ],
       'conditions': [
-        # TODO(henrike): remove build_with_chromium==1 when the bots are using
-        # Chromium's buildbots.
-        ['build_with_chromium==1 and OS=="android"', {
+        ['OS=="android"', {
           'targets': [
             {
-              'target_name': 'modules_unittests_apk_target',
+              'target_name': 'modules_unittests_apk',
               'type': 'none',
+              'variables': {
+                'test_suite_name': 'modules_unittests',
+                'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)modules_unittests<(SHARED_LIB_SUFFIX)',
+              },
               'dependencies': [
-                '<(apk_tests_path):modules_unittests_apk',
+                'modules_unittests',
+              ],
+              'includes': [
+                '../../build/apk_test.gypi',
               ],
             },
             {
-              'target_name': 'modules_tests_apk_target',
+              'target_name': 'modules_tests_apk',
               'type': 'none',
+              'variables': {
+                'test_suite_name': 'modules_tests',
+                'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)modules_tests<(SHARED_LIB_SUFFIX)',
+              },
               'dependencies': [
-                '<(apk_tests_path):modules_tests_apk',
+                'modules_tests',
+              ],
+              'includes': [
+                '../../build/apk_test.gypi',
               ],
             },
           ],
diff --git a/modules/video_capture/video_capture.gypi b/modules/video_capture/video_capture.gypi
index 7382a1c..b32e30c 100644
--- a/modules/video_capture/video_capture.gypi
+++ b/modules/video_capture/video_capture.gypi
@@ -140,14 +140,35 @@
     },
   ],
   'conditions': [
-    ['include_tests==1 and build_with_chromium==1 and OS=="android"', {
-      # Use WebRTC capture code for Android APK tests that are built from a
-      # Chromium checkout. Normally when built as a part of Chromium the
-      # Chromium video capture code is used. This overrides the default in
-      # webrtc/build/common.gypi.
-      'variables': {
-        'include_internal_video_capture': 1,
-      },
+    ['include_tests==1 and OS=="android"', {
+      'targets': [
+        {
+          'target_name': 'video_capture_tests_apk',
+          'type': 'none',
+          'variables': {
+            'test_suite_name': 'video_capture_tests',
+            'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)video_capture_tests<(SHARED_LIB_SUFFIX)',
+          },
+          'dependencies': [
+            'video_capture_tests',
+            'video_capture_java',
+          ],
+          'includes': [
+            '../../../build/apk_test.gypi',
+          ],
+        },
+        {
+          # Used only by video_capture_tests_apk above.
+          'target_name': 'video_capture_java',
+          'type': 'none',
+          'variables': {
+            'java_in_dir': '<(webrtc_root)/modules/video_capture/android/java',
+          },
+          'includes': [
+            '../../../build/java.gypi',
+          ],
+        },
+      ],
     }],
     ['include_tests==1', {
       'targets': [
diff --git a/system_wrappers/source/system_wrappers_tests.gyp b/system_wrappers/source/system_wrappers_tests.gyp
index 3d08c0d..29ac602 100644
--- a/system_wrappers/source/system_wrappers_tests.gyp
+++ b/system_wrappers/source/system_wrappers_tests.gyp
@@ -45,9 +45,7 @@
         ['os_posix==0', {
           'sources!': [ 'thread_posix_unittest.cc', ],
         }],
-        # TODO(henrike): remove build_with_chromium==1 when the bots are
-        # using Chromium's buildbots.
-        ['build_with_chromium==1 and OS=="android"', {
+        ['OS=="android"', {
           'dependencies': [
             '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
           ],
@@ -60,15 +58,20 @@
     },
   ],
   'conditions': [
-    # TODO(henrike): remove build_with_chromium==1 when the bots are using
-    # Chromium's buildbots.
-    ['include_tests==1 and build_with_chromium==1 and OS=="android"', {
+    ['OS=="android"', {
       'targets': [
         {
-          'target_name': 'system_wrappers_unittests_apk_target',
+          'target_name': 'system_wrappers_unittests_apk',
           'type': 'none',
+          'variables': {
+            'test_suite_name': 'system_wrappers_unittests',
+            'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)system_wrappers_unittests<(SHARED_LIB_SUFFIX)',
+          },
           'dependencies': [
-            '<(apk_tests_path):system_wrappers_unittests_apk',
+            'system_wrappers_unittests',
+          ],
+          'includes': [
+            '../../../build/apk_test.gypi',
           ],
         },
       ],
diff --git a/test/test.gyp b/test/test.gyp
index 69776e7..0514e37 100644
--- a/test/test.gyp
+++ b/test/test.gyp
@@ -191,9 +191,7 @@
         4267,  # size_t to int truncation.
       ],
       'conditions': [
-        # TODO(henrike): remove build_with_chromium==1 when the bots are
-        # using Chromium's buildbots.
-        ['build_with_chromium==1 and OS=="android"', {
+        ['OS=="android"', {
           'dependencies': [
             '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
           ],
@@ -226,15 +224,20 @@
         },  # target buildbot_tests_scripts
       ],
     }],
-    # TODO(henrike): remove build_with_chromium==1 when the bots are using
-    # Chromium's buildbots.
-    ['include_tests==1 and build_with_chromium==1 and OS=="android"', {
+    ['OS=="android"', {
       'targets': [
         {
-          'target_name': 'test_support_unittests_apk_target',
+          'target_name': 'test_support_unittests_apk',
           'type': 'none',
+          'variables': {
+            'test_suite_name': 'test_support_unittests',
+            'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)test_support_unittests<(SHARED_LIB_SUFFIX)',
+          },
           'dependencies': [
-            '<(apk_tests_path):test_support_unittests_apk',
+            'test_support_unittests',
+          ],
+          'includes': [
+            '../../build/apk_test.gypi',
           ],
         },
       ],
diff --git a/tools/tools.gyp b/tools/tools.gyp
index ee2a11d..0a38c90 100644
--- a/tools/tools.gyp
+++ b/tools/tools.gyp
@@ -135,9 +135,7 @@
             4267,  # size_t to int truncation.
           ],
           'conditions': [
-            # TODO(henrike): remove build_with_chromium==1 when the bots are
-            # using Chromium's buildbots.
-            ['build_with_chromium==1 and OS=="android"', {
+            ['OS=="android"', {
               'dependencies': [
                 '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
               ],
@@ -145,16 +143,21 @@
           ],
         }, # tools_unittests
       ], # targets
-      # TODO(henrike): remove build_with_chromium==1 when the bots are using
-      # Chromium's buildbots.
       'conditions': [
-        ['build_with_chromium==1 and OS=="android"', {
+        ['OS=="android"', {
           'targets': [
             {
-              'target_name': 'tools_unittests_apk_target',
+              'target_name': 'tools_unittests_apk',
               'type': 'none',
+              'variables': {
+                'test_suite_name': 'tools_unittests',
+                'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)tools_unittests<(SHARED_LIB_SUFFIX)',
+              },
               'dependencies': [
-                '<(apk_tests_path):tools_unittests_apk',
+                'tools_unittests',
+              ],
+              'includes': [
+                '../../build/apk_test.gypi',
               ],
             },
           ],
diff --git a/video_engine/video_engine_core.gypi b/video_engine/video_engine_core.gypi
index ce9d536..76c7018 100644
--- a/video_engine/video_engine_core.gypi
+++ b/video_engine/video_engine_core.gypi
@@ -136,9 +136,7 @@
             'vie_remb_unittest.cc',
           ],
           'conditions': [
-            # TODO(henrike): remove build_with_chromium==1 when the bots are
-            # using Chromium's buildbots.
-            ['build_with_chromium==1 and OS=="android"', {
+            ['OS=="android"', {
               'dependencies': [
                 '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
               ],
@@ -147,17 +145,22 @@
         },
       ], # targets
       'conditions': [
-        # TODO(henrike): remove build_with_chromium==1 when the bots are using
-        # Chromium's buildbots.
-        ['build_with_chromium==1 and OS=="android"', {
+        ['OS=="android"', {
           'targets': [
             {
-              'target_name': 'video_engine_core_unittests_apk_target',
+              'target_name': 'video_engine_core_unittests_apk',
               'type': 'none',
+              'variables': {
+                'test_suite_name': 'video_engine_core_unittests',
+                'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)video_engine_core_unittests<(SHARED_LIB_SUFFIX)',
+              },
               'dependencies': [
-                '<(apk_tests_path):video_engine_core_unittests_apk',
+                'video_engine_core_unittests',
               ],
-            },
+              'includes': [
+                '../../build/apk_test.gypi',
+              ],
+             },
           ],
         }],
         ['test_isolation_mode != "noop"', {
diff --git a/voice_engine/voice_engine.gyp b/voice_engine/voice_engine.gyp
index 43296ff..99a7886 100644
--- a/voice_engine/voice_engine.gyp
+++ b/voice_engine/voice_engine.gyp
@@ -132,9 +132,7 @@
             'voe_codec_unittest.cc',
           ],
           'conditions': [
-            # TODO(henrike): remove build_with_chromium==1 when the bots are
-            # using Chromium's buildbots.
-            ['build_with_chromium==1 and OS=="android"', {
+            ['OS=="android"', {
               'dependencies': [
                 '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
               ],
@@ -274,15 +272,20 @@
             },
           ],  # targets
         }],
-        # TODO(henrike): remove build_with_chromium==1 when the bots are using
-        # Chromium's buildbots.
-        ['build_with_chromium==1 and OS=="android"', {
+        ['OS=="android"', {
           'targets': [
             {
-              'target_name': 'voice_engine_unittests_apk_target',
+              'target_name': 'voice_engine_unittests_apk',
               'type': 'none',
+              'variables': {
+                'test_suite_name': 'voice_engine_unittests',
+                'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)voice_engine_unittests<(SHARED_LIB_SUFFIX)',
+              },
               'dependencies': [
-                '<(apk_tests_path):voice_engine_unittests_apk',
+                'voice_engine_unittests',
+              ],
+              'includes': [
+                '../../build/apk_test.gypi',
               ],
             },
           ],
diff --git a/webrtc.gyp b/webrtc.gyp
index 96ae6a9..e5e9cc5 100644
--- a/webrtc.gyp
+++ b/webrtc.gyp
@@ -53,11 +53,6 @@
             'webrtc_tests',
           ],
         }],
-        ['build_with_chromium==0 and OS=="android"', {
-          'dependencies': [
-            '../tools/android/android_tools_precompiled.gyp:*',
-          ],
-        }],
       ],
     },
     {
diff --git a/webrtc_tests.gypi b/webrtc_tests.gypi
index ace6684..c8c0679 100644
--- a/webrtc_tests.gypi
+++ b/webrtc_tests.gypi
@@ -117,9 +117,7 @@
         'webrtc',
       ],
       'conditions': [
-        # TODO(henrike): remove build_with_chromium==1 when the bots are
-        # using Chromium's buildbots.
-        ['build_with_chromium==1 and OS=="android"', {
+        ['OS=="android"', {
           'dependencies': [
             '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
           ],
@@ -128,22 +126,34 @@
     },
   ],
   'conditions': [
-    # TODO(henrike): remove build_with_chromium==1 when the bots are using
-    # Chromium's buildbots.
-    ['build_with_chromium==1 and OS=="android"', {
+    ['OS=="android"', {
       'targets': [
         {
-          'target_name': 'video_engine_tests_apk_target',
+          'target_name': 'video_engine_tests_apk',
           'type': 'none',
+          'variables': {
+            'test_suite_name': 'video_engine_tests',
+            'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)video_engine_tests<(SHARED_LIB_SUFFIX)',
+          },
           'dependencies': [
-            '<(apk_tests_path):video_engine_tests_apk',
+            'video_engine_tests',
+          ],
+          'includes': [
+            '../build/apk_test.gypi',
           ],
         },
         {
-          'target_name': 'webrtc_perf_tests_apk_target',
+          'target_name': 'webrtc_perf_tests_apk',
           'type': 'none',
+          'variables': {
+            'test_suite_name': 'webrtc_perf_tests',
+            'input_shlib_path': '<(SHARED_LIB_DIR)/<(SHARED_LIB_PREFIX)webrtc_perf_tests<(SHARED_LIB_SUFFIX)',
+          },
           'dependencies': [
-            '<(apk_tests_path):webrtc_perf_tests_apk',
+            'webrtc_perf_tests',
+          ],
+          'includes': [
+            '../build/apk_test.gypi',
           ],
         },
       ],