Don't target top-level test gyps if include_tests==0

Also add the possibility to pass a flag to the gyp run during gclient hooks.

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

git-svn-id: http://webrtc.googlecode.com/svn/trunk@2582 4adac7df-926f-26a2-2b94-8c16560cd09d
diff --git a/DEPS b/DEPS
index ce715a3..3031a22 100644
--- a/DEPS
+++ b/DEPS
@@ -4,6 +4,7 @@
   # Override root_dir in your .gclient's custom_vars to specify a custom root
   # folder name.
   "root_dir": "trunk",
+  "extra_gyp_flag": "-Dextra_gyp_flag=0",
 
   # Use this googlecode_url variable only if there is an internal mirror for it.
   # If you do not know, use the full path while defining your new deps entry.
@@ -121,7 +122,8 @@
     # A change to a .gyp, .gypi, or to GYP itself should run the generator.
     "pattern": ".",
     "action": ["python", Var("root_dir") + "/build/gyp_chromium",
-               "--depth=" + Var("root_dir"), Var("root_dir") + "/webrtc.gyp"],
+               "--depth=" + Var("root_dir"), Var("root_dir") + "/webrtc.gyp",
+               Var("extra_gyp_flag")],
   },
 ]
 
diff --git a/webrtc.gyp b/webrtc.gyp
index 74173d0..c729eb8 100644
--- a/webrtc.gyp
+++ b/webrtc.gyp
@@ -19,11 +19,17 @@
         'src/system_wrappers/source/system_wrappers.gyp:*',
         'src/video_engine/video_engine.gyp:*',
         'src/voice_engine/voice_engine.gyp:*',
-        'src/test/metrics.gyp:*',
-        'src/test/test.gyp:*',
-        'tools/e2e_quality/e2e_quality.gyp:*',
         '<(webrtc_vp8_dir)/vp8.gyp:*'
       ],
+      'conditions': [
+        ['include_tests==1', {
+          'dependencies': [
+            'src/test/metrics.gyp:*',
+            'src/test/test.gyp:*',
+            'tools/e2e_quality/e2e_quality.gyp:*',
+          ],
+        }],
+      ],
     },
   ],
 }