Re-land "Remove <(webrtc_root) from source file entries."

Changes differing from https://webrtc-codereview.appspot.com/37859004:
* I put the include_tests==1 stuff of audio_coding.gypi in its
  own audio_coding_tests.gypi file, including the Android and isolate
  targets which were incorrectly located in the previous CL
* I moved the bwe utilities in remote_bitrate_estimator.gypi
  into include_tests==1 since they depend on test.gyp after I
  cleaned up the duplicated inclusion of rtp_file_reader.cc

R=stefan@webrtc.org
TBR=tina.legrand@webrtc.org
TESTED=Passing gyp and compile using:
webrtc/build/gyp_webrtc -Dinclude_tests=1
webrtc/build/gyp_webrtc -Dinclude_tests=0
I also setup a Chromium checkout with my checkout mounted in
third_party/webrtc and ran build/gyp_chromium successfully.

BUG=4185

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

Cr-Commit-Position: refs/heads/master@{#8205}
git-svn-id: http://webrtc.googlecode.com/svn/trunk@8205 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/PRESUBMIT.py b/PRESUBMIT.py
index c8386f6..320b07a 100755
--- a/PRESUBMIT.py
+++ b/PRESUBMIT.py
@@ -127,7 +127,7 @@
   # Disallow referencing source files with paths above the GYP file location.
   source_pattern = input_api.re.compile(r'sources.*?\[(.*?)\]',
                                         re.MULTILINE | re.DOTALL)
-  file_pattern = input_api.re.compile(r"'(\.\./.*?)'")
+  file_pattern = input_api.re.compile(r"'((\.\./.*?)|(<\(webrtc_root\).*?))'")
   violating_gyp_files = set()
   violating_source_entries = []
   for gyp_file in gyp_files:
diff --git a/webrtc/modules/audio_coding/codecs/tools/audio_codec_speed_tests.isolate b/webrtc/modules/audio_coding/audio_codec_speed_tests.isolate
similarity index 100%
rename from webrtc/modules/audio_coding/codecs/tools/audio_codec_speed_tests.isolate
rename to webrtc/modules/audio_coding/audio_codec_speed_tests.isolate
diff --git a/webrtc/modules/audio_coding/audio_coding.gypi b/webrtc/modules/audio_coding/audio_coding.gypi
new file mode 100644
index 0000000..0a500d9
--- /dev/null
+++ b/webrtc/modules/audio_coding/audio_coding.gypi
@@ -0,0 +1,29 @@
+# Copyright (c) 2015 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.
+
+{
+  'includes': [
+    '../../build/common.gypi',
+    'codecs/interfaces.gypi',
+    'codecs/cng/cng.gypi',
+    'codecs/g711/g711.gypi',
+    'codecs/g722/g722.gypi',
+    'codecs/ilbc/ilbc.gypi',
+    'codecs/isac/main/source/isac.gypi',
+    'codecs/isac/fix/source/isacfix.gypi',
+    'codecs/pcm16b/pcm16b.gypi',
+    'codecs/red/red.gypi',
+    'main/acm2/audio_coding_module.gypi',
+    'neteq/neteq.gypi',
+  ],
+  'conditions': [
+    ['include_opus==1', {
+      'includes': ['codecs/opus/opus.gypi',],
+    }],
+  ],
+}
diff --git a/webrtc/modules/audio_coding/audio_coding_tests.gypi b/webrtc/modules/audio_coding/audio_coding_tests.gypi
new file mode 100644
index 0000000..86a92c5
--- /dev/null
+++ b/webrtc/modules/audio_coding/audio_coding_tests.gypi
@@ -0,0 +1,72 @@
+# Copyright (c) 2015 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.
+
+{
+  'includes': [
+    '../../build/common.gypi',
+    'codecs/isac/isac_test.gypi',
+    'codecs/isac/isacfix_test.gypi',
+  ],
+  'targets': [
+    {
+      'target_name': 'audio_codec_speed_tests',
+      'type': '<(gtest_target_type)',
+      'dependencies': [
+        'audio_processing',
+        'iSACFix',
+        'webrtc_opus',
+        '<(DEPTH)/testing/gtest.gyp:gtest',
+        '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
+        '<(webrtc_root)/test/test.gyp:test_support_main',
+      ],
+      'sources': [
+        'codecs/isac/fix/test/isac_speed_test.cc',
+        'codecs/opus/opus_speed_test.cc',
+        'codecs/tools/audio_codec_speed_test.h',
+        'codecs/tools/audio_codec_speed_test.cc',
+      ],
+      'conditions': [
+        ['OS=="android"', {
+          'dependencies': [
+            '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
+          ],
+        }],
+      ],
+    },
+  ],
+  'conditions': [
+    ['OS=="android"', {
+      'targets': [
+        {
+          'target_name': 'audio_codec_speed_tests_apk_target',
+          'type': 'none',
+          'dependencies': [
+            '<(apk_tests_path):audio_codec_speed_tests_apk',
+          ],
+        },
+      ],
+    }],
+    ['test_isolation_mode != "noop"', {
+      'targets': [
+        {
+          'target_name': 'audio_codec_speed_tests_run',
+          'type': 'none',
+          'dependencies': [
+            'audio_codec_speed_tests',
+          ],
+          'includes': [
+            '../../build/isolate.gypi',
+          ],
+          'sources': [
+            'audio_codec_speed_tests.isolate',
+          ],
+        },
+      ],
+    }],
+  ],
+}
diff --git a/webrtc/modules/audio_coding/codecs/tools/audio_codec_speed_tests.gypi b/webrtc/modules/audio_coding/codecs/tools/audio_codec_speed_tests.gypi
deleted file mode 100644
index e296634..0000000
--- a/webrtc/modules/audio_coding/codecs/tools/audio_codec_speed_tests.gypi
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright (c) 2014 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.
-
-{
-  'targets': [
-  {
-    'target_name': 'audio_codec_speed_tests',
-    'type': '<(gtest_target_type)',
-    'dependencies': [
-      'audio_processing',
-      'iSACFix',
-      'webrtc_opus',
-      '<(DEPTH)/testing/gtest.gyp:gtest',
-      '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
-      '<(webrtc_root)/test/test.gyp:test_support_main',
-    ],
-    'sources': [
-      'audio_codec_speed_test.h',
-      'audio_codec_speed_test.cc',
-      '<(webrtc_root)/modules/audio_coding/codecs/opus/opus_speed_test.cc',
-      '<(webrtc_root)/modules/audio_coding/codecs/isac/fix/test/isac_speed_test.cc',
-    ],
-    'conditions': [
-      ['OS=="android"', {
-        'dependencies': [
-          '<(DEPTH)/testing/android/native_test.gyp:native_test_native_code',
-        ],
-      }],
-    ],
-  }],
-  'conditions': [
-    ['OS=="android"', {
-      'targets': [
-        {
-          'target_name': 'audio_codec_speed_tests_apk_target',
-          'type': 'none',
-          'dependencies': [
-            '<(apk_tests_path):audio_codec_speed_tests_apk',
-          ],
-        },
-      ],
-    }],
-    ['test_isolation_mode != "noop"', {
-      'targets': [
-        {
-          'target_name': 'audio_codec_speed_tests_run',
-          'type': 'none',
-          'dependencies': [
-            'audio_codec_speed_tests',
-          ],
-          'includes': [
-            '../../../../build/isolate.gypi',
-          ],
-          'sources': [
-            'audio_codec_speed_tests.isolate',
-          ],
-        },
-      ],
-    }],
-  ],
-}
diff --git a/webrtc/modules/modules.gyp b/webrtc/modules/modules.gyp
index 691f308..23ee29f 100644
--- a/webrtc/modules/modules.gyp
+++ b/webrtc/modules/modules.gyp
@@ -9,17 +9,7 @@
 {
   'includes': [
     '../build/common.gypi',
-    'audio_coding/codecs/interfaces.gypi',
-    'audio_coding/codecs/cng/cng.gypi',
-    'audio_coding/codecs/g711/g711.gypi',
-    'audio_coding/codecs/g722/g722.gypi',
-    'audio_coding/codecs/ilbc/ilbc.gypi',
-    'audio_coding/codecs/isac/main/source/isac.gypi',
-    'audio_coding/codecs/isac/fix/source/isacfix.gypi',
-    'audio_coding/codecs/pcm16b/pcm16b.gypi',
-    'audio_coding/codecs/red/red.gypi',
-    'audio_coding/main/acm2/audio_coding_module.gypi',
-    'audio_coding/neteq/neteq.gypi',
+    'audio_coding/audio_coding.gypi',
     'audio_conference_mixer/source/audio_conference_mixer.gypi',
     'audio_device/audio_device.gypi',
     'audio_processing/audio_processing.gypi',
@@ -37,14 +27,9 @@
     'video_render/video_render.gypi',
   ],
   'conditions': [
-    ['include_opus==1', {
-      'includes': ['audio_coding/codecs/opus/opus.gypi',],
-    }],
     ['include_tests==1', {
       'includes': [
-        'audio_coding/codecs/isac/isac_test.gypi',
-        'audio_coding/codecs/isac/isacfix_test.gypi',
-        'audio_coding/codecs/tools/audio_codec_speed_tests.gypi',
+        'audio_coding/audio_coding_tests.gypi',
         'audio_processing/audio_processing_tests.gypi',
         'rtp_rtcp/test/testFec/test_fec.gypi',
         'video_coding/main/source/video_coding_test.gypi',
@@ -101,6 +86,7 @@
             '<(webrtc_root)/test/test.gyp:frame_generator',
             '<(webrtc_root)/test/test.gyp:rtp_test_utils',
             '<(webrtc_root)/test/test.gyp:test_support_main',
+            '<(webrtc_root)/tools/tools.gyp:agc_test_utils',
           ],
           'sources': [
             'audio_coding/codecs/cng/audio_encoder_cng_unittest.cc',
@@ -175,7 +161,6 @@
             'audio_processing/agc/pitch_internal_unittest.cc',
             'audio_processing/agc/pole_zero_filter_unittest.cc',
             'audio_processing/agc/standalone_vad_unittest.cc',
-            'audio_processing/agc/test/test_utils.cc',
             'audio_processing/beamformer/complex_matrix_unittest.cc',
             'audio_processing/beamformer/covariance_matrix_generator_unittest.cc',
             'audio_processing/beamformer/matrix_unittest.cc',
diff --git a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi
index 6580281..c3853f6 100644
--- a/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi
+++ b/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi
@@ -40,63 +40,67 @@
         'test/bwe_test_logging.h',
       ], # source
     },
-    {
-      'target_name': 'bwe_tools_util',
-      'type': 'static_library',
-      'dependencies': [
-        '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
-        'rtp_rtcp',
-      ],
-      'sources': [
-        'tools/bwe_rtp.cc',
-        'tools/bwe_rtp.h',
-      ],
-    },
-    {
-      'target_name': 'bwe_rtp_to_text',
-      'type': 'executable',
-      'includes': [
-        '../rtp_rtcp/source/rtp_rtcp.gypi',
-      ],
-      'dependencies': [
-        '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
-        '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers_default',
-        'bwe_tools_util',
-        'rtp_rtcp',
-      ],
-      'direct_dependent_settings': {
-        'include_dirs': [
-          'include',
-        ],
-      },
-      'sources': [
-        'tools/rtp_to_text.cc',
-        '<(webrtc_root)/test/rtp_file_reader.cc',
-        '<(webrtc_root)/test/rtp_file_reader.h',
-      ], # source
-    },
-    {
-      'target_name': 'bwe_rtp_play',
-      'type': 'executable',
-      'includes': [
-        '../rtp_rtcp/source/rtp_rtcp.gypi',
-      ],
-      'dependencies': [
-        '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
-        '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers_default',
-        'bwe_tools_util',
-        'rtp_rtcp',
-      ],
-      'direct_dependent_settings': {
-        'include_dirs': [
-          'include',
-        ],
-      },
-      'sources': [
-        'tools/bwe_rtp_play.cc',
-        '<(webrtc_root)/test/rtp_file_reader.cc',
-        '<(webrtc_root)/test/rtp_file_reader.h',
-      ], # source
-    },
   ], # targets
+  'conditions': [
+    ['include_tests==1', {
+      'targets': [
+        {
+          'target_name': 'bwe_tools_util',
+          'type': 'static_library',
+          'dependencies': [
+            '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
+            'rtp_rtcp',
+          ],
+          'sources': [
+            'tools/bwe_rtp.cc',
+            'tools/bwe_rtp.h',
+          ],
+        },
+        {
+          'target_name': 'bwe_rtp_to_text',
+          'type': 'executable',
+          'includes': [
+            '../rtp_rtcp/source/rtp_rtcp.gypi',
+          ],
+          'dependencies': [
+            '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
+            '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers_default',
+            '<(webrtc_root)/test/test.gyp:rtp_test_utils',
+            'bwe_tools_util',
+            'rtp_rtcp',
+          ],
+          'direct_dependent_settings': {
+            'include_dirs': [
+              'include',
+            ],
+          },
+          'sources': [
+            'tools/rtp_to_text.cc',
+          ], # source
+        },
+        {
+          'target_name': 'bwe_rtp_play',
+          'type': 'executable',
+          'includes': [
+            '../rtp_rtcp/source/rtp_rtcp.gypi',
+          ],
+          'dependencies': [
+            '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers',
+            '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers_default',
+            '<(webrtc_root)/test/test.gyp:rtp_test_utils',
+            'bwe_tools_util',
+            'rtp_rtcp',
+          ],
+          'direct_dependent_settings': {
+            'include_dirs': [
+              'include',
+            ],
+          },
+          'sources': [
+            'tools/bwe_rtp_play.cc',
+          ], # source
+        },
+      ],
+    }],  # include_tests==1
+  ],
 }
diff --git a/webrtc/modules/audio_processing/agc/test/activity_metric.cc b/webrtc/tools/agc/activity_metric.cc
similarity index 100%
rename from webrtc/modules/audio_processing/agc/test/activity_metric.cc
rename to webrtc/tools/agc/activity_metric.cc
diff --git a/webrtc/modules/audio_processing/agc/test/agc_harness.cc b/webrtc/tools/agc/agc_harness.cc
similarity index 98%
rename from webrtc/modules/audio_processing/agc/test/agc_harness.cc
rename to webrtc/tools/agc/agc_harness.cc
index d7c32b0..02d0f65 100644
--- a/webrtc/modules/audio_processing/agc/test/agc_harness.cc
+++ b/webrtc/tools/agc/agc_harness.cc
@@ -12,12 +12,12 @@
 
 #include "gflags/gflags.h"
 #include "testing/gtest/include/gtest/gtest.h"
-#include "webrtc/modules/audio_processing/agc/test/agc_manager.h"
 #include "webrtc/system_wrappers/interface/scoped_ptr.h"
 #include "webrtc/system_wrappers/interface/sleep.h"
 #include "webrtc/system_wrappers/interface/trace.h"
 #include "webrtc/test/channel_transport/include/channel_transport.h"
 #include "webrtc/test/testsupport/trace_to_stderr.h"
+#include "webrtc/tools/agc/agc_manager.h"
 #include "webrtc/voice_engine/include/voe_audio_processing.h"
 #include "webrtc/voice_engine/include/voe_base.h"
 #include "webrtc/voice_engine/include/voe_codec.h"
diff --git a/webrtc/modules/audio_processing/agc/test/agc_manager.cc b/webrtc/tools/agc/agc_manager.cc
similarity index 98%
rename from webrtc/modules/audio_processing/agc/test/agc_manager.cc
rename to webrtc/tools/agc/agc_manager.cc
index a741e64..83c0d00 100644
--- a/webrtc/modules/audio_processing/agc/test/agc_manager.cc
+++ b/webrtc/tools/agc/agc_manager.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "webrtc/modules/audio_processing/agc/test/agc_manager.h"
+#include "webrtc/tools/agc/agc_manager.h"
 
 #include <assert.h>
 
diff --git a/webrtc/modules/audio_processing/agc/test/agc_manager.h b/webrtc/tools/agc/agc_manager.h
similarity index 93%
rename from webrtc/modules/audio_processing/agc/test/agc_manager.h
rename to webrtc/tools/agc/agc_manager.h
index ec8161c..6b3e91d 100644
--- a/webrtc/modules/audio_processing/agc/test/agc_manager.h
+++ b/webrtc/tools/agc/agc_manager.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC_TEST_AGC_MANAGER_H_
-#define WEBRTC_MODULES_AUDIO_PROCESSING_AGC_TEST_AGC_MANAGER_H_
+#ifndef WEBRTC_TOOLS_AGC_AGC_MANAGER_H_
+#define WEBRTC_TOOLS_AGC_AGC_MANAGER_H_
 
 #include "webrtc/modules/audio_processing/agc/agc_manager_direct.h"
 #include "webrtc/system_wrappers/interface/scoped_ptr.h"
@@ -78,4 +78,4 @@
 
 }  // namespace webrtc
 
-#endif  // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_TEST_AGC_MANAGER_H_
+#endif  // WEBRTC_TOOLS_AGC_AGC_MANAGER_H_
diff --git a/webrtc/modules/audio_processing/agc/test/agc_manager_integrationtest.cc b/webrtc/tools/agc/agc_manager_integrationtest.cc
similarity index 97%
rename from webrtc/modules/audio_processing/agc/test/agc_manager_integrationtest.cc
rename to webrtc/tools/agc/agc_manager_integrationtest.cc
index 9dbbc22..d4b3632 100644
--- a/webrtc/modules/audio_processing/agc/test/agc_manager_integrationtest.cc
+++ b/webrtc/tools/agc/agc_manager_integrationtest.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "webrtc/modules/audio_processing/agc/test/agc_manager.h"
+#include "webrtc/tools/agc/agc_manager.h"
 
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/webrtc/modules/audio_processing/agc/test/agc_manager_unittest.cc b/webrtc/tools/agc/agc_manager_unittest.cc
similarity index 99%
rename from webrtc/modules/audio_processing/agc/test/agc_manager_unittest.cc
rename to webrtc/tools/agc/agc_manager_unittest.cc
index 92464ef..fca8dec 100644
--- a/webrtc/modules/audio_processing/agc/test/agc_manager_unittest.cc
+++ b/webrtc/tools/agc/agc_manager_unittest.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "webrtc/modules/audio_processing/agc/test/agc_manager.h"
+#include "webrtc/tools/agc/agc_manager.h"
 
 #include "testing/gmock/include/gmock/gmock.h"
 #include "testing/gtest/include/gtest/gtest.h"
diff --git a/webrtc/modules/audio_processing/agc/test/agc_test.cc b/webrtc/tools/agc/agc_test.cc
similarity index 97%
rename from webrtc/modules/audio_processing/agc/test/agc_test.cc
rename to webrtc/tools/agc/agc_test.cc
index 413b3b0..2976948 100644
--- a/webrtc/modules/audio_processing/agc/test/agc_test.cc
+++ b/webrtc/tools/agc/agc_test.cc
@@ -16,13 +16,13 @@
 #include "gflags/gflags.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "webrtc/modules/audio_processing/agc/agc.h"
-#include "webrtc/modules/audio_processing/agc/test/agc_manager.h"
-#include "webrtc/modules/audio_processing/agc/test/test_utils.h"
 #include "webrtc/modules/audio_processing/agc/utility.h"
 #include "webrtc/modules/audio_processing/include/audio_processing.h"
 #include "webrtc/modules/interface/module_common_types.h"
 #include "webrtc/system_wrappers/interface/logging.h"
 #include "webrtc/test/testsupport/trace_to_stderr.h"
+#include "webrtc/tools/agc/agc_manager.h"
+#include "webrtc/tools/agc/test_utils.h"
 #include "webrtc/voice_engine/include/mock/fake_voe_external_media.h"
 #include "webrtc/voice_engine/include/mock/mock_voe_volume_control.h"
 
diff --git a/webrtc/modules/audio_processing/agc/test/fake_agc.h b/webrtc/tools/agc/fake_agc.h
similarity index 83%
rename from webrtc/modules/audio_processing/agc/test/fake_agc.h
rename to webrtc/tools/agc/fake_agc.h
index e2aabd8..6b39cd7 100644
--- a/webrtc/modules/audio_processing/agc/test/fake_agc.h
+++ b/webrtc/tools/agc/fake_agc.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_AGC_TEST_FAKE_AGC_H_
-#define WEBRTC_MODULES_AUDIO_PROCESSING_AGC_TEST_FAKE_AGC_H_
+#ifndef WEBRTC_TOOLS_AGC_FAKE_AGC_H_
+#define WEBRTC_TOOLS_AGC_FAKE_AGC_H_
 
 #include "webrtc/modules/audio_processing/agc/agc.h"
 
@@ -43,4 +43,4 @@
 
 }  // namespace webrtc
 
-#endif  // WEBRTC_MODULES_AUDIO_PROCESSING_AGC_TEST_FAKE_AGC_H_
+#endif  // WEBRTC_TOOLS_AGC_FAKE_AGC_H_
diff --git a/webrtc/modules/audio_processing/agc/test/test_utils.cc b/webrtc/tools/agc/test_utils.cc
similarity index 96%
rename from webrtc/modules/audio_processing/agc/test/test_utils.cc
rename to webrtc/tools/agc/test_utils.cc
index e7c884b..3a26cb9 100644
--- a/webrtc/modules/audio_processing/agc/test/test_utils.cc
+++ b/webrtc/tools/agc/test_utils.cc
@@ -8,7 +8,7 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#include "webrtc/modules/audio_processing/agc/test/test_utils.h"
+#include "webrtc/tools/agc/test_utils.h"
 
 #include <cmath>
 
diff --git a/webrtc/modules/audio_processing/agc/test/test_utils.h b/webrtc/tools/agc/test_utils.h
similarity index 83%
rename from webrtc/modules/audio_processing/agc/test/test_utils.h
rename to webrtc/tools/agc/test_utils.h
index 25dc496..2aca999 100644
--- a/webrtc/modules/audio_processing/agc/test/test_utils.h
+++ b/webrtc/tools/agc/test_utils.h
@@ -8,8 +8,8 @@
  *  be found in the AUTHORS file in the root of the source tree.
  */
 
-#ifndef WEBRTC_MODULES_AUDIO_PROCESSING_TEST_TEST_UTILS_H_
-#define WEBRTC_MODULES_AUDIO_PROCESSING_TEST_TEST_UTILS_H_
+#ifndef WEBRTC_TOOLS_AGC_TEST_UTILS_H_
+#define WEBRTC_TOOLS_AGC_TEST_UTILS_H_
 namespace webrtc {
 
 class AudioFrame;
@@ -25,4 +25,4 @@
 
 }  // namespace webrtc
 
-#endif  // WEBRTC_MODULES_AUDIO_PROCESSING_TEST_TEST_UTILS_H_
+#endif  // WEBRTC_TOOLS_AGC_TEST_UTILS_H_
diff --git a/webrtc/tools/tools.gyp b/webrtc/tools/tools.gyp
index 0a3d531..e2a5421 100644
--- a/webrtc/tools/tools.gyp
+++ b/webrtc/tools/tools.gyp
@@ -110,8 +110,16 @@
             '<(webrtc_root)/voice_engine/voice_engine.gyp:voice_engine',
           ],
           'sources': [
-            '<(webrtc_root)/modules/audio_processing/agc/test/agc_manager.cc',
-            '<(webrtc_root)/modules/audio_processing/agc/test/agc_manager.h',
+            'agc/agc_manager.cc',
+            'agc/agc_manager.h',
+          ],
+        },
+        {
+          'target_name': 'agc_test_utils',
+          'type': 'static_library',
+          'sources': [
+            'agc/test_utils.cc',
+            'agc/test_utils.h',
           ],
         },
         {
@@ -126,7 +134,7 @@
             'agc_manager',
           ],
           'sources': [
-            '<(webrtc_root)/modules/audio_processing/agc/test/agc_harness.cc',
+            'agc/agc_harness.cc',
           ],
         },  # agc_harness
         {
@@ -139,10 +147,10 @@
             '<(webrtc_root)/test/test.gyp:test_support',
             '<(webrtc_root)/system_wrappers/system_wrappers.gyp:system_wrappers_default',
             'agc_manager',
+            'agc_test_utils',
           ],
           'sources': [
-            '<(webrtc_root)/modules/audio_processing/agc/test/agc_test.cc',
-            '<(webrtc_root)/modules/audio_processing/agc/test/test_utils.cc',
+            'agc/agc_test.cc',
           ],
         },  # agc_proc
         {
@@ -154,7 +162,7 @@
             'agc_manager',
           ],
           'sources': [
-            '<(webrtc_root)/modules/audio_processing/agc/test/activity_metric.cc',
+            'agc/activity_metric.cc',
           ],
         },  # activity_metric
         {
diff --git a/webrtc/webrtc_tests.gypi b/webrtc/webrtc_tests.gypi
index 3f772eb..543ffc4 100644
--- a/webrtc/webrtc_tests.gypi
+++ b/webrtc/webrtc_tests.gypi
@@ -96,13 +96,13 @@
       'target_name': 'video_engine_tests',
       'type': '<(gtest_target_type)',
       'sources': [
-        'modules/audio_processing/agc/test/agc_manager_unittest.cc',
+        'test/common_unittest.cc',
+        'test/testsupport/metrics/video_metrics_unittest.cc',
+        'tools/agc/agc_manager_unittest.cc',
         'video/bitrate_estimator_tests.cc',
         'video/end_to_end_tests.cc',
         'video/send_statistics_proxy_unittest.cc',
         'video/video_send_stream_tests.cc',
-        'test/common_unittest.cc',
-        'test/testsupport/metrics/video_metrics_unittest.cc',
       ],
       'dependencies': [
         '<(DEPTH)/testing/gmock.gyp:gmock',
@@ -131,7 +131,7 @@
       'type': '<(gtest_target_type)',
       'sources': [
         'modules/audio_coding/neteq/test/neteq_performance_unittest.cc',
-        'modules/audio_processing/agc/test/agc_manager_integrationtest.cc',
+        'tools/agc/agc_manager_integrationtest.cc',
         'video/call_perf_tests.cc',
         'video/full_stack.cc',
         'video/rampup_tests.cc',