Bug 830247: Update media/webrtc/trunk except /webrtc (tools, etc) r=derf
authorRandell Jesup <rjesup@jesup.org>
Sat, 09 Feb 2013 23:16:09 -0500
changeset 131331 6a273b6bcd01420997bea81d1a0d38d9cb4eda89
parent 131330 266b7ce809a87f5dfd417b08d218d4c49ec3791a
child 131332 45dcba9211fa2f1f99e638aab13d97aeb74b2e63
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersderf
bugs830247
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 830247: Update media/webrtc/trunk except /webrtc (tools, etc) r=derf
media/webrtc/trunk/DEPS
media/webrtc/trunk/Makefile.old
media/webrtc/trunk/build/all.gyp
media/webrtc/trunk/build/all_android.gyp
media/webrtc/trunk/build/android/adb_device_functions.sh
media/webrtc/trunk/build/android/adb_install_content_shell
media/webrtc/trunk/build/android/ant/chromium-jars.xml
media/webrtc/trunk/build/android/ant/common.xml
media/webrtc/trunk/build/android/ant/sdk-targets.xml
media/webrtc/trunk/build/android/buildbot.sh
media/webrtc/trunk/build/android/buildbot_functions.sh
media/webrtc/trunk/build/android/buildbot_fyi_builder.sh
media/webrtc/trunk/build/android/buildbot_fyi_tester.sh
media/webrtc/trunk/build/android/buildbot_main.sh
media/webrtc/trunk/build/android/buildbot_try_builder.sh
media/webrtc/trunk/build/android/buildbot_try_compile.sh
media/webrtc/trunk/build/android/buildbot_try_compile_test.sh
media/webrtc/trunk/build/android/buildbot_try_tester.sh
media/webrtc/trunk/build/android/buildbot_webkit_main.sh
media/webrtc/trunk/build/android/device_status_check.py
media/webrtc/trunk/build/android/emulator.py
media/webrtc/trunk/build/android/envsetup.sh
media/webrtc/trunk/build/android/envsetup_functions.sh
media/webrtc/trunk/build/android/gdb_apk
media/webrtc/trunk/build/android/gtest_filter/content_unittests_disabled
media/webrtc/trunk/build/android/gtest_filter/media_unittests_disabled
media/webrtc/trunk/build/android/gtest_filter/net_unittests_disabled
media/webrtc/trunk/build/android/gtest_filter/unit_tests_disabled
media/webrtc/trunk/build/android/lighttpd_server.py
media/webrtc/trunk/build/android/pylib/android_commands.py
media/webrtc/trunk/build/android/pylib/base_test_runner.py
media/webrtc/trunk/build/android/pylib/base_test_sharder.py
media/webrtc/trunk/build/android/pylib/buildbot_report.py
media/webrtc/trunk/build/android/pylib/chrome_test_server_spawner.py
media/webrtc/trunk/build/android/pylib/constants.py
media/webrtc/trunk/build/android/pylib/device_stats_monitor.py
media/webrtc/trunk/build/android/pylib/fake_dns.py
media/webrtc/trunk/build/android/pylib/flag_changer.py
media/webrtc/trunk/build/android/pylib/forwarder.py
media/webrtc/trunk/build/android/pylib/json_perf_parser.py
media/webrtc/trunk/build/android/pylib/perf_tests_helper.py
media/webrtc/trunk/build/android/pylib/ports.py
media/webrtc/trunk/build/android/pylib/python_test_base.py
media/webrtc/trunk/build/android/pylib/python_test_caller.py
media/webrtc/trunk/build/android/pylib/python_test_sharder.py
media/webrtc/trunk/build/android/pylib/run_java_tests.py
media/webrtc/trunk/build/android/pylib/run_python_tests.py
media/webrtc/trunk/build/android/pylib/sharded_tests_queue.py
media/webrtc/trunk/build/android/pylib/single_test_runner.py
media/webrtc/trunk/build/android/pylib/test_options_parser.py
media/webrtc/trunk/build/android/pylib/test_package.py
media/webrtc/trunk/build/android/pylib/test_package_apk.py
media/webrtc/trunk/build/android/pylib/test_package_executable.py
media/webrtc/trunk/build/android/pylib/test_result.py
media/webrtc/trunk/build/android/pylib/valgrind_tools.py
media/webrtc/trunk/build/android/run_instrumentation_tests.py
media/webrtc/trunk/build/android/run_tests.py
media/webrtc/trunk/build/apk_test.gypi
media/webrtc/trunk/build/common.gypi
media/webrtc/trunk/build/common_untrusted.gypi
media/webrtc/trunk/build/filename_rules.gypi
media/webrtc/trunk/build/gdb-add-index
media/webrtc/trunk/build/install-build-deps-android.sh
media/webrtc/trunk/build/install-build-deps.sh
media/webrtc/trunk/build/install-chroot.sh
media/webrtc/trunk/build/java.gypi
media/webrtc/trunk/build/java_aidl.gypi
media/webrtc/trunk/build/linux/system.gyp
media/webrtc/trunk/build/mac/find_sdk.py
media/webrtc/trunk/build/protoc.gypi
media/webrtc/trunk/build/whitespace_file.txt
media/webrtc/trunk/google_apis/build/check_internal.py
media/webrtc/trunk/peerconnection.gyp
media/webrtc/trunk/peerconnection_client.target.mk
media/webrtc/trunk/third_party/libyuv/DEPS
media/webrtc/trunk/third_party/libyuv/README.chromium
media/webrtc/trunk/third_party/libyuv/codereview.settings
media/webrtc/trunk/third_party/libyuv/include/libyuv/basic_types.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/compare.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/convert.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/convert_argb.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/convert_from.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/cpu_id.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/format_conversion.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/mjpeg_decoder.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/planar_functions.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/rotate.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/rotate_argb.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/row.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/scale.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/scale_argb.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/version.h
media/webrtc/trunk/third_party/libyuv/include/libyuv/video_common.h
media/webrtc/trunk/third_party/libyuv/libyuv.gyp
media/webrtc/trunk/third_party/libyuv/libyuv.target.mk
media/webrtc/trunk/third_party/libyuv/libyuv_test.gyp
media/webrtc/trunk/third_party/libyuv/source/compare.cc
media/webrtc/trunk/third_party/libyuv/source/convert.cc
media/webrtc/trunk/third_party/libyuv/source/convert_argb.cc
media/webrtc/trunk/third_party/libyuv/source/convert_from.cc
media/webrtc/trunk/third_party/libyuv/source/cpu_id.cc
media/webrtc/trunk/third_party/libyuv/source/format_conversion.cc
media/webrtc/trunk/third_party/libyuv/source/planar_functions.cc
media/webrtc/trunk/third_party/libyuv/source/rotate.cc
media/webrtc/trunk/third_party/libyuv/source/rotate_argb.cc
media/webrtc/trunk/third_party/libyuv/source/rotate_neon.cc
media/webrtc/trunk/third_party/libyuv/source/row.h
media/webrtc/trunk/third_party/libyuv/source/row_common.cc
media/webrtc/trunk/third_party/libyuv/source/row_neon.cc
media/webrtc/trunk/third_party/libyuv/source/row_posix.cc
media/webrtc/trunk/third_party/libyuv/source/row_win.cc
media/webrtc/trunk/third_party/libyuv/source/scale.cc
media/webrtc/trunk/third_party/libyuv/source/scale_argb.cc
media/webrtc/trunk/third_party/libyuv/source/video_common.cc
media/webrtc/trunk/third_party/libyuv/unit_test/compare_test.cc
media/webrtc/trunk/third_party/libyuv/unit_test/cpu_test.cc
media/webrtc/trunk/third_party/libyuv/unit_test/planar_test.cc
media/webrtc/trunk/third_party/libyuv/unit_test/rotate_argb_test.cc
media/webrtc/trunk/third_party/libyuv/unit_test/rotate_test.cc
media/webrtc/trunk/third_party/libyuv/unit_test/scale_argb_test.cc
media/webrtc/trunk/third_party/libyuv/unit_test/scale_test.cc
media/webrtc/trunk/third_party/libyuv/unit_test/unit_test.cc
media/webrtc/trunk/third_party/libyuv/unit_test/unit_test.h
media/webrtc/trunk/third_party/libyuv/unit_test/version_test.cc
media/webrtc/trunk/third_party/libyuv/util/compare.cc
media/webrtc/trunk/tools/clang/plugins/ChromeClassTester.cpp
media/webrtc/trunk/tools/clang/plugins/ChromeClassTester.h
media/webrtc/trunk/tools/clang/plugins/FindBadConstructs.cpp
media/webrtc/trunk/tools/clang/scripts/plugin_flags.sh
media/webrtc/trunk/tools/clang/scripts/update.sh
media/webrtc/trunk/tools/gyp/gyptest.py
media/webrtc/trunk/tools/gyp/pylib/gyp/MSVSNew.py
media/webrtc/trunk/tools/gyp/pylib/gyp/MSVSVersion.py
media/webrtc/trunk/tools/gyp/pylib/gyp/__init__.py
media/webrtc/trunk/tools/gyp/pylib/gyp/common.py
media/webrtc/trunk/tools/gyp/pylib/gyp/common_test.py
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/android.py
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/dump_dependency_json.py
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/make.py
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/msvs.py
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/msvs_test.py
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/ninja.py
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/scons.py
media/webrtc/trunk/tools/gyp/pylib/gyp/generator/xcode.py
media/webrtc/trunk/tools/gyp/pylib/gyp/input.py
media/webrtc/trunk/tools/gyp/pylib/gyp/ninja_syntax.py
media/webrtc/trunk/tools/gyp/pylib/gyp/win_tool.py
media/webrtc/trunk/tools/gyp/pylib/gyp/xcode_emulation.py
media/webrtc/trunk/tools/gyp/pylib/gyp/xcodeproj_file.py
media/webrtc/trunk/tools/gyp/test/configurations/invalid/gyptest-configurations.py
media/webrtc/trunk/tools/gyp/test/lib/TestGyp.py
media/webrtc/trunk/tools/gyp/test/mac/gyptest-xcode-env-order.py
media/webrtc/trunk/tools/gyp/test/mac/sdkroot/test.gyp
media/webrtc/trunk/tools/gyp/test/mac/type_envvars/test_bundle_executable.sh
media/webrtc/trunk/tools/gyp/test/mac/type_envvars/test_bundle_loadable_module.sh
media/webrtc/trunk/tools/gyp/test/mac/type_envvars/test_bundle_shared_library.sh
media/webrtc/trunk/tools/gyp/test/mac/type_envvars/test_nonbundle_executable.sh
media/webrtc/trunk/tools/gyp/test/mac/type_envvars/test_nonbundle_loadable_module.sh
media/webrtc/trunk/tools/gyp/test/mac/type_envvars/test_nonbundle_none.sh
media/webrtc/trunk/tools/gyp/test/mac/type_envvars/test_nonbundle_shared_library.sh
media/webrtc/trunk/tools/gyp/test/mac/type_envvars/test_nonbundle_static_library.sh
media/webrtc/trunk/tools/gyp/test/mac/xcode-env-order/test.gyp
media/webrtc/trunk/tools/gyp/test/same-gyp-name/gyptest-all.py
media/webrtc/trunk/tools/gyp/test/same-gyp-name/gyptest-default.py
media/webrtc/trunk/tools/gyp/test/variables/commands/gyptest-commands.py
media/webrtc/trunk/tools/gyp/test/win/gyptest-rc-build.py
--- a/media/webrtc/trunk/DEPS
+++ b/media/webrtc/trunk/DEPS
@@ -1,17 +1,17 @@
 vars = {
   # 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.
   "googlecode_url": "http://%s.googlecode.com/svn",
   "chromium_trunk" : "http://src.chromium.org/svn/trunk",
-  "chromium_revision": "153489",
+  "chromium_revision": "162524",
   # Still needs the libjingle_revision here because some of
   # the deps have to be pulled from libjingle repository.
-  "libjingle_revision": "175",
+  "libjingle_revision": "204",
 }
 
 # NOTE: Prefer revision numbers to tags for svn deps. Use http rather than
 # https; the latter can cause problems for users behind proxies.
 deps = {
   "trunk/chromium_deps":
     File(Var("chromium_trunk") + "/src/DEPS@" + Var("chromium_revision")),
 
@@ -23,16 +23,20 @@ deps = {
     From("trunk/chromium_deps", "src/third_party/libvpx"),
 
   "trunk/third_party/opus/source":
     "http://git.opus-codec.org/opus.git",
 
   "trunk/build":
     Var("chromium_trunk") + "/src/build@" + Var("chromium_revision"),
 
+  # Needed by common.gypi.
+  "trunk/google_apis/build":
+    Var("chromium_trunk") + "/src/google_apis/build@" + Var("chromium_revision"),
+
   "trunk/testing/gtest":
     From("trunk/chromium_deps", "src/testing/gtest"),
 
   "trunk/tools/gyp":
     From("trunk/chromium_deps", "src/tools/gyp"),
 
   "trunk/tools/clang":
     Var("chromium_trunk") + "/src/tools/clang@" + Var("chromium_revision"),
@@ -100,14 +104,23 @@ deps_os = {
 hooks = [
   {
     # Pull clang on mac. If nothing changed, or on non-mac platforms, this takes
     # zero seconds to run. If something changed, it downloads a prebuilt clang.
     "pattern": ".",
     "action": ["python", "trunk/tools/clang/scripts/update.py", "--mac-only"],
   },
   {
+    # Update the cygwin mount on Windows.
+    # This is necessary to get the correct mapping between e.g. /bin and the
+    # cygwin path on Windows. Without it we can't run bash scripts in actions.
+    # Ideally this should be solved in "pylib/gyp/msvs_emulation.py".
+    "pattern": ".",
+    "action": ["python", "trunk/build/win/setup_cygwin_mount.py",
+               "--win-only"],
+  },
+  {
     # A change to a .gyp, .gypi, or to GYP itself should run the generator.
     "pattern": ".",
-    "action": ["python", "trunk/build/gyp_chromium", "--depth=trunk", "trunk/peerconnection.gyp"],
+    "action": ["python", "trunk/build/gyp_chromium", "--depth=trunk", "trunk/peerconnection_all.gyp"],
   },
 ]
 
--- a/media/webrtc/trunk/Makefile.old
+++ b/media/webrtc/trunk/Makefile.old
@@ -3,19 +3,20 @@
 
 # The implicit make rules have it looking for RCS files, among other things.
 # We instead explicitly write all the rules we care about.
 # It's even quicker (saves ~200ms) to pass -r on the command line.
 MAKEFLAGS=-r
 
 # The source directory tree.
 srcdir := .
+abs_srcdir := $(abspath $(srcdir))
 
 # The name of the builddir.
-builddir_name ?= $(OBJDIR)/media/webrtc/out
+builddir_name ?= out
 
 # The V=1 flag on command line makes us verbosely print command lines.
 ifdef V
   quiet=
 else
   quiet=quiet_
 endif
 
@@ -32,49 +33,46 @@ depsdir := $(builddir)/.deps
 # Object output directory.
 obj := $(builddir)/obj
 abs_obj := $(abspath $(obj))
 
 # We build up a list of every single one of the targets so we can slurp in the
 # generated dependency rule Makefiles in one pass.
 all_deps :=
 
-# C++ apps need to be linked with g++.  Not sure what's appropriate.
+
+
+# C++ apps need to be linked with g++.
 #
-# Note, the flock is used to seralize linking. Linking is a memory-intensive
+# Note: flock is used to seralize linking. Linking is a memory-intensive
 # process so running parallel links can often lead to thrashing.  To disable
-# the serialization, override FLOCK via an envrionment variable as follows:
+# the serialization, override LINK via an envrionment variable as follows:
 #
-#   export FLOCK=
+#   export LINK=g++
 #
 # This will allow make to invoke N linker processes as specified in -jN.
-FLOCK ?= flock $(builddir)/linker.lock
-LINK ?= $(FLOCK) $(CXX)
+LINK ?= flock $(builddir)/linker.lock $(CXX)
 
 CC.target ?= $(CC)
 CFLAGS.target ?= $(CFLAGS)
 CXX.target ?= $(CXX)
 CXXFLAGS.target ?= $(CXXFLAGS)
 LINK.target ?= $(LINK)
-LDFLAGS.target ?= $(LDFLAGS) 
+LDFLAGS.target ?= $(LDFLAGS)
 AR.target ?= $(AR)
-ARFLAGS.target ?= crsT
 
-# N.B.: the logic of which commands to run should match the computation done
-# in gyp's make.py where ARFLAGS.host etc. is computed.
 # TODO(evan): move all cross-compilation logic to gyp-time so we don't need
 # to replicate this environment fallback in make as well.
 CC.host ?= gcc
 CFLAGS.host ?=
 CXX.host ?= g++
 CXXFLAGS.host ?=
 LINK.host ?= g++
 LDFLAGS.host ?=
 AR.host ?= ar
-ARFLAGS.host := crsT
 
 # Define a dir function that can handle spaces.
 # http://www.gnu.org/software/make/manual/make.html#Syntax-of-Functions
 # "leading spaces cannot appear in the text of the first argument as written.
 # These characters can be put into the argument value by variable substitution."
 empty :=
 space := $(empty) $(empty)
 
@@ -139,17 +137,20 @@ cmd_cxx = $(CXX.$(TOOLSET)) $(GYP_CXXFLA
 quiet_cmd_touch = TOUCH $@
 cmd_touch = touch $@
 
 quiet_cmd_copy = COPY $@
 # send stderr to /dev/null to ignore messages when linking directories.
 cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@")
 
 quiet_cmd_alink = AR($(TOOLSET)) $@
-cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) $(ARFLAGS.$(TOOLSET)) $@ $(filter %.o,$^)
+cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^)
+
+quiet_cmd_alink_thin = AR($(TOOLSET)) $@
+cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^)
 
 # Due to circular dependencies between libraries :(, we wrap the
 # special "figure out circular dependencies" flags around the entire
 # input list during linking.
 quiet_cmd_link = LINK($(TOOLSET)) $@
 cmd_link = $(LINK.$(TOOLSET)) $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -o $@ -Wl,--start-group $(LD_INPUTS) -Wl,--end-group $(LIBS)
 
 # We support two kinds of shared objects (.so):
@@ -206,16 +207,33 @@ command_changed = $(or $(subst $(cmd_$(1
 
 # Helper that is non-empty when a prerequisite changes.
 # Normally make does this implicitly, but we force rules to always run
 # so we can check their command lines.
 #   $? -- new prerequisites
 #   $| -- order-only dependencies
 prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?))
 
+# Helper that executes all postbuilds, and deletes the output file when done
+# if any of the postbuilds failed.
+define do_postbuilds
+  @E=0;\
+  for p in $(POSTBUILDS); do\
+    eval $$p;\
+    F=$$?;\
+    if [ $$F -ne 0 ]; then\
+      E=$$F;\
+    fi;\
+  done;\
+  if [ $$E -ne 0 ]; then\
+    rm -rf "$@";\
+    exit $$E;\
+  fi
+endef
+
 # do_cmd: run a command via the above cmd_foo names, if necessary.
 # Should always run for a given target to handle command-line changes.
 # Second argument, if non-zero, makes it do asm/C/C++ dependency munging.
 # Third argument, if non-zero, makes it do POSTBUILDS processing.
 # Note: We intentionally do NOT call dirx for depfile, since it contains ? for
 # spaces already and dirx strips the ? characters.
 define do_cmd
 $(if $(or $(command_changed),$(prereq_changed)),
@@ -224,26 +242,31 @@ define do_cmd
   $(if $(findstring flock,$(word 1,$(cmd_$1))),
     @$(cmd_$(1))
     @echo "  $(quiet_cmd_$(1)): Finished",
     @$(cmd_$(1))
   )
   @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile)
   @$(if $(2),$(fixup_dep))
   $(if $(and $(3), $(POSTBUILDS)),
-    @for p in $(POSTBUILDS); do eval $$p; done
+    $(call do_postbuilds)
   )
 )
 endef
 
-# Declare "all" target first so it is the default, even though we don't have the
-# deps yet.
+# Declare the "all" target first so it is the default,
+# even though we don't have the deps yet.
 .PHONY: all
 all:
 
+# make looks for ways to re-generate included makefiles, but in our case, we
+# don't have a direct way. Explicitly telling make that it has nothing to do
+# for them makes it go faster.
+%.d: ;
+
 # Use FORCE_DO_CMD to force a target to run.  Should be coupled with
 # do_cmd.
 .PHONY: FORCE_DO_CMD
 FORCE_DO_CMD:
 
 TOOLSET := host
 # Suffix rules, putting all outputs into $(obj).
 $(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD
@@ -331,456 +354,176 @@ TOOLSET := target
 
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
                  $(join ^,All.target.mk)))),)
   include All.target.mk
 endif
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
-                 $(join ^,peerconnection_client.target.mk)))),)
-  include peerconnection_client.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,peerconnection_server.target.mk)))),)
-  include peerconnection_server.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/common_audio/common_audio_unittests.target.mk)))),)
-  include src/common_audio/common_audio_unittests.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/common_audio/resampler.target.mk)))),)
-  include src/common_audio/resampler.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/common_audio/spl.target.mk)))),)
-  include src/common_audio/spl.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/common_audio/vad.target.mk)))),)
-  include src/common_audio/vad.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/common_video/jpeg_test.target.mk)))),)
-  include src/common_video/jpeg_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/common_video/vplib_test.target.mk)))),)
-  include src/common_video/vplib_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/common_video/webrtc_jpeg.target.mk)))),)
-  include src/common_video/webrtc_jpeg.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/common_video/webrtc_vplib.target.mk)))),)
-  include src/common_video/webrtc_vplib.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/CNG.target.mk)))),)
-  include src/modules/CNG.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/G711.target.mk)))),)
-  include src/modules/G711.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/G722.target.mk)))),)
-  include src/modules/G722.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/G722Test.target.mk)))),)
-  include src/modules/G722Test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/NetEq.target.mk)))),)
-  include src/modules/NetEq.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/NetEqRTPplay.target.mk)))),)
-  include src/modules/NetEqRTPplay.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/NetEqTestTools.target.mk)))),)
-  include src/modules/NetEqTestTools.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/PCM16B.target.mk)))),)
-  include src/modules/PCM16B.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/RTPanalyze.target.mk)))),)
-  include src/modules/RTPanalyze.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/RTPcat.target.mk)))),)
-  include src/modules/RTPcat.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/RTPchange.target.mk)))),)
-  include src/modules/RTPchange.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/RTPencode.target.mk)))),)
-  include src/modules/RTPencode.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/RTPjitter.target.mk)))),)
-  include src/modules/RTPjitter.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/RTPtimeshift.target.mk)))),)
-  include src/modules/RTPtimeshift.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/VPMUnitTest.target.mk)))),)
-  include src/modules/VPMUnitTest.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/aec.target.mk)))),)
-  include src/modules/aec.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/aecm.target.mk)))),)
-  include src/modules/aecm.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/agc.target.mk)))),)
-  include src/modules/agc.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/apm_util.target.mk)))),)
-  include src/modules/apm_util.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/audio_coding_module.target.mk)))),)
-  include src/modules/audio_coding_module.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/audio_coding_module_test.target.mk)))),)
-  include src/modules/audio_coding_module_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/audio_conference_mixer.target.mk)))),)
-  include src/modules/audio_conference_mixer.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/audio_device.target.mk)))),)
-  include src/modules/audio_device.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/audio_device_test_api.target.mk)))),)
-  include src/modules/audio_device_test_api.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/audio_device_test_func.target.mk)))),)
-  include src/modules/audio_device_test_func.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/audio_processing.target.mk)))),)
-  include src/modules/audio_processing.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/audioproc_process_test.target.mk)))),)
-  include src/modules/audioproc_process_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/audioproc_unittest.target.mk)))),)
-  include src/modules/audioproc_unittest.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/audioproc_unittest_proto.target.mk)))),)
-  include src/modules/audioproc_unittest_proto.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/debug_proto.target.mk)))),)
-  include src/modules/debug_proto.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/g711_test.target.mk)))),)
-  include src/modules/g711_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/iLBC.target.mk)))),)
-  include src/modules/iLBC.target.mk
+                 $(join ^,base/base.target.mk)))),)
+  include base/base.target.mk
 endif
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/iLBCtest.target.mk)))),)
-  include src/modules/iLBCtest.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/iSAC.target.mk)))),)
-  include src/modules/iSAC.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/iSACAPITest.target.mk)))),)
-  include src/modules/iSACAPITest.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/iSACFix.target.mk)))),)
-  include src/modules/iSACFix.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/iSACFixtest.target.mk)))),)
-  include src/modules/iSACFixtest.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/iSACSwitchSampRateTest.target.mk)))),)
-  include src/modules/iSACSwitchSampRateTest.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/iSACtest.target.mk)))),)
-  include src/modules/iSACtest.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/media_file.target.mk)))),)
-  include src/modules/media_file.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/ns.target.mk)))),)
-  include src/modules/ns.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/ns_fix.target.mk)))),)
-  include src/modules/ns_fix.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/rtcp_format_remb_unittest.target.mk)))),)
-  include src/modules/rtcp_format_remb_unittest.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/rtp_format_vp8_unittest.target.mk)))),)
-  include src/modules/rtp_format_vp8_unittest.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/rtp_rtcp.target.mk)))),)
-  include src/modules/rtp_rtcp.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/rtp_utility_test.target.mk)))),)
-  include src/modules/rtp_utility_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/test_bwe.target.mk)))),)
-  include src/modules/test_bwe.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/test_fec.target.mk)))),)
-  include src/modules/test_fec.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/test_framework.target.mk)))),)
-  include src/modules/test_framework.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/udp_transport.target.mk)))),)
-  include src/modules/udp_transport.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/video_capture_module.target.mk)))),)
-  include src/modules/video_capture_module.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/video_capture_module_test.target.mk)))),)
-  include src/modules/video_capture_module_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/video_coding_test.target.mk)))),)
-  include src/modules/video_coding_test.target.mk
+                 $(join ^,net/net.target.mk)))),)
+  include net/net.target.mk
 endif
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/video_coding_test_lib.target.mk)))),)
-  include src/modules/video_coding_test_lib.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/video_coding_unit_test.target.mk)))),)
-  include src/modules/video_coding_unit_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/video_processing.target.mk)))),)
-  include src/modules/video_processing.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/video_render_module.target.mk)))),)
-  include src/modules/video_render_module.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/video_render_module_test.target.mk)))),)
-  include src/modules/video_render_module_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/vp8_test.target.mk)))),)
-  include src/modules/vp8_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/webrtc_i420.target.mk)))),)
-  include src/modules/webrtc_i420.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/webrtc_utility.target.mk)))),)
-  include src/modules/webrtc_utility.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/webrtc_video_coding.target.mk)))),)
-  include src/modules/webrtc_video_coding.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/modules/webrtc_vp8.target.mk)))),)
-  include src/modules/webrtc_vp8.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/system_wrappers/source/system_wrappers.target.mk)))),)
-  include src/system_wrappers/source/system_wrappers.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/system_wrappers/source/system_wrappersTest.target.mk)))),)
-  include src/system_wrappers/source/system_wrappersTest.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/video_engine/merged_lib.target.mk)))),)
-  include src/video_engine/merged_lib.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/video_engine/video_engine_core.target.mk)))),)
-  include src/video_engine/video_engine_core.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/video_engine/vie_auto_test.target.mk)))),)
-  include src/video_engine/vie_auto_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/voice_engine/merged_lib_voice.target.mk)))),)
-  include src/voice_engine/merged_lib_voice.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/voice_engine/voe_auto_test.target.mk)))),)
-  include src/voice_engine/voe_auto_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/voice_engine/voe_cmd_test.target.mk)))),)
-  include src/voice_engine/voe_cmd_test.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,src/voice_engine/voice_engine_core.target.mk)))),)
-  include src/voice_engine/voice_engine_core.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,test/test_support.target.mk)))),)
-  include test/test_support.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,testing/gtest.target.mk)))),)
-  include testing/gtest.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,testing/gtest_main.target.mk)))),)
-  include testing/gtest_main.target.mk
+                 $(join ^,peerconnection_client.target.mk)))),)
+  include peerconnection_client.target.mk
 endif
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
                  $(join ^,third_party/expat/expat.target.mk)))),)
   include third_party/expat/expat.target.mk
 endif
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/jsoncpp/jsoncpp.target.mk)))),)
+  include third_party/jsoncpp/jsoncpp.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libjingle/libjingle.target.mk)))),)
+  include third_party/libjingle/libjingle.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libjingle/libjingle_p2p.target.mk)))),)
+  include third_party/libjingle/libjingle_p2p.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libjingle/libjingle_peerconnection.target.mk)))),)
+  include third_party/libjingle/libjingle_peerconnection.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libjingle/peerconnection_server.target.mk)))),)
+  include third_party/libjingle/peerconnection_server.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
                  $(join ^,third_party/libjpeg_turbo/libjpeg.target.mk)))),)
   include third_party/libjpeg_turbo/libjpeg.target.mk
 endif
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/libsrtp.target.mk)))),)
+  include third_party/libsrtp/libsrtp.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/rdbx_driver.target.mk)))),)
+  include third_party/libsrtp/rdbx_driver.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/replay_driver.target.mk)))),)
+  include third_party/libsrtp/replay_driver.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/roc_driver.target.mk)))),)
+  include third_party/libsrtp/roc_driver.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/rtpw.target.mk)))),)
+  include third_party/libsrtp/rtpw.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/srtp_driver.target.mk)))),)
+  include third_party/libsrtp/srtp_driver.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/srtp_runtest.target.mk)))),)
+  include third_party/libsrtp/srtp_runtest.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/srtp_test_aes_calc.target.mk)))),)
+  include third_party/libsrtp/srtp_test_aes_calc.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/srtp_test_cipher_driver.target.mk)))),)
+  include third_party/libsrtp/srtp_test_cipher_driver.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/srtp_test_datatypes_driver.target.mk)))),)
+  include third_party/libsrtp/srtp_test_datatypes_driver.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/srtp_test_env.target.mk)))),)
+  include third_party/libsrtp/srtp_test_env.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/srtp_test_kernel_driver.target.mk)))),)
+  include third_party/libsrtp/srtp_test_kernel_driver.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/srtp_test_rand_gen.target.mk)))),)
+  include third_party/libsrtp/srtp_test_rand_gen.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/srtp_test_sha1_driver.target.mk)))),)
+  include third_party/libsrtp/srtp_test_sha1_driver.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libsrtp/srtp_test_stat_driver.target.mk)))),)
+  include third_party/libsrtp/srtp_test_stat_driver.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libvpx/gen_asm_offsets.target.mk)))),)
+  include third_party/libvpx/gen_asm_offsets.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
                  $(join ^,third_party/libvpx/libvpx.target.mk)))),)
   include third_party/libvpx/libvpx.target.mk
 endif
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libvpx/libvpx_asm_offsets.target.mk)))),)
+  include third_party/libvpx/libvpx_asm_offsets.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libvpx/libvpx_obj_int_extract.host.mk)))),)
+  include third_party/libvpx/libvpx_obj_int_extract.host.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libvpx/simple_decoder.target.mk)))),)
+  include third_party/libvpx/simple_decoder.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libvpx/simple_encoder.target.mk)))),)
+  include third_party/libvpx/simple_encoder.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/libyuv/libyuv.target.mk)))),)
+  include third_party/libyuv/libyuv.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
                  $(join ^,third_party/protobuf/protobuf_full_do_not_use.host.mk)))),)
   include third_party/protobuf/protobuf_full_do_not_use.host.mk
 endif
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
                  $(join ^,third_party/protobuf/protobuf_full_do_not_use.target.mk)))),)
   include third_party/protobuf/protobuf_full_do_not_use.target.mk
 endif
@@ -801,16 +544,186 @@ ifeq ($(strip $(foreach prefix,$(NO_LOAD
 endif
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
                  $(join ^,third_party/protobuf/py_proto.target.mk)))),)
   include third_party/protobuf/py_proto.target.mk
 endif
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/common_audio/resampler.target.mk)))),)
+  include third_party/webrtc/common_audio/resampler.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/common_audio/signal_processing.target.mk)))),)
+  include third_party/webrtc/common_audio/signal_processing.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/common_audio/vad.target.mk)))),)
+  include third_party/webrtc/common_audio/vad.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/common_video/common_video.target.mk)))),)
+  include third_party/webrtc/common_video/common_video.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/CNG.target.mk)))),)
+  include third_party/webrtc/modules/CNG.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/G711.target.mk)))),)
+  include third_party/webrtc/modules/G711.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/G722.target.mk)))),)
+  include third_party/webrtc/modules/G722.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/NetEq.target.mk)))),)
+  include third_party/webrtc/modules/NetEq.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/PCM16B.target.mk)))),)
+  include third_party/webrtc/modules/PCM16B.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/audio_coding_module.target.mk)))),)
+  include third_party/webrtc/modules/audio_coding_module.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/audio_conference_mixer.target.mk)))),)
+  include third_party/webrtc/modules/audio_conference_mixer.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/audio_device.target.mk)))),)
+  include third_party/webrtc/modules/audio_device.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/audio_processing.target.mk)))),)
+  include third_party/webrtc/modules/audio_processing.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/audio_processing_sse2.target.mk)))),)
+  include third_party/webrtc/modules/audio_processing_sse2.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/audioproc_debug_proto.target.mk)))),)
+  include third_party/webrtc/modules/audioproc_debug_proto.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/bitrate_controller.target.mk)))),)
+  include third_party/webrtc/modules/bitrate_controller.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/iLBC.target.mk)))),)
+  include third_party/webrtc/modules/iLBC.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/iSAC.target.mk)))),)
+  include third_party/webrtc/modules/iSAC.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/iSACFix.target.mk)))),)
+  include third_party/webrtc/modules/iSACFix.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/media_file.target.mk)))),)
+  include third_party/webrtc/modules/media_file.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/remote_bitrate_estimator.target.mk)))),)
+  include third_party/webrtc/modules/remote_bitrate_estimator.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/rtp_rtcp.target.mk)))),)
+  include third_party/webrtc/modules/rtp_rtcp.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/udp_transport.target.mk)))),)
+  include third_party/webrtc/modules/udp_transport.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/video_capture_module.target.mk)))),)
+  include third_party/webrtc/modules/video_capture_module.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/video_coding/codecs/vp8/webrtc_vp8.target.mk)))),)
+  include third_party/webrtc/modules/video_coding/codecs/vp8/webrtc_vp8.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/video_processing.target.mk)))),)
+  include third_party/webrtc/modules/video_processing.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/video_processing_sse2.target.mk)))),)
+  include third_party/webrtc/modules/video_processing_sse2.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/video_render_module.target.mk)))),)
+  include third_party/webrtc/modules/video_render_module.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/webrtc_i420.target.mk)))),)
+  include third_party/webrtc/modules/webrtc_i420.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/webrtc_utility.target.mk)))),)
+  include third_party/webrtc/modules/webrtc_utility.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/modules/webrtc_video_coding.target.mk)))),)
+  include third_party/webrtc/modules/webrtc_video_coding.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/system_wrappers/source/system_wrappers.target.mk)))),)
+  include third_party/webrtc/system_wrappers/source/system_wrappers.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/video_engine/video_engine_core.target.mk)))),)
+  include third_party/webrtc/video_engine/video_engine_core.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
+                 $(join ^,third_party/webrtc/voice_engine/voice_engine_core.target.mk)))),)
+  include third_party/webrtc/voice_engine/voice_engine_core.target.mk
+endif
+ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
+    $(findstring $(join ^,$(prefix)),\
                  $(join ^,third_party/yasm/config_sources.host.mk)))),)
   include third_party/yasm/config_sources.host.mk
 endif
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
                  $(join ^,third_party/yasm/generate_files.host.mk)))),)
   include third_party/yasm/generate_files.host.mk
 endif
@@ -849,72 +762,24 @@ ifeq ($(strip $(foreach prefix,$(NO_LOAD
                  $(join ^,third_party/yasm/re2c.host.mk)))),)
   include third_party/yasm/re2c.host.mk
 endif
 ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
     $(findstring $(join ^,$(prefix)),\
                  $(join ^,third_party/yasm/yasm.host.mk)))),)
   include third_party/yasm/yasm.host.mk
 endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,third_party_mods/libjingle/jsoncpp.target.mk)))),)
-  include third_party_mods/libjingle/jsoncpp.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,third_party_mods/libjingle/libjingle.target.mk)))),)
-  include third_party_mods/libjingle/libjingle.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,third_party_mods/libjingle/libjingle_app.target.mk)))),)
-  include third_party_mods/libjingle/libjingle_app.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,third_party_mods/libjingle/libjingle_p2p.target.mk)))),)
-  include third_party_mods/libjingle/libjingle_p2p.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,third_party_mods/libjingle/peerconnection_client_dev.target.mk)))),)
-  include third_party_mods/libjingle/peerconnection_client_dev.target.mk
-endif
-ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
-    $(findstring $(join ^,$(prefix)),\
-                 $(join ^,third_party_mods/libjingle/peerconnection_unittests.target.mk)))),)
-  include third_party_mods/libjingle/peerconnection_unittests.target.mk
-endif
 
 quiet_cmd_regen_makefile = ACTION Regenerating $@
-cmd_regen_makefile = ./build/gyp_chromium -fmake --ignore-environment "--toplevel-dir=." -Ibuild/common.gypi -I/home/jesup/src/mozilla/webrtc/media/webrtc/trunk/src/supplement.gypi "--depth=." "-Goutput_dir=$(OBJDIR)/media/webrtc/out" webrtc.gyp
-Makefile: src/modules/udp_transport/source/udp_transport.gypi src/modules/video_processing/main/test/vpm_tests.gypi third_party/libvpx/input_files_win.gypi src/modules/modules.gyp src/common_audio/resampler/main/source/resampler.gypi third_party_mods/libjingle/libjingle.gyp src/modules/rtp_rtcp/source/rtp_rtcp.gypi src/modules/audio_coding/codecs/iSAC/isacfix_test.gypi src/build/common.gypi src/common_audio/signal_processing_library/main/source/spl.gypi src/modules/audio_processing/ns/main/source/ns.gypi third_party/expat/expat.gyp src/modules/audio_conference_mixer/source/audio_conference_mixer.gypi src/modules/video_coding/codecs/i420/main/source/i420.gypi src/modules/video_capture/main/source/video_capture.gypi build/internal/release_impl.gypi src/supplement.gypi src/voice_engine/voice_engine.gyp src/modules/audio_processing/aec/main/source/aec.gypi src/common_video/jpeg/main/source/jpeg.gypi src/common_settings.gypi src/modules/rtp_rtcp/test/testFec/test_fec.gypi third_party/libvpx/input_files_linux.gypi src/modules/video_processing/main/source/video_processing.gypi src/modules/audio_processing/utility/util.gypi src/common_video/common_video.gyp src/modules/media_file/source/media_file.gypi src/modules/audio_coding/codecs/PCM16B/main/source/pcm16b.gypi src/modules/video_coding/codecs/test_framework/test_framework.gypi build/internal/release_impl_official.gypi build/internal/release_defaults.gypi src/modules/audio_coding/codecs/iLBC/ilbc_test.gypi src/common_audio/common_audio.gyp src/common_video/vplib/main/source/vplib.gypi webrtc.gyp test/test.gyp src/modules/audio_coding/codecs/G711/main/source/g711.gypi src/voice_engine/main/test/voice_engine_tests.gypi third_party/yasm/yasm.gyp src/system_wrappers/source/system_wrappers.gyp src/modules/audio_coding/codecs/iLBC/main/source/ilbc.gypi src/modules/video_coding/main/source/video_coding_test.gypi src/voice_engine/main/source/voice_engine_core.gypi src/video_engine/main/source/video_engine_core.gypi src/video_engine/video_engine.gyp src/modules/audio_processing/main/apm_tests.gypi build/release.gypi third_party/libvpx/input_files_mac.gypi testing/gtest.gyp build/common.gypi src/modules/audio_processing/main/source/apm.gypi src/modules/audio_coding/codecs/iSAC/isac_test.gypi src/modules/video_coding/codecs/vp8/main/source/vp8.gypi src/modules/audio_processing/agc/main/source/agc.gypi src/modules/audio_coding/codecs/iSAC/main/source/isac.gypi src/modules/audio_coding/NetEQ/main/source/neteq.gypi src/modules/rtp_rtcp/test/test_bwe/test_bwe.gypi src/modules/audio_coding/codecs/CNG/main/source/cng.gypi src/modules/video_coding/main/source/video_coding.gypi third_party/libvpx/libvpx.gyp src/modules/audio_processing/aecm/main/source/aecm.gypi third_party/libjpeg_turbo/libjpeg.gyp src/modules/audio_coding/codecs/iSAC/fix/source/isacfix.gypi src/video_engine/main/test/WindowsTest/windowstest.gypi src/modules/audio_device/main/source/audio_device.gypi src/modules/audio_coding/main/source/audio_coding_module.gypi src/common_audio/vad/main/source/vad.gypi src/modules/video_render/main/source/video_render.gypi src/modules/rtp_rtcp/source/rtp_rtcp_tests.gypi src/modules/audio_coding/codecs/G722/main/source/g722.gypi src/video_engine/main/test/AutoTest/vie_auto_test.gypi src/modules/utility/source/utility.gypi third_party/protobuf/protobuf.gyp
+cmd_regen_makefile = ./build/gyp_chromium -fmake --ignore-environment "--toplevel-dir=." -I/home/jesup/src/mozilla/webrtc_import7/webrtc_update/trunk/build/common.gypi -I/home/jesup/src/mozilla/webrtc_import7/webrtc_update/trunk/supplement/supplement.gypi "--depth=." peerconnection_all.gyp
+Makefile: third_party/webrtc/build/common.gypi third_party/webrtc/common_video/common_video.gyp third_party/webrtc/video_engine/video_engine.gyp third_party/webrtc/modules/audio_coding/neteq/neteq.gypi third_party/libvpx/libvpx_srcs_arm.gypi build/filename_rules.gypi third_party/webrtc/modules/media_file/source/media_file.gypi third_party/jsoncpp/jsoncpp.gyp base/base.gyp third_party/webrtc/modules/remote_bitrate_estimator/remote_bitrate_estimator.gypi third_party/webrtc/modules/rtp_rtcp/source/rtp_rtcp_tests.gypi third_party/webrtc/modules/audio_processing/audio_processing.gypi third_party/webrtc/modules/video_processing/main/source/video_processing.gypi third_party/webrtc/system_wrappers/source/system_wrappers.gyp supplement/supplement.gypi third_party/webrtc/modules/audio_coding/codecs/ilbc/ilbc.gypi third_party/webrtc/modules/utility/source/utility.gypi third_party/webrtc/voice_engine/test/voice_engine_tests.gypi build/internal/release_impl.gypi third_party/webrtc/modules/audio_coding/codecs/isac/isacfix_test.gypi third_party/yasm/yasm_compile.gypi net/net.gyp third_party/webrtc/modules/audio_coding/codecs/isac/isac_test.gypi third_party/webrtc/modules/audio_coding/codecs/cng/cng.gypi third_party/libvpx/libvpx_srcs_x86_64.gypi third_party/webrtc/modules/audio_coding/codecs/pcm16b/pcm16b.gypi third_party/webrtc/modules/audio_device/audio_device.gypi third_party/libjingle/libjingle.gyp build/internal/release_impl_official.gypi build/internal/release_defaults.gypi third_party/webrtc/modules/rtp_rtcp/source/rtp_rtcp.gypi third_party/webrtc/modules/video_render/main/source/video_render.gypi third_party/libjpeg_turbo/libjpeg.gyp third_party/webrtc/modules/rtp_rtcp/test/testAPI/test_api.gypi third_party/webrtc/modules/udp_transport/source/udp_transport.gypi third_party/libvpx/libvpx_srcs_arm_neon.gypi third_party/webrtc/voice_engine/voice_engine.gyp third_party/webrtc/common_audio/resampler/resampler.gypi third_party/webrtc/modules/audio_conference_mixer/source/audio_conference_mixer.gypi build/win_precompile.gypi third_party/expat/expat.gyp third_party/webrtc/modules/video_coding/main/source/video_coding_test.gypi third_party/yasm/yasm.gyp third_party/webrtc/modules/video_capture/main/source/video_capture.gypi third_party/webrtc/video_engine/test/libvietest/libvietest.gypi third_party/webrtc/modules/video_coding/codecs/vp8/vp8.gyp third_party/webrtc/modules/bitrate_controller/bitrate_controller.gypi third_party/webrtc/modules/audio_coding/codecs/isac/fix/source/isacfix.gypi build/ios/mac_build.gypi third_party/webrtc/modules/video_coding/main/source/video_coding.gypi third_party/webrtc/modules/audio_coding/main/source/audio_coding_module.gypi build/release.gypi peerconnection.gyp build/common.gypi third_party/webrtc/video_engine/video_engine_core.gypi third_party/webrtc/build/arm_neon.gypi third_party/libvpx/libvpx.gyp third_party/webrtc/common_audio/common_audio.gyp third_party/libyuv/libyuv.gyp third_party/webrtc/modules/audio_coding/codecs/isac/main/source/isac.gypi third_party/webrtc/modules/video_processing/main/test/vpm_tests.gypi third_party/webrtc/voice_engine/voice_engine_core.gypi third_party/webrtc/modules/rtp_rtcp/test/testFec/test_fec.gypi third_party/webrtc/modules/video_coding/codecs/tools/video_codecs_tools.gypi third_party/libsrtp/libsrtp.gyp peerconnection_all.gyp third_party/webrtc/modules/audio_coding/codecs/g711/g711.gypi third_party/webrtc/modules/audio_processing/audio_processing_tests.gypi third_party/libvpx/libvpx_srcs_x86.gypi third_party/webrtc/modules/modules.gyp third_party/webrtc/common_audio/signal_processing/signal_processing.gypi third_party/webrtc/video_engine/test/auto_test/vie_auto_test.gypi third_party/libvpx/libvpx_srcs_mips.gypi third_party/webrtc/common_audio/vad/vad.gypi third_party/webrtc/modules/video_coding/codecs/test/video_codecs_test_framework.gypi third_party/webrtc/modules/video_coding/codecs/i420/main/source/i420.gypi third_party/webrtc/modules/audio_coding/codecs/g722/g722.gypi third_party/webrtc/modules/video_coding/codecs/test_framework/test_framework.gypi third_party/webrtc/build/protoc.gypi third_party/protobuf/protobuf.gyp
 	$(call do_cmd,regen_makefile)
 
 # "all" is a concatenation of the "all" targets from all the included
 # sub-makefiles. This is just here to clarify.
 all:
 
 # Add in dependency-tracking rules.  $(all_deps) is the list of every single
 # target in our tree. Only consider the ones with .d (dependency) info:
 d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d))
 ifneq ($(d_files),)
-  # Rather than include each individual .d file, concatenate them into a
-  # single file which make is able to load faster.  We split this into
-  # commands that take 1000 files at a time to avoid overflowing the
-  # command line.
-  $(shell cat $(wordlist 1,1000,$(d_files)) > $(depsdir)/all.deps)
-
-  ifneq ($(word 1001,$(d_files)),)
-    $(shell cat $(wordlist 1001,2000,$(d_files)) >> $(depsdir)/all.deps)
-  endif
-  ifneq ($(word 2001,$(d_files)),)
-    $(error Found unprocessed dependency files (gyp didn't generate enough rules!))
-  endif
-
-  # make looks for ways to re-generate included makefiles, but in our case, we
-  # don't have a direct way. Explicitly telling make that it has nothing to do
-  # for them makes it go faster.
-  $(depsdir)/all.deps: ;
-
-  include $(depsdir)/all.deps
+  include $(d_files)
 endif
--- a/media/webrtc/trunk/build/all.gyp
+++ b/media/webrtc/trunk/build/all.gyp
@@ -6,51 +6,47 @@
   'targets': [
     {
       'target_name': 'All',
       'type': 'none',
       'xcode_create_dependents_test_runner': 1,
       'dependencies': [
         'some.gyp:*',
         '../base/base.gyp:*',
+        '../content/content.gyp:*',
         '../crypto/crypto.gyp:*',
+        '../media/media.gyp:*',
         '../net/net.gyp:*',
+        '../sdch/sdch.gyp:*',
         '../sql/sql.gyp:*',
+        '../testing/gmock.gyp:*',
         '../testing/gtest.gyp:*',
         '../third_party/bzip2/bzip2.gyp:*',
         '../third_party/icu/icu.gyp:*',
         '../third_party/libxml/libxml.gyp:*',
         '../third_party/sqlite/sqlite.gyp:*',
         '../third_party/zlib/zlib.gyp:*',
         '../ui/ui.gyp:*',
+        '../webkit/support/webkit_support.gyp:*',
         'temp_gyp/googleurl.gyp:*',
-        # Add new dependencies to the !ios section just below, not here (see
-        # the comment there).
       ],
       'conditions': [
-        # TODO(ios): This is temporary; currently almost nothing builds with
-        # OS=ios. Move dependencies back to the main dependencies section above
-        # as gyp files come online.
         ['OS!="ios"', {
           'dependencies': [
             '../cc/cc_tests.gyp:*',
             '../chrome/chrome.gyp:*',
-            '../content/content.gyp:*',
             '../gpu/gpu.gyp:*',
             '../gpu/tools/tools.gyp:*',
             '../ipc/ipc.gyp:*',
             '../jingle/jingle.gyp:*',
-            '../media/media.gyp:*',
             '../ppapi/ppapi.gyp:*',
             '../ppapi/ppapi_internal.gyp:*',
             '../printing/printing.gyp:*',
-            '../sdch/sdch.gyp:*',
             '../skia/skia.gyp:*',
             '../sync/sync.gyp:*',
-            '../testing/gmock.gyp:*',
             '../third_party/cacheinvalidation/cacheinvalidation.gyp:*',
             '../third_party/cld/cld.gyp:*',
             '../third_party/codesighs/codesighs.gyp:*',
             '../third_party/ffmpeg/ffmpeg.gyp:*',
             '../third_party/iccjpeg/iccjpeg.gyp:*',
             '../third_party/libpng/libpng.gyp:*',
             '../third_party/libusb/libusb.gyp:*',
             '../third_party/libwebp/libwebp.gyp:*',
@@ -58,19 +54,18 @@
             '../third_party/lzma_sdk/lzma_sdk.gyp:*',
             '../third_party/mesa/mesa.gyp:*',
             '../third_party/modp_b64/modp_b64.gyp:*',
             '../third_party/npapi/npapi.gyp:*',
             '../third_party/ots/ots.gyp:*',
             '../third_party/qcms/qcms.gyp:*',
             '../third_party/re2/re2.gyp:re2',
             '../third_party/WebKit/Source/WebKit/chromium/All.gyp:*',
-            '../third_party/WebKit/Source/WebKit/chromium/WebKit.gyp:generate_devtools_zip',
             '../v8/tools/gyp/v8.gyp:*',
-            '../webkit/support/webkit_support.gyp:*',
+            '../webkit/compositor_bindings/compositor_bindings_tests.gyp:*',
             '../webkit/webkit.gyp:*',
             '<(libjpeg_gyp_path):*',
           ],
         }],
         ['os_posix==1 and OS!="android" and OS!="ios"', {
           'dependencies': [
             '../third_party/yasm/yasm.gyp:*#host',
           ],
@@ -97,16 +92,21 @@
             '../sandbox/sandbox.gyp:*',
           ],
           'conditions': [
             ['branding=="Chrome"', {
               'dependencies': [
                 '../chrome/chrome.gyp:linux_packages_<(channel)',
               ],
             }],
+            ['chromeos==0', {
+              'dependencies': [
+                '../third_party/cros_dbus_cplusplus/cros_dbus_cplusplus.gyp:*',
+              ],
+            }],
           ],
         }],
         ['toolkit_uses_gtk==1', {
           'dependencies': [
             '../tools/gtk_clipboard_dump/gtk_clipboard_dump.gyp:*',
             '../tools/xdisplaycheck/xdisplaycheck.gyp:*',
           ],
         }],
@@ -132,24 +132,25 @@
           ],
         }, {
           'dependencies': [
             '../third_party/libevent/libevent.gyp:*',
           ],
         }],
         ['toolkit_views==1', {
           'dependencies': [
+            '../ui/views/controls/webview/webview.gyp:*',
             '../ui/views/views.gyp:*',
           ],
         }],
         ['use_aura==1', {
           'dependencies': [
+            '../ash/ash.gyp:*',
             '../ui/aura/aura.gyp:*',
             '../ui/oak/oak.gyp:*',
-            '../ash/ash.gyp:*',
           ],
         }],
         ['remoting==1', {
           'dependencies': [
             '../remoting/remoting.gyp:*',
           ],
         }],
         ['use_openssl==0', {
@@ -171,48 +172,46 @@
         ],
       ],
     }, # target_name: All_syzygy
     {
       'target_name': 'chromium_builder_tests',
       'type': 'none',
       'dependencies': [
         '../base/base.gyp:base_unittests',
+        '../crypto/crypto.gyp:crypto_unittests',
+        '../media/media.gyp:media_unittests',
+        '../net/net.gyp:net_unittests',
         '../sql/sql.gyp:sql_unittests',
-        # Add new dependencies to the !ios section just below, not here (see
-        # the comment there).
+        '../ui/ui.gyp:ui_unittests',
+        'temp_gyp/googleurl.gyp:googleurl_unittests',
       ],
       'conditions': [
         ['OS!="ios"', {
           'dependencies': [
-            # TODO(ios): This is temporary; currently almost nothing builds with
-            # OS=ios. Move dependencies back to the main dependencies section
-            # above as gyp files come online.
+            '../cc/cc_tests.gyp:cc_unittests',
             '../chrome/chrome.gyp:browser_tests',
             '../chrome/chrome.gyp:interactive_ui_tests',
             '../chrome/chrome.gyp:safe_browsing_tests',
             '../chrome/chrome.gyp:sync_integration_tests',
             '../chrome/chrome.gyp:unit_tests',
             '../cloud_print/cloud_print.gyp:cloud_print_unittests',
             '../content/content.gyp:content_browsertests',
             '../content/content.gyp:content_unittests',
-            '../crypto/crypto.gyp:crypto_unittests',
             '../gpu/gpu.gyp:gpu_unittests',
             '../gpu/gles2_conform_support/gles2_conform_support.gyp:gles2_conform_support',
             '../ipc/ipc.gyp:ipc_tests',
             '../jingle/jingle.gyp:jingle_unittests',
-            '../media/media.gyp:media_unittests',
-            '../net/net.gyp:net_unittests',
+            '../ppapi/ppapi_internal.gyp:ppapi_unittests',
             '../printing/printing.gyp:printing_unittests',
             '../remoting/remoting.gyp:remoting_unittests',
             '../sync/sync.gyp:sync_unit_tests',
             '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
             '../third_party/libphonenumber/libphonenumber.gyp:libphonenumber_unittests',
-            '../ui/ui.gyp:ui_unittests',
-            'temp_gyp/googleurl.gyp:googleurl_unittests',
+            '../webkit/compositor_bindings/compositor_bindings_tests.gyp:webkit_compositor_bindings_unittests',
           ],
         }],
         ['OS=="win"', {
           'dependencies': [
             '../chrome/chrome.gyp:installer_util_unittests',
             '../chrome/chrome.gyp:mini_installer_test',
             # mini_installer_tests depends on mini_installer. This should be
             # defined in installer.gyp.
@@ -352,63 +351,69 @@
           ],
         },
         # These targets are here so the build bots can use them to build
         # subsets of a full tree for faster cycle times.
         {
           'target_name': 'chromium_builder_dbg',
           'type': 'none',
           'dependencies': [
+            '../cc/cc_tests.gyp:cc_unittests',
             '../chrome/chrome.gyp:browser_tests',
             '../chrome/chrome.gyp:interactive_ui_tests',
             '../chrome/chrome.gyp:safe_browsing_tests',
             '../chrome/chrome.gyp:sync_integration_tests',
             '../chrome/chrome.gyp:unit_tests',
             '../cloud_print/cloud_print.gyp:cloud_print_unittests',
             '../content/content.gyp:content_browsertests',
             '../content/content.gyp:content_unittests',
             '../ui/ui.gyp:ui_unittests',
             '../gpu/gpu.gyp:gpu_unittests',
             '../ipc/ipc.gyp:ipc_tests',
             '../jingle/jingle.gyp:jingle_unittests',
             '../media/media.gyp:media_unittests',
+            '../ppapi/ppapi_internal.gyp:ppapi_unittests',
             '../printing/printing.gyp:printing_unittests',
             '../remoting/remoting.gyp:remoting_unittests',
             '../rlz/rlz.gyp:*',
             '../sql/sql.gyp:sql_unittests',
             '../sync/sync.gyp:sync_unit_tests',
             '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
             '../third_party/libphonenumber/libphonenumber.gyp:libphonenumber_unittests',
+            '../webkit/compositor_bindings/compositor_bindings_tests.gyp:webkit_compositor_bindings_unittests',
             'temp_gyp/googleurl.gyp:googleurl_unittests',
           ],
         },
         {
           'target_name': 'chromium_builder_rel',
           'type': 'none',
           'dependencies': [
+            '../cc/cc_tests.gyp:cc_unittests',
             '../chrome/chrome.gyp:browser_tests',
             '../chrome/chrome.gyp:performance_browser_tests',
             '../chrome/chrome.gyp:performance_ui_tests',
             '../chrome/chrome.gyp:safe_browsing_tests',
             '../chrome/chrome.gyp:sync_integration_tests',
             '../chrome/chrome.gyp:unit_tests',
             '../cloud_print/cloud_print.gyp:cloud_print_unittests',
             '../content/content.gyp:content_browsertests',
             '../content/content.gyp:content_unittests',
             '../ui/ui.gyp:ui_unittests',
             '../gpu/gpu.gyp:gpu_unittests',
             '../ipc/ipc.gyp:ipc_tests',
             '../jingle/jingle.gyp:jingle_unittests',
             '../media/media.gyp:media_unittests',
+            '../ppapi/ppapi_internal.gyp:ppapi_unittests',
             '../printing/printing.gyp:printing_unittests',
             '../remoting/remoting.gyp:remoting_unittests',
             '../sql/sql.gyp:sql_unittests',
             '../sync/sync.gyp:sync_unit_tests',
             '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
             '../third_party/libphonenumber/libphonenumber.gyp:libphonenumber_unittests',
+            '../webkit/compositor_bindings/compositor_bindings_tests.gyp:webkit_compositor_bindings_unittests',
             'temp_gyp/googleurl.gyp:googleurl_unittests',
           ],
         },
         {
           'target_name': 'chromium_builder_dbg_tsan_mac',
           'type': 'none',
           'dependencies': [
             '../base/base.gyp:base_unittests',
@@ -463,16 +468,17 @@
     ['OS=="win"', {
       'targets': [
         # These targets are here so the build bots can use them to build
         # subsets of a full tree for faster cycle times.
         {
           'target_name': 'chromium_builder',
           'type': 'none',
           'dependencies': [
+            '../cc/cc_tests.gyp:cc_unittests',
             '../chrome/chrome.gyp:browser_tests',
             '../chrome/chrome.gyp:installer_util_unittests',
             '../chrome/chrome.gyp:interactive_ui_tests',
             '../chrome/chrome.gyp:mini_installer_test',
             '../chrome/chrome.gyp:performance_browser_tests',
             '../chrome/chrome.gyp:performance_ui_tests',
             '../chrome/chrome.gyp:safe_browsing_tests',
             '../chrome/chrome.gyp:sync_integration_tests',
@@ -490,24 +496,26 @@
             '../chrome_frame/chrome_frame.gyp:chrome_frame_unittests',
             '../chrome_frame/chrome_frame.gyp:npchrome_frame',
             '../courgette/courgette.gyp:courgette_unittests',
             '../ui/ui.gyp:ui_unittests',
             '../gpu/gpu.gyp:gpu_unittests',
             '../ipc/ipc.gyp:ipc_tests',
             '../jingle/jingle.gyp:jingle_unittests',
             '../media/media.gyp:media_unittests',
+            '../ppapi/ppapi_internal.gyp:ppapi_unittests',
             '../printing/printing.gyp:printing_unittests',
             '../remoting/remoting.gyp:remoting_unittests',
             '../sql/sql.gyp:sql_unittests',
             '../sync/sync.gyp:sync_unit_tests',
             '../third_party/cacheinvalidation/cacheinvalidation.gyp:cacheinvalidation_unittests',
             '../third_party/libphonenumber/libphonenumber.gyp:libphonenumber_unittests',
+            '../ui/views/views.gyp:views_unittests',
+            '../webkit/compositor_bindings/compositor_bindings_tests.gyp:webkit_compositor_bindings_unittests',
             '../webkit/webkit.gyp:pull_in_copy_TestNetscapePlugIn',
-            '../ui/views/views.gyp:views_unittests',
             'temp_gyp/googleurl.gyp:googleurl_unittests',
           ],
         },
         {
           'target_name': 'chromium_builder_win_cf',
           'type': 'none',
           'dependencies': [
             '../chrome_frame/chrome_frame.gyp:chrome_frame_net_tests',
@@ -595,65 +603,70 @@
                 '../chrome/chrome.gyp:automated_ui_tests',
                 '../chrome/installer/mini_installer.gyp:mini_installer',
                 '../chrome_frame/chrome_frame.gyp:npchrome_frame',
                 '../courgette/courgette.gyp:courgette',
                 '../courgette/courgette.gyp:courgette64',
                 '../cloud_print/cloud_print.gyp:cloud_print',
                 '../remoting/remoting.gyp:remoting_webapp',
                 '../third_party/adobe/flash/flash_player.gyp:flash_player',
+                '../third_party/widevine/cdm/widevine_cdm.gyp:widevinecdmplugin',
               ],
               'conditions': [
                 ['internal_pdf', {
                   'dependencies': [
                     '../pdf/pdf.gyp:pdf',
                   ],
                 }], # internal_pdf
                 ['component != "shared_library" and wix_exists == "True" and \
                     sas_dll_exists == "True"', {
                   'dependencies': [
                     '../remoting/remoting.gyp:remoting_host_installation',
-                    '../remoting/remoting.gyp:remoting_host_installation_unittest',
                   ],
                 }], # component != "shared_library"
               ]
             },
           ], # targets
         }], # branding=="Chrome"
        ], # conditions
     }], # OS="win"
     ['use_aura==1', {
       'targets': [
         {
           'target_name': 'aura_builder',
           'type': 'none',
           'dependencies': [
+            '../cc/cc_tests.gyp:cc_unittests',
             '../chrome/chrome.gyp:browser_tests',
             '../chrome/chrome.gyp:chrome',
             '../chrome/chrome.gyp:interactive_ui_tests',
             '../chrome/chrome.gyp:unit_tests',
             '../content/content.gyp:content_browsertests',
+            '../content/content.gyp:content_unittests',
+            '../ppapi/ppapi_internal.gyp:ppapi_unittests',
             '../remoting/remoting.gyp:remoting_unittests',
             '../ui/aura/aura.gyp:*',
             '../ui/compositor/compositor.gyp:*',
             '../ui/ui.gyp:ui_unittests',
             '../ui/views/views.gyp:views',
             '../ui/views/views.gyp:views_unittests',
+            '../webkit/compositor_bindings/compositor_bindings_tests.gyp:webkit_compositor_bindings_unittests',
             '../webkit/webkit.gyp:pull_in_webkit_unit_tests',
           ],
           'conditions': [
             ['OS=="win"', {
               # Remove this when we have the real compositor.
               'copies': [
                 {
                   'destination': '<(PRODUCT_DIR)',
                   'files': ['../third_party/directxsdk/files/dlls/D3DX10d_43.dll']
                 },
               ],
               'dependencies': [
+                '../content/content.gyp:content_unittests',
                 '../chrome/chrome.gyp:crash_service',
                 '../chrome/chrome.gyp:crash_service_win64',
               ],
             }],
             ['use_ash==1', {
               'dependencies': [
                 '../ash/ash.gyp:ash_shell',
                 '../ash/ash.gyp:ash_unittests',
--- a/media/webrtc/trunk/build/all_android.gyp
+++ b/media/webrtc/trunk/build/all_android.gyp
@@ -2,91 +2,109 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 # This is all.gyp file for Android to prevent breakage in Android and other
 # platform; It will be churning a lot in the short term and eventually be merged
 # into all.gyp.
 
 {
+  'variables': {
+    # A hook that can be overridden in other repositories to add additional
+    # compilation targets to 'All'
+    'android_app_targets%': [],
+  },
   'targets': [
     {
       'target_name': 'All',
       'type': 'none',
       'dependencies': [
         '../content/content.gyp:content_shell_apk',
+        '<@(android_app_targets)',
         'android_builder_tests',
+        '../android_webview/android_webview.gyp:android_webview_apk',
+        '../chrome/chrome.gyp:chromium_testshell',
       ],
     }, # target_name: All
     {
       # The current list of tests for android.  This is temporary
       # until the full set supported.  If adding a new test here,
       # please also add it to build/android/run_tests.py, else the
       # test is not run.
       #
       # WARNING:
       # Do not add targets here without communicating the implications
       # on tryserver triggers and load.  Discuss with jrg please.
       'target_name': 'android_builder_tests',
       'type': 'none',
       'dependencies': [
+        '../base/android/jni_generator/jni_generator.gyp:jni_generator_tests',
         '../base/base.gyp:base_unittests',
+        '../cc/cc_tests.gyp:cc_unittests',
+        '../chrome/chrome.gyp:unit_tests',
         '../content/content.gyp:content_shell_test_apk',
         '../content/content.gyp:content_unittests',
-        '../chrome/chrome.gyp:unit_tests',
         '../gpu/gpu.gyp:gpu_unittests',
+        '../ipc/ipc.gyp:ipc_tests',
+        '../media/media.gyp:media_unittests',
+        '../net/net.gyp:net_unittests',
         '../sql/sql.gyp:sql_unittests',
         '../sync/sync.gyp:sync_unit_tests',
-        '../ipc/ipc.gyp:ipc_tests',
-        '../net/net.gyp:net_unittests',
+        '../third_party/WebKit/Source/WebKit/chromium/All.gyp:*',
+        '../tools/android/device_stats_monitor/device_stats_monitor.gyp:device_stats_monitor',
+        '../tools/android/fake_dns/fake_dns.gyp:fake_dns',
+        '../tools/android/forwarder2/forwarder.gyp:forwarder2',
+        '../tools/android/md5sum/md5sum.gyp:md5sum',
         '../ui/ui.gyp:ui_unittests',
-        '../third_party/WebKit/Source/WebKit/chromium/All.gyp:*',
         # From here down: not added to run_tests.py yet.
         '../jingle/jingle.gyp:jingle_unittests',
-        '../tools/android/device_stats_monitor/device_stats_monitor.gyp:device_stats_monitor',
-        '../tools/android/fake_dns/fake_dns.gyp:fake_dns',
-        '../tools/android/forwarder/forwarder.gyp:forwarder',
-        '../media/media.gyp:media_unittests',
         # Required by ui_unittests.
         # TODO(wangxianzhu): It'd better let ui_unittests depend on it, but
         # this would cause circular gyp dependency which needs refactoring the
         # gyps to resolve.
         '../chrome/chrome_resources.gyp:packed_resources',
       ],
       'conditions': [
+        ['linux_breakpad==1', {
+          'dependencies': [
+            '../breakpad/breakpad.gyp:breakpad_unittests',
+          ],
+        }],
         ['"<(gtest_target_type)"=="shared_library"', {
           'dependencies': [
             # The first item is simply the template.  We add as a dep
             # to make sure it builds in ungenerated form.  TODO(jrg):
             # once stable, transition to a test-only (optional)
             # target.
             '../testing/android/native_test.gyp:native_test_apk',
             # Unit test bundles packaged as an apk.
             '../base/base.gyp:base_unittests_apk',
+            '../cc/cc_tests.gyp:cc_unittests_apk',
+            '../chrome/chrome.gyp:unit_tests_apk',
             '../content/content.gyp:content_unittests_apk',
-            '../chrome/chrome.gyp:unit_tests_apk',
             '../gpu/gpu.gyp:gpu_unittests_apk',
             '../ipc/ipc.gyp:ipc_tests_apk',
             '../media/media.gyp:media_unittests_apk',
             '../net/net.gyp:net_unittests_apk',
             '../sql/sql.gyp:sql_unittests_apk',
             '../sync/sync.gyp:sync_unit_tests_apk',
             '../ui/ui.gyp:ui_unittests_apk',
+            '../android_webview/android_webview.gyp:android_webview_test_apk',
+            '../chrome/chrome.gyp:chromium_testshell_test_apk',
           ],
-        }]
+        }],
       ],
     },
     {
       # Experimental / in-progress targets that are expected to fail
       # but we still try to compile them on bots (turning the stage
       # orange, not red).
       'target_name': 'android_experimental',
       'type': 'none',
       'dependencies': [
-        '../android_webview/lib/android_webview.gyp:libwebview',
       ],
     },
     {
       # In-progress targets that are expected to fail and are NOT run
       # on any bot.
       'target_name': 'android_in_progress',
       'type': 'none',
       'dependencies': [
--- a/media/webrtc/trunk/build/android/adb_device_functions.sh
+++ b/media/webrtc/trunk/build/android/adb_device_functions.sh
@@ -37,17 +37,20 @@ adb_all() {
 adb_device_loop() {
   if [[ $# == 0 ]]; then
     echo "Intended for more complex one-liners that cannot be done with" \
         "adb_all."
     echo 'Usage: adb_device_loop "echo $DEVICE: $(adb root &&' \
         'adb shell cat /data/local.prop)"'
     return 1
   fi
-  local DEVICES=$(adb_get_devices -b)
+  local DEVICES=$(adb_get_devices)
+  if [[ -z $DEVICES ]]; then
+    return
+  fi
   # Do not change DEVICE variable name - part of api
   for DEVICE in $DEVICES; do
     DEV_TYPE=$(adb -s $DEVICE shell getprop ro.product.device | sed 's/\r//')
     echo "Running on $DEVICE ($DEV_TYPE)"
     ANDROID_SERIAL=$DEVICE eval "$*"
   done
 }
 
deleted file mode 100755
--- a/media/webrtc/trunk/build/android/adb_install_content_shell
+++ /dev/null
@@ -1,41 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-from multiprocessing import Process
-import optparse
-import os
-import sys
-
-from pylib import android_commands
-from pylib import test_options_parser
-
-
-def InstallContentShell(device, build_type):
-  apk_path = os.path.join(os.environ['CHROME_SRC'],
-                          'out', build_type,
-                          'content_shell', 'ContentShell-debug.apk')
-  result = android_commands.AndroidCommands(device=device).ManagedInstall(
-      apk_path, False, 'org.chromium.content_shell')
-  print '-----  Installed on %s  -----' % device
-  print result
-
-
-parser = optparse.OptionParser()
-test_options_parser.AddBuildTypeOption(parser)
-options, args = parser.parse_args(sys.argv)
-
-devices = android_commands.GetAttachedDevices()
-if not devices:
-  raise Exception('Error: no connected devices')
-
-procs = []
-for device in devices:
-  p = Process(target=InstallContentShell, args=(device, options.build_type))
-  p.start()
-  procs += [p]
-
-for p in procs:
-  p.join()
--- a/media/webrtc/trunk/build/android/ant/chromium-jars.xml
+++ b/media/webrtc/trunk/build/android/ant/chromium-jars.xml
@@ -14,67 +14,84 @@
   <description>
     Building ${PROJECT_NAME}/ java source code with ant.
   </description>
 
   <import file="common.xml"/>
 
   <path id="javac.custom.classpath">
     <filelist files="${INPUT_JARS_PATHS}"/>
-    <pathelement location="${ANDROID_SDK}/android.jar" />
+    <pathelement location="${ANDROID_SDK}/android.jar"/>
   </path>
 
   <path id="javac.srcdirs.additional">
-    <filelist files="${ADDITIONAL_SRC_DIRS}" />
+    <filelist files="${ADDITIONAL_SRC_DIRS}"/>
+    <filelist files="${GENERATED_SRC_DIRS}"/>
   </path>
 
-  <property-value name="javac.srcdir" value="src:${toString:javac.srcdirs.additional}"/>
+  <property-value
+    name="javac.srcdir"
+    value="src:${toString:javac.srcdirs.additional}"
+  />
 
-  <property-location name="lib.dir" location="${PRODUCT_DIR}/lib.java"
-      check-exists="false"/>
-  <property-location name="dest.dir" location="${PRODUCT_DIR}/java/${PACKAGE_NAME}"
-      check-exists="false"/>
+  <property-location
+    name="dest.dir"
+    location="${PRODUCT_DIR}/java/${PACKAGE_NAME}"
+    check-exists="false"
+  />
 
   <target name="init">
     <!-- Create the time stamp -->
     <tstamp/>
     <!-- Create the build directory structure used by compile -->
-    <mkdir dir="${lib.dir}"/>
     <mkdir dir="${dest.dir}"/>
+
+    <!-- Remove all .class files from dest.dir. This prevents inclusion of
+         incorrect .class files in the final .jar. For example, if a .java file
+         was deleted, the .jar should not contain the .class files for that
+         .java from previous builds.
+    -->
+    <delete>
+      <fileset dir="${dest.dir}" includes="**/*.class"/>
+    </delete>
   </target>
 
-  <target name="compile" depends="init" description="Compiles source." >
+  <target name="compile" depends="init" description="Compiles source.">
     <fail message="Error: javac.custom.classpath is not set. Please set it to
         classpath for javac.">
       <condition>
         <not><isreference refid="javac.custom.classpath"/></not>
       </condition>
     </fail>
 
-    <echo>Compiling ${javac.srcdir}, classpath: ${toString:javac.custom.classpath}</echo>
+    <echo>
+      Compiling ${javac.srcdir}, classpath: ${toString:javac.custom.classpath}
+    </echo>
 
     <javac
       srcdir="${javac.srcdir}"
       destdir="${dest.dir}"
       classpathref="javac.custom.classpath"
       debug="true"
       includeantruntime="false"
     />
   </target>
 
   <target name="dist" depends="compile"
       description="Generate chromium_${PACKAGE_NAME}.jar.">
     <!-- Create the distribution directory -->
-    <mkdir dir="${lib.dir}" />
-    <jar jarfile="${lib.dir}/chromium_${PACKAGE_NAME}.jar" basedir="${dest.dir}"/>
+    <jar
+      jarfile="${lib.java.dir}/chromium_${PACKAGE_NAME}.jar"
+      basedir="${dest.dir}"
+    />
 
     <!-- If Gyp thinks this output is stale but Ant doesn't, the modification
          time should still be updated. Otherwise, this target will continue to
          be rebuilt in future builds.
     -->
-    <touch file="${lib.dir}/chromium_${PACKAGE_NAME}.jar"/>
+    <touch file="${lib.java.dir}/chromium_${PACKAGE_NAME}.jar"/>
   </target>
 
   <target name="clean" description="clean up">
     <!-- Delete the appropriate directory trees -->
-    <delete dir="${dest.dir}" />
+    <delete dir="${dest.dir}"/>
   </target>
 </project>
--- a/media/webrtc/trunk/build/android/ant/common.xml
+++ b/media/webrtc/trunk/build/android/ant/common.xml
@@ -48,17 +48,17 @@
     <attribute name="check-exists" default="true"/>
     <sequential>
       <property name="@{name}" location="@{location}"/>
       <check-property-value property="@{name}"/>
       <fail message="Location specified for @{name} : @{location} does not exist.">
         <condition>
           <and>
             <equals arg1="@{check-exists}" arg2="true"/>
-            <not><available type="dir" file="@{location}"/></not>
+            <not><available file="@{location}"/></not>
           </and>
         </condition>
       </fail>
     </sequential>
   </macrodef>
 
   <!-- A safe setter for property values -->
   <macrodef name="property-value">
@@ -69,10 +69,22 @@
       <check-property-value property="@{name}"/>
     </sequential>
   </macrodef>
 
   <!-- Common environment properties. -->
   <property-location name="sdk.dir" location="${ANDROID_SDK_ROOT}"/>
   <property-value name="target" value="android-${ANDROID_SDK_VERSION}"/>
   <property name="source.dir" location="src"/>
-  <property-location name="toolchain.dir" location="${ANDROID_TOOLCHAIN}"/>
+  <property-location name="android.gdbserver" location="${ANDROID_GDBSERVER}"/>
+  <!--
+       Common directories used by SDK Build, when making changes here
+       make sure to update gyp files and test scripts constants in
+       build/android/pylib/constants.py
+  -->
+  <!-- Common directory for chromium_*.jars. -->
+  <property-location name="lib.java.dir" location="${PRODUCT_DIR}/lib.java"/>
+  <!-- Common directory for test jars. -->
+  <property-location name="test.lib.java.dir"
+    location="${PRODUCT_DIR}/test.lib.java"/>
+  <!-- Common directory for apks. -->
+  <property-location name="apks.dir" location="${PRODUCT_DIR}/apks"/>
 </project>
--- a/media/webrtc/trunk/build/android/ant/sdk-targets.xml
+++ b/media/webrtc/trunk/build/android/ant/sdk-targets.xml
@@ -8,39 +8,46 @@
   <!--
     Redefinition of targets used by SDK tools.
     Supported version: SDK tools revision 20.
 
     SDK tools do not allow easy way of extending classpaths
     for aidl and javac. This file defines targets which can be used to
     override targets used by tools.
   -->
+  <target name="-pre-compile">
+    <!--
+      Remove all .class files from the output directory. This prevents inclusion of incorrect .class
+      files in the final apk. For example, if a .java file was deleted, the apk should not contain
+      the .class files for that .java from previous builds.
+    -->
+    <delete>
+      <fileset dir="${out.classes.absolute.dir}" includes="**/*.class"/>
+    </delete>
+  </target>
 
   <!--
     Override the -compile target.
     This target requires 'javac.custom.classpath' to be set to reference
     of classpath to be used for javac. Also accepts custom path for
     sources: 'javac.custom.sourcepath'.
   -->
   <target
       name="-compile"
       depends="-build-setup, -pre-build, -code-gen, -pre-compile">
     <do-only-if-manifest-hasCode elseText="hasCode = false. Skipping..." >
-      <!-- If souce path is not set, then use the default value -->
+      <!-- If javac.srcdirs.additional isn't set, set it to an empty path. -->
       <if>
         <condition>
           <not>
-            <isreference refid="javac.custom.sourcepath"/>
+            <isreference refid="javac.srcdirs.additional"/>
           </not>
         </condition>
         <then>
-          <path id="javac.custom.sourcepath">
-            <pathelement path="${source.absolute.dir}"/>
-            <pathelement path="${gen.absolute.dir}"/>
-          </path>
+          <path id="javac.srcdirs.additional"/>
         </then>
       </if>
       <javac
           bootclasspathref="project.target.class.path"
           classpathref="javac.custom.classpath"
           debug="true"
           destdir="${out.classes.absolute.dir}"
           encoding="${java.encoding}"
@@ -48,17 +55,17 @@
           fork="${need.javac.fork}"
           includeantruntime="false"
           source="${java.source}"
           target="${java.target}"
           verbose="${verbose}">
         <src path="${source.absolute.dir}"/>
         <src path="${gen.absolute.dir}"/>
         <src>
-          <path refid="javac.custom.sourcepath"/>
+          <path refid="javac.srcdirs.additional"/>
         </src>
         <compilerarg line="${java.compilerargs}"/>
       </javac>
       <!--
         If the project is instrumented, then instrument the classes
         TODO(shashishekhar): Add option to override emma filter.
       -->
       <if condition="${build.is.instrumented}">
@@ -87,11 +94,191 @@
                 outdir="${out.absolute.dir}/classes"
                 verbosity="${verbosity}">
               <filter excludes="${emma.default.filter}"/>
               <filter value="${emma.filter}"/>
             </instr>
           </emma>
         </then>
       </if>
+      <!--
+        If the project needs a test jar then generate a jar containing
+        all compiled classes and referenced jars.
+        project.is.testapp is set by Android's ant build system based on the
+        target's manifest. It is true only for instrumentation apks.
+      -->
+      <if condition="${project.is.testapp}">
+        <then>
+          <echo level="info">Creating test jar file:
+              ${ant.project.name}-debug.jar</echo>
+          <property-location name="create.test.jar.file"
+              location="${CHROMIUM_SRC}/build/android/ant/create-test-jar.js"/>
+          <script language="javascript" src="${create.test.jar.file}"/>
+        </then>
+      </if>
+
     </do-only-if-manifest-hasCode>
   </target>
+
+  <!--
+    For debug builds, the Android SDK tools create a key in ~/.android and sign the build with it.
+    This has caused all kinds of issues. Instead, the debug build should be signed with a key in
+    build/android/ant. The SDK tools do not provide any support for overriding that behavior and so
+    instead one must use the hack below.
+  -->
+
+  <!-- Disables automatic signing. -->
+  <property name="build.is.signing.debug" value="false"/>
+
+  <!-- TODO(cjhopman): Remove this property when all gyp files define the CHROMIUM_SRC property. -->
+  <property name="CHROMIUM_SRC" value="${PRODUCT_DIR}/../.." />
+
+  <property name="key.store" value="${CHROMIUM_SRC}/build/android/ant/chromium-debug.keystore"/>
+  <property name="key.store.password" value="chromium"/>
+  <property name="key.alias" value="chromiumdebugkey"/>
+  <property name="key.alias.password" value="chromium"/>
+
+  <!-- SDK tools assume that out.packaged.file is signed and name it "...-unaligned" -->
+  <property name="out.packaged.file"
+    value="${apks.dir}/${ant.project.name}-debug-unsigned.apk" />
+  <property name="out.unaligned.file"
+    value="${apks.dir}/${ant.project.name}-debug-unaligned.apk" />
+
+  <!-- By default, the SDK tools build only aligns the APK in the -do-debug target. -->
+  <target name="-do-debug"
+      depends="-set-debug-mode, -debug-obfuscation-check, -package, -post-package">
+    <!-- only create apk if *not* a library project -->
+    <do-only-if-not-library elseText="Library project: do not create apk..." >
+      <sequential>
+        <!-- Signs the APK -->
+        <echo level="info">Signing final apk...</echo>
+        <signapk
+          input="${out.packaged.file}"
+          output="${out.unaligned.file}"
+          keystore="${key.store}"
+          storepass="${key.store.password}"
+          alias="${key.alias}"
+          keypass="${key.alias.password}"/>
+
+        <!-- Zip aligns the APK -->
+        <zipalign-helper
+          in.package="${out.unaligned.file}"
+          out.package="${out.final.file}" />
+        <echo level="info">Release Package: ${out.final.file}</echo>
+      </sequential>
+    </do-only-if-not-library>
+    <record-build-info />
+  </target>
+
+  <path id="native.libs.gdbserver">
+    <fileset file="${android.gdbserver}"/>
+  </path>
+
+  <target name="-post-compile">
+    <!--
+      Copy gdbserver to main libs directory if building a non-instrumentation debug apk.
+      TODO(jrg): For now, Chrome on Android always builds native code
+      as Release and java/ant as Debug, which means we always install
+      gdbserver.  Resolve this discrepancy, possibly by making this
+      Release Official build java/ant as Release.
+    -->
+    <if>
+      <condition>
+        <and>
+          <equals arg1="${build.target}" arg2="debug"/>
+          <isfalse value="${project.is.testapp}"/>
+        </and>
+      </condition>
+      <then>
+        <echo message="Copying gdbserver to the apk to enable native debugging"/>
+        <copy todir="${out.dir}/libs/${target.abi}">
+          <path refid="native.libs.gdbserver"/>
+        </copy>
+      </then>
+    </if>
+
+    <!-- Package all the compiled .class files into a .jar. -->
+    <jar
+      jarfile="${lib.java.dir}/chromium_apk_${PACKAGE_NAME}.jar"
+      basedir="${out.classes.absolute.dir}"
+    />
+  </target>
+
+  <!--
+    Override obfuscate target to pass javac.custom.classpath to Proguard. SDK tools do not provide
+    any way to pass custom class paths to Proguard.
+   -->
+  <target name="-obfuscate">
+    <if condition="${proguard.enabled}">
+      <then>
+        <property name="obfuscate.absolute.dir" location="${out.absolute.dir}/proguard"/>
+        <property name="preobfuscate.jar.file" value="${obfuscate.absolute.dir}/original.jar"/>
+        <property name="obfuscated.jar.file" value="${obfuscate.absolute.dir}/obfuscated.jar"/>
+        <!-- input for dex will be proguard's output -->
+        <property name="out.dex.input.absolute.dir" value="${obfuscated.jar.file}"/>
+
+        <!-- Add Proguard Tasks -->
+        <property name="proguard.jar" location="${android.tools.dir}/proguard/lib/proguard.jar"/>
+        <taskdef name="proguard" classname="proguard.ant.ProGuardTask" classpath="${proguard.jar}"/>
+
+        <!-- Set the android classpath Path object into a single property. It'll be
+                 all the jar files separated by a platform path-separator.
+                 Each path must be quoted if it contains spaces.
+        -->
+        <pathconvert property="project.target.classpath.value" refid="project.target.class.path">
+          <firstmatchmapper>
+            <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
+            <identitymapper/>
+          </firstmatchmapper>
+        </pathconvert>
+
+        <!-- Build a path object with all the jar files that must be obfuscated.
+             This include the project compiled source code and any 3rd party jar
+             files. -->
+        <path id="project.all.classes.path">
+          <pathelement location="${preobfuscate.jar.file}"/>
+          <path refid="project.all.jars.path"/>
+          <!-- Pass javac.custom.classpath for apks. -->
+          <path refid="javac.custom.classpath"/>
+        </path>
+        <!-- Set the project jar files Path object into a single property. It'll be
+             all the jar files separated by a platform path-separator.
+             Each path must be quoted if it contains spaces.
+        -->
+        <pathconvert property="project.all.classes.value" refid="project.all.classes.path">
+          <firstmatchmapper>
+            <regexpmapper from='^([^ ]*)( .*)$$' to='"\1\2"'/>
+            <identitymapper/>
+          </firstmatchmapper>
+        </pathconvert>
+
+        <!-- Turn the path property ${proguard.config} from an A:B:C property
+             into a series of includes: -include A -include B -include C
+             suitable for processing by the ProGuard task. Note - this does
+             not include the leading '-include "' or the closing '"'; those
+             are added under the <proguard> call below.
+        -->
+        <path id="proguard.configpath">
+          <pathelement path="${proguard.config}"/>
+        </path>
+        <pathconvert pathsep='" -include "' property="proguard.configcmd"
+          refid="proguard.configpath"/>
+
+        <mkdir   dir="${obfuscate.absolute.dir}"/>
+        <delete file="${preobfuscate.jar.file}"/>
+        <delete file="${obfuscated.jar.file}"/>
+        <jar basedir="${out.classes.absolute.dir}"
+          destfile="${preobfuscate.jar.file}"/>
+        <proguard>
+          -include      "${proguard.configcmd}"
+          -include      "${out.absolute.dir}/proguard.txt"
+          -injars       ${project.all.classes.value}
+          -outjars      "${obfuscated.jar.file}"
+          -libraryjars  ${project.target.classpath.value}
+          -dump         "${obfuscate.absolute.dir}/dump.txt"
+          -printseeds   "${obfuscate.absolute.dir}/seeds.txt"
+          -printusage   "${obfuscate.absolute.dir}/usage.txt"
+          -printmapping "${obfuscate.absolute.dir}/mapping.txt"
+        </proguard>
+      </then>
+    </if>
+  </target>
 </project>
deleted file mode 100755
--- a/media/webrtc/trunk/build/android/buildbot.sh
+++ /dev/null
@@ -1,16 +0,0 @@
-#!/bin/bash -ex
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Currently used as the entry point by both trybot and FYI bot.
-# TODO(jrg): redirect those bots to buildbot_try_compile.sh and
-# buildbot_fyi.sh, then delete this file.
-
-
-ROOT=$(cd "$(dirname $0)"; pwd)
-if [ "${TRYBOT:-0}" = 1 ] ; then
-  exec $ROOT/buildbot_try_compile.sh
-else
-  exec $ROOT/buildbot_fyi.sh
-fi
deleted file mode 100755
--- a/media/webrtc/trunk/build/android/buildbot_functions.sh
+++ /dev/null
@@ -1,321 +0,0 @@
-#!/bin/bash
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Bash functions used by buildbot annotator scripts for the android
-# build of chromium.  Executing this script should not perform actions
-# other than setting variables and defining of functions.
-
-# Number of jobs on the compile line; e.g.  make -j"${JOBS}"
-JOBS="${JOBS:-4}"
-
-# Clobber build?  Overridden by bots with BUILDBOT_CLOBBER.
-NEED_CLOBBER="${NEED_CLOBBER:-0}"
-
-
-# Parse named arguments passed into the annotator script
-# and assign them global variable names.
-function bb_parse_args {
-  while [[ $1 ]]; do
-    case "$1" in
-      --factory-properties=*)
-        FACTORY_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')"
-        ;;
-      --build-properties=*)
-        BUILD_PROPERTIES="$(echo "$1" | sed 's/^[^=]*=//')"
-        ;;
-      *)
-        echo "@@@STEP_WARNINGS@@@"
-        echo "Warning, unparsed input argument: '$1'"
-        ;;
-    esac
-    shift
-  done
-}
-
-# Function to force-green a bot.
-function bb_force_bot_green_and_exit {
-  echo "@@@BUILD_STEP Bot forced green.@@@"
-  exit 0
-}
-
-function bb_run_gclient_hooks {
-  echo "@@@BUILD_STEP runhooks android@@@"
-  gclient runhooks
-}
-
-# Basic setup for all bots to run after a source tree checkout.
-# Args:
-#   $1: source root.
-#   $2 and beyond: key value pairs which are parsed by bb_parse_args.
-function bb_baseline_setup {
-  echo "@@@BUILD_STEP Environment setup@@@"
-  SRC_ROOT="$1"
-  # Remove SRC_ROOT param
-  shift
-
-  bb_parse_args "$@"
-
-  if [ ! -d "${SRC_ROOT}" ] ; then
-    echo "Please specify a valid source root directory as an arg"
-    echo '@@@STEP_FAILURE@@@'
-    return 1
-  fi
-  cd $SRC_ROOT
-
-  if [ ! -f build/android/envsetup.sh ] ; then
-    echo "No envsetup.sh"
-    echo "@@@STEP_FAILURE@@@"
-    return 1
-  fi
-
-  for mandatory_directory in $(dirname "${ANDROID_SDK_ROOT}") \
-    $(dirname "${ANDROID_NDK_ROOT}") ; do
-    if [[ ! -d "${mandatory_directory}" ]]; then
-      echo "Directory ${mandatory_directory} does not exist."
-      echo "Build cannot continue."
-      echo "@@@STEP_FAILURE@@@"
-      return 1
-    fi
-  done
-
-  if [ ! "$BUILDBOT_CLOBBER" = "" ]; then
-    NEED_CLOBBER=1
-  fi
-
-  . build/android/envsetup.sh
-
-  if [ "$NEED_CLOBBER" -eq 1 ]; then
-    echo "@@@BUILD_STEP Clobber@@@"
-    rm -rf "${SRC_ROOT}"/out
-    if [ -e "${SRC_ROOT}"/out ] ; then
-      echo "Clobber appeared to fail?  ${SRC_ROOT}/out still exists."
-      echo "@@@STEP_WARNINGS@@@"
-    fi
-  fi
-
-  # Should be called only after envsetup is done.
-  bb_run_gclient_hooks
-}
-
-
-# Setup goma.  Used internally to buildbot_functions.sh.
-function bb_setup_goma_internal {
-
-  # Quick bail if I messed things up and can't wait for the CQ to
-  # flush out.
-  # TODO(jrg): remove this condition when things are
-  # proven stable (4/1/12 or so).
-  if [ -f /usr/local/google/DISABLE_GOMA ]; then
-    echo "@@@STEP_WARNINGS@@@"
-    echo "Goma disabled with a local file"
-    return
-  fi
-
-  goma_dir=${goma_dir:-/b/build/goma}
-  if [ -f ${goma_dir}/goma.key ]; then
-    export GOMA_API_KEY_FILE=${GOMA_DIR}/goma.key
-  fi
-  local goma_ctl=$(which goma_ctl.sh)
-  if [ "${goma_ctl}" != "" ]; then
-    local goma_dir=$(dirname ${goma_ctl})
-  fi
-
-  if [ ! -f ${goma_dir}/goma_ctl.sh ]; then
-    echo "@@@STEP_WARNINGS@@@"
-    echo "Goma not found on this machine; defaulting to make"
-    return
-  fi
-  export GOMA_DIR=${goma_dir}
-  echo "GOMA_DIR: " $GOMA_DIR
-
-  export GOMA_COMPILER_PROXY_DAEMON_MODE=true
-  export GOMA_COMPILER_PROXY_RPC_TIMEOUT_SECS=300
-  export PATH=$GOMA_DIR:$PATH
-
-  echo "Starting goma"
-  if [ "$NEED_CLOBBER" -eq 1 ]; then
-    ${GOMA_DIR}/goma_ctl.sh restart
-  else
-    ${GOMA_DIR}/goma_ctl.sh ensure_start
-  fi
-  trap bb_stop_goma_internal SIGHUP SIGINT SIGTERM
-}
-
-# Stop goma.
-function bb_stop_goma_internal {
-  echo "Stopping goma"
-  ${GOMA_DIR}/goma_ctl.sh stop
-}
-
-# $@: make args.
-# Use goma if possible; degrades to non-Goma if needed.
-function bb_goma_make {
-  bb_setup_goma_internal
-
-  if [ "${GOMA_DIR}" = "" ]; then
-    make -j${JOBS} "$@"
-    return
-  fi
-
-  HOST_CC=$GOMA_DIR/gcc
-  HOST_CXX=$GOMA_DIR/g++
-  TARGET_CC=$(/bin/ls $ANDROID_TOOLCHAIN/*-gcc | head -n1)
-  TARGET_CXX=$(/bin/ls $ANDROID_TOOLCHAIN/*-g++ | head -n1)
-  TARGET_CC="$GOMA_DIR/gomacc $TARGET_CC"
-  TARGET_CXX="$GOMA_DIR/gomacc $TARGET_CXX"
-  COMMON_JAVAC="$GOMA_DIR/gomacc /usr/bin/javac -J-Xmx512M \
-    -target 1.5 -Xmaxerrs 9999999"
-
-  command make \
-    -j100 \
-    -l20 \
-    HOST_CC="$HOST_CC" \
-    HOST_CXX="$HOST_CXX" \
-    TARGET_CC="$TARGET_CC" \
-    TARGET_CXX="$TARGET_CXX" \
-    CC.host="$HOST_CC" \
-    CXX.host="$HOST_CXX" \
-    CC.target="$TARGET_CC" \
-    CXX.target="$TARGET_CXX" \
-    LINK.target="$TARGET_CXX" \
-    COMMON_JAVAC="$COMMON_JAVAC" \
-    "$@"
-
-  local make_exit_code=$?
-  bb_stop_goma_internal
-  return $make_exit_code
-}
-
-# Compile step
-function bb_compile {
-  # This must be named 'compile', not 'Compile', for CQ interaction.
-  # Talk to maruel for details.
-  echo "@@@BUILD_STEP compile@@@"
-  bb_goma_make
-}
-
-# Experimental compile step; does not turn the tree red if it fails.
-function bb_compile_experimental {
-  # Linking DumpRenderTree appears to hang forever?
-  EXPERIMENTAL_TARGETS="android_experimental"
-  for target in ${EXPERIMENTAL_TARGETS} ; do
-    echo "@@@BUILD_STEP Experimental Compile $target @@@"
-    set +e
-    bb_goma_make -k "${target}"
-    if [ $? -ne 0 ] ; then
-      echo "@@@STEP_WARNINGS@@@"
-    fi
-    set -e
-  done
-}
-
-# Run tests on an emulator.
-function bb_run_tests_emulator {
-  echo "@@@BUILD_STEP Run Tests on an Emulator@@@"
-  build/android/run_tests.py -e --xvfb --verbose
-}
-
-# Run tests on an actual device.  (Better have one plugged in!)
-function bb_run_tests {
-  python build/android/device_status_check.py
-  echo "@@@BUILD_STEP Run Tests on actual hardware@@@"
-  build/android/run_tests.py --xvfb --verbose
-}
-
-# Run instrumentation test.
-# Args:
-#   $1: TEST_APK.
-#   $2: EXTRA_FLAGS to be passed to run_instrumentation_tests.py.
-function bb_run_instrumentation_test {
-  local TEST_APK=${1}
-  local EXTRA_FLAGS=${2}
-  local APK_NAME=$(basename ${TEST_APK})
-  echo "@@@BUILD_STEP Android Instrumentation ${APK_NAME} ${EXTRA_FLAGS} "\
-       "on actual hardware@@@"
-  local INSTRUMENTATION_FLAGS="-vvv"
-  INSTRUMENTATION_FLAGS+=" --test-apk ${TEST_APK}"
-  INSTRUMENTATION_FLAGS+=" ${EXTRA_FLAGS}"
-  build/android/run_instrumentation_tests.py ${INSTRUMENTATION_FLAGS}
-}
-
-# Run content shell instrumentation test on device.
-function bb_run_content_shell_instrumentation_test {
-  build/android/adb_install_content_shell
-  local TEST_APK="content_shell_test/ContentShellTest-debug"
-  # Use -I to install the test apk only on the first run.
-  # TODO(bulach): remove the second once we have a Smoke test.
-  bb_run_instrumentation_test ${TEST_APK} "-I -A Smoke"
-  bb_run_instrumentation_test ${TEST_APK} "-I -A SmallTest"
-  bb_run_instrumentation_test ${TEST_APK} "-A MediumTest"
-  bb_run_instrumentation_test ${TEST_APK} "-A LargeTest"
-}
-
-# Zip and archive a build.
-function bb_zip_build {
-  echo "@@@BUILD_STEP Zip build@@@"
-  python ../../../../scripts/slave/zip_build.py \
-    --src-dir "$SRC_ROOT" \
-    --exclude-files "lib.target" \
-    --factory-properties "$FACTORY_PROPERTIES" \
-    --build-properties "$BUILD_PROPERTIES"
-}
-
-# Download and extract a build.
-function bb_extract_build {
-  echo "@@@BUILD_STEP Download and extract build@@@"
-  if [[ -z $FACTORY_PROPERTIES || -z $BUILD_PROPERTIES ]]; then
-    return 1
-  fi
-
-  # When extract_build.py downloads an unversioned build it
-  # issues a warning by exiting with large numbered return code
-  # When it fails to download it build, it exits with return
-  # code 1.  We disable halt on error mode and return normally
-  # unless the python tool returns 1.
-  (
-  set +e
-  python ../../../../scripts/slave/extract_build.py \
-    --build-dir "$SRC_ROOT" \
-    --build-output-dir "out" \
-    --factory-properties "$FACTORY_PROPERTIES" \
-    --build-properties "$BUILD_PROPERTIES"
-  local extract_exit_code=$?
-  if (( $extract_exit_code > 1 )); then
-    echo "@@@STEP_WARNINGS@@@"
-    return
-  fi
-  return $extract_exit_code
-  )
-}
-
-# Reboot all phones and wait for them to start back up
-# Does not break build if a phone fails to restart
-function bb_reboot_phones {
-  echo "@@@BUILD_STEP Rebooting phones@@@"
-  (
-  set +e
-  cd $CHROME_SRC/build/android/pylib;
-  for DEVICE in $(adb_get_devices); do
-    python -c "import android_commands;\
-        android_commands.AndroidCommands(device='$DEVICE').Reboot(True)" &
-  done
-  wait
-  )
-}
-
-# Runs the license checker for the WebView build.
-function bb_check_webview_licenses {
-  echo "@@@BUILD_STEP Check licenses for WebView@@@"
-  (
-  set +e
-  cd "${SRC_ROOT}"
-  python android_webview/tools/webview_licenses.py scan
-  local license_exit_code=$?
-  if [[ license_exit_code -ne 0 ]]; then
-    echo "@@@STEP_FAILURE@@@"
-  fi
-  return $license_exit_code
-  )
-}
--- a/media/webrtc/trunk/build/android/buildbot_fyi_builder.sh
+++ b/media/webrtc/trunk/build/android/buildbot_fyi_builder.sh
@@ -1,20 +1,9 @@
-#!/bin/bash -ex
+#!/bin/bash
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
-#
-# Buildbot annotator script for the FYI waterfall builder.
-# Compiler and zip the build.
-
-# SHERIFF: there should be no need to disable this bot.
-# The FYI waterfall does not close the tree.
-
 
-BB_SRC_ROOT="$(cd "$(dirname $0)/../.."; pwd)"
-. "${BB_SRC_ROOT}/build/android/buildbot_functions.sh"
+# Temporary placeholders to call new buildbot script locations until
+# buildbot master config can be pointed to new location.
 
-bb_baseline_setup "$BB_SRC_ROOT" "$@"
-bb_check_webview_licenses
-bb_compile
-bb_compile_experimental
-bb_zip_build
+exec $(dirname $0)/buildbot/bb_fyi_builder.sh "$@"
--- a/media/webrtc/trunk/build/android/buildbot_fyi_tester.sh
+++ b/media/webrtc/trunk/build/android/buildbot_fyi_tester.sh
@@ -1,19 +1,9 @@
-#!/bin/bash -ex
+#!/bin/bash
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
-#
-# Buildbot annotator script for a FYI waterfall tester.
-# Downloads and extracts a build from the builder and runs tests.
-
-# SHERIFF: there should be no need to disable this bot.
-# The FYI waterfall does not close the tree.
 
-BB_SRC_ROOT="$(cd "$(dirname $0)/../.."; pwd)"
-. "${BB_SRC_ROOT}/build/android/buildbot_functions.sh"
+# Temporary placeholders to call new buildbot script locations until
+# buildbot master config can be pointed to new location.
 
-bb_baseline_setup "$BB_SRC_ROOT" "$@"
-bb_extract_build
-bb_reboot_phones
-bb_run_tests
-bb_run_content_shell_instrumentation_test
+exec $(dirname $0)/buildbot/bb_fyi_tester.sh "$@"
--- a/media/webrtc/trunk/build/android/buildbot_main.sh
+++ b/media/webrtc/trunk/build/android/buildbot_main.sh
@@ -1,18 +1,9 @@
-#!/bin/bash -ex
+#!/bin/bash
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
-#
-# Buildbot annotator script for the main waterfall.  Compile only.
-
-ROOT=$(cd "$(dirname $0)"; pwd)
-. "${ROOT}"/buildbot_functions.sh
 
-# SHERIFF: if you need to quickly turn the main waterfall android bots
-# green (preventing tree closures), uncomment the next line (and send
-# appropriate email out):
-## bb_force_bot_green_and_exit
+# Temporary placeholders to call new buildbot script locations until
+# buildbot master config can be pointed to new location.
 
-bb_baseline_setup "${ROOT}"/../..
-bb_compile
-
+exec $(dirname $0)/buildbot/bb_main_builder.sh "$@"
--- a/media/webrtc/trunk/build/android/buildbot_try_builder.sh
+++ b/media/webrtc/trunk/build/android/buildbot_try_builder.sh
@@ -1,18 +1,9 @@
-#!/bin/bash -ex
+#!/bin/bash
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
-#
-# Buildbot annotator script for trybots.  Compile only.
-
-BB_SRC_ROOT="$(cd "$(dirname $0)/../.."; pwd)"
-. "${BB_SRC_ROOT}/build/android/buildbot_functions.sh"
 
-# SHERIFF: if you need to quickly turn "android" trybots green,
-# uncomment the next line (and send appropriate email out):
-## bb_force_bot_green_and_exit
-# You will also need to change buildbot_try_tester.sh
+# Temporary placeholders to call new buildbot script locations until
+# buildbot master config can be pointed to new location.
 
-bb_baseline_setup "$BB_SRC_ROOT" "$@"
-bb_compile
-bb_zip_build
+exec $(dirname $0)/buildbot/bb_try_builder.sh "$@"
--- a/media/webrtc/trunk/build/android/buildbot_try_compile.sh
+++ b/media/webrtc/trunk/build/android/buildbot_try_compile.sh
@@ -1,16 +1,9 @@
-#!/bin/bash -ex
+#!/bin/bash
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
-#
-# Buildbot annotator script for trybots.  Compile only.
-
-ROOT=$(cd "$(dirname $0)"; pwd)
-. "${ROOT}"/buildbot_functions.sh
 
-# SHERIFF: if you need to quickly turn "android" trybots green,
-# uncomment the next line (and send appropriate email out):
-## bb_force_bot_green_and_exit
+# Temporary placeholders to call new buildbot script locations until
+# buildbot master config can be pointed to new location.
 
-bb_baseline_setup "${ROOT}"/../..
-bb_compile
+exec $(dirname $0)/buildbot/bb_try_compile.sh "$@"
deleted file mode 100755
--- a/media/webrtc/trunk/build/android/buildbot_try_compile_test.sh
+++ /dev/null
@@ -1,19 +0,0 @@
-#!/bin/bash -ex
-# Copyright (c) 2012 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-#
-# Buildbot annotator script for trybots.  Compile and test.
-
-ROOT=$(cd "$(dirname $0)"; pwd)
-. "${ROOT}"/buildbot_functions.sh
-
-# SHERIFF: if you need to quickly turn "android_test" trybots green,
-# uncomment the next line (and send appropriate email out):
-## bb_force_bot_green_and_exit
-
-bb_baseline_setup "${ROOT}"/../..
-bb_compile
-bb_reboot_phones
-bb_run_tests
-bb_run_content_shell_instrumentation_test
--- a/media/webrtc/trunk/build/android/buildbot_try_tester.sh
+++ b/media/webrtc/trunk/build/android/buildbot_try_tester.sh
@@ -1,19 +1,9 @@
-#!/bin/bash -ex
+#!/bin/bash
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
-#
-# Buildbot annotator script for tester half of android trybots
-BB_SRC_ROOT="$(cd "$(dirname $0)/../.."; pwd)"
-. "${BB_SRC_ROOT}/build/android/buildbot_functions.sh"
 
-# SHERIFF: if you need to quickly turn "android" trybots green,
-# uncomment the next line (and send appropriate email out):
-## bb_force_bot_green_and_exit
-# You will also need to change buildbot_try_builder.sh
+# Temporary placeholders to call new buildbot script locations until
+# buildbot master config can be pointed to new location.
 
-bb_baseline_setup "$BB_SRC_ROOT" "$@"
-bb_extract_build
-bb_reboot_phones
-bb_run_tests
-bb_run_content_shell_instrumentation_test
+exec $(dirname $0)/buildbot/bb_try_tester.sh "$@"
--- a/media/webrtc/trunk/build/android/buildbot_webkit_main.sh
+++ b/media/webrtc/trunk/build/android/buildbot_webkit_main.sh
@@ -1,18 +1,9 @@
-#!/bin/bash -ex
+#!/bin/bash
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
-#
-# Buildbot annotator script for the WebKit builder on the Canary waterfall.
-
-ROOT=$(cd "$(dirname $0)"; pwd)
-. "${ROOT}"/buildbot_functions.sh
 
-# SHERIFF: if you need to quickly turn the main waterfall android bots
-# green (preventing tree closures), uncomment the next line (and send
-# appropriate email out):
-## bb_force_bot_green_and_exit
+# Temporary placeholders to call new buildbot script locations until
+# buildbot master config can be pointed to new location.
 
-bb_baseline_setup "${ROOT}"/../..
-bb_compile
-
+exec $(dirname $0)/buildbot/bb_webkit_latest_builder.sh "$@"
--- a/media/webrtc/trunk/build/android/device_status_check.py
+++ b/media/webrtc/trunk/build/android/device_status_check.py
@@ -1,20 +1,22 @@
 #!/usr/bin/env python
 #
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """A class to keep track of devices across builds and report state."""
-
+import logging
 import optparse
 import os
+import smtplib
 import sys
 
+from pylib import buildbot_report
 from pylib.android_commands import GetAttachedDevices
 from pylib.cmd_helper import GetCmdOutput
 
 
 def DeviceInfo(serial):
   """Gathers info on a device via various adb calls.
 
   Args:
@@ -52,69 +54,117 @@ def CheckForMissingDevices(options, adb_
   """Uses file of previous online devices to detect broken phones.
 
   Args:
     options: out_dir parameter of options argument is used as the base
              directory to load and update the cache file.
     adb_online_devs: A list of serial numbers of the currently visible
                      and online attached devices.
   """
+  # TODO(navabi): remove this once the bug that causes different number
+  # of devices to be detected between calls is fixed.
+  logger = logging.getLogger()
+  logger.setLevel(logging.INFO)
 
-  last_devices_path = os.path.abspath(os.path.join(options.out_dir,
-                                                   '.last_devices'))
-  last_devices = []
-  try:
-    with open(last_devices_path) as f:
-      last_devices = f.read().splitlines()
-  except IOError:
-    # Ignore error, file might not exist
-    pass
+  out_dir = os.path.abspath(options.out_dir)
+
+  def ReadDeviceList(file_name):
+    devices_path = os.path.join(out_dir, file_name)
+    devices = []
+    try:
+      with open(devices_path) as f:
+        devices = f.read().splitlines()
+    except IOError:
+      # Ignore error, file might not exist
+      pass
+    return devices
+
+  def WriteDeviceList(file_name, device_list):
+    path = os.path.join(out_dir, file_name)
+    if not os.path.exists(out_dir):
+      os.makedirs(out_dir)
+    with open(path, 'w') as f:
+      # Write devices currently visible plus devices previously seen.
+      f.write('\n'.join(set(device_list)))
+
+  last_devices_path = os.path.join(out_dir, '.last_devices')
+  last_devices = ReadDeviceList('.last_devices')
 
   missing_devs = list(set(last_devices) - set(adb_online_devs))
   if missing_devs:
-    print '@@@STEP_WARNINGS@@@'
-    print '@@@STEP_SUMMARY_TEXT@%s not detected.@@@' % missing_devs
-    print 'Current online devices: %s' % adb_online_devs
-    print '%s are no longer visible. Were they removed?\n' % missing_devs
-    print 'SHERIFF: See go/chrome_device_monitor'
-    print 'Cache file: %s\n\n' % last_devices_path
-    print 'adb devices'
-    print GetCmdOutput(['adb', 'devices'])
+    from_address = 'buildbot@chromium.org'
+    to_address = 'chromium-android-device-alerts@google.com'
+    bot_name = os.environ['BUILDBOT_BUILDERNAME']
+    slave_name = os.environ['BUILDBOT_SLAVENAME']
+    num_online_devs = len(adb_online_devs)
+    subject = 'Devices offline on %s, %s (%d remaining).' % (slave_name,
+                                                             bot_name,
+                                                             num_online_devs)
+    buildbot_report.PrintWarning()
+    devices_missing_msg = '%d devices not detected.' % len(missing_devs)
+    buildbot_report.PrintSummaryText(devices_missing_msg)
+
+    # TODO(navabi): Debug by printing both output from GetCmdOutput and
+    # GetAttachedDevices to compare results.
+    body = '\n'.join(
+        ['Current online devices: %s' % adb_online_devs,
+         '%s are no longer visible. Were they removed?\n' % missing_devs,
+         'SHERIFF: See go/chrome_device_monitor',
+         'Cache file: %s\n\n' % last_devices_path,
+         'adb devices: %s' % GetCmdOutput(['adb', 'devices']),
+         'adb devices(GetAttachedDevices): %s' % GetAttachedDevices()])
+
+    print body
+
+    # Only send email if the first time a particular device goes offline
+    last_missing = ReadDeviceList('.last_missing')
+    new_missing_devs = set(missing_devs) - set(last_missing)
+
+    if new_missing_devs:
+      msg_body = '\r\n'.join(
+          ['From: %s' % from_address,
+           'To: %s' % to_address,
+           'Subject: %s' % subject,
+           '', body])
+      try:
+        server = smtplib.SMTP('localhost')
+        server.sendmail(from_address, [to_address], msg_body)
+        server.quit()
+      except Exception as e:
+        print 'Failed to send alert email. Error: %s' % e
   else:
     new_devs = set(adb_online_devs) - set(last_devices)
-    if new_devs:
-      print '@@@STEP_WARNINGS@@@'
-      print '@@@STEP_SUMMARY_TEXT@New devices detected :-)@@@'
+    if new_devs and os.path.exists(last_devices_path):
+      buildbot_report.PrintWarning()
+      buildbot_report.PrintSummaryText(
+          '%d new devices detected' % len(new_devs))
       print ('New devices detected %s. And now back to your '
              'regularly scheduled program.' % list(new_devs))
-
-  # Write devices currently visible plus devices previously seen.
-  with open(last_devices_path, 'w') as f:
-    f.write('\n'.join(set(adb_online_devs + last_devices)))
+  WriteDeviceList('.last_devices', (adb_online_devs + last_devices))
+  WriteDeviceList('.last_missing', missing_devs)
 
 
 def main():
   parser = optparse.OptionParser()
   parser.add_option('', '--out-dir',
                     help='Directory where the device path is stored',
                     default=os.path.join(os.path.dirname(__file__), '..',
                                          '..', 'out'))
 
   options, args = parser.parse_args()
   if args:
     parser.error('Unknown options %s' % args)
+  buildbot_report.PrintNamedStep('Device Status Check')
   devices = GetAttachedDevices()
-
   types, builds, reports = [], [], []
   if devices:
     types, builds, reports = zip(*[DeviceInfo(dev) for dev in devices])
 
   unique_types = list(set(types))
   unique_builds = list(set(builds))
 
-  print ('@@@BUILD_STEP Device Status Check - '
-         '%d online devices, types %s, builds %s@@@'
-         % (len(devices), unique_types, unique_builds))
+  buildbot_report.PrintMsg('Online devices: %d. Device types %s, builds %s'
+                           % (len(devices), unique_types, unique_builds))
   print '\n'.join(reports)
   CheckForMissingDevices(options, devices)
 
 if __name__ == '__main__':
   sys.exit(main())
--- a/media/webrtc/trunk/build/android/emulator.py
+++ b/media/webrtc/trunk/build/android/emulator.py
@@ -171,17 +171,17 @@ class Emulator(object):
     """
     avd_command = [
         self.android,
         '--silent',
         'create', 'avd',
         '--name', avd_name,
         '--abi', self.abi,
         '--target', 'android-16',
-        '-c', '64M',
+        '-c', '128M',
         '--force',
     ]
     avd_process = subprocess.Popen(args=avd_command,
                                    stdin=subprocess.PIPE,
                                    stdout=subprocess.PIPE,
                                    stderr=subprocess.STDOUT)
     avd_process.stdin.write('no\n')
     avd_process.wait()
@@ -216,16 +216,18 @@ class Emulator(object):
     (self.device, port) = self._DeviceName()
     emulator_command = [
         self.emulator,
         # Speed up emulator launch by 40%.  Really.
         '-no-boot-anim',
         # The default /data size is 64M.
         # That's not enough for 8 unit test bundles and their data.
         '-partition-size', '512',
+        # Enable GPU by default.
+        '-gpu', 'on',
         # Use a familiar name and port.
         '-avd', self.avd,
         '-port', str(port)]
     if not self.fast_and_loose:
       emulator_command.extend([
           # Wipe the data.  We've seen cases where an emulator
           # gets 'stuck' if we don't do this (every thousand runs or
           # so).
--- a/media/webrtc/trunk/build/android/envsetup.sh
+++ b/media/webrtc/trunk/build/android/envsetup.sh
@@ -5,19 +5,25 @@
 # found in the LICENSE file.
 
 # Sets up environment for building Chromium on Android.  It can either be
 # compiled with the Android tree or using the Android SDK/NDK. To build with
 # NDK/SDK: ". build/android/envsetup.sh --sdk".  Environment variable
 # ANDROID_SDK_BUILD=1 will then be defined and used in the rest of the setup to
 # specifiy build type.
 
+# When building WebView as part of Android we can't use the SDK. Other builds
+# default to using the SDK.
 # NOTE(yfriedman): This looks unnecessary but downstream the default value
 # should be 0 until all builds switch to SDK/NDK.
-export ANDROID_SDK_BUILD=1
+if [[ "${CHROME_ANDROID_BUILD_WEBVIEW}" -eq 1 ]]; then
+  export ANDROID_SDK_BUILD=0
+else
+  export ANDROID_SDK_BUILD=1
+fi
 # Loop over args in case we add more arguments in the future.
 while [ "$1" != "" ]; do
   case $1 in
     -s | --sdk  ) export ANDROID_SDK_BUILD=1 ; shift ;;
     *  )          shift ; break ;;
   esac
 done
 
@@ -35,77 +41,93 @@ case "${host_os}" in
     toolchain_dir="darwin-x86"
     ;;
   *)
     echo "Host platform ${host_os} is not supported" >& 2
     return 1
 esac
 
 CURRENT_DIR="$(readlink -f "$(dirname $BASH_SOURCE)/../../")"
-if [ -z "${CHROME_SRC}" ]; then
+if [[ -z "${CHROME_SRC}" ]]; then
   # If $CHROME_SRC was not set, assume current directory is CHROME_SRC.
   export CHROME_SRC="${CURRENT_DIR}"
 fi
 
-if [ "${CURRENT_DIR/"${CHROME_SRC}"/}" == "${CURRENT_DIR}" ]; then
+if [[ "${CURRENT_DIR/"${CHROME_SRC}"/}" == "${CURRENT_DIR}" ]]; then
   # If current directory is not in $CHROME_SRC, it might be set for other
   # source tree. If $CHROME_SRC was set correctly and we are in the correct
   # directory, "${CURRENT_DIR/"${CHROME_SRC}"/}" will be "".
   # Otherwise, it will equal to "${CURRENT_DIR}"
   echo "Warning: Current directory is out of CHROME_SRC, it may not be \
 the one you want."
   echo "${CHROME_SRC}"
 fi
 
 # Android sdk platform version to use
 export ANDROID_SDK_VERSION=16
 
 # Source functions script.  The file is in the same directory as this script.
 . "$(dirname $BASH_SOURCE)"/envsetup_functions.sh
 
-if [ "${ANDROID_SDK_BUILD}" -eq 1 ]; then
+if [[ "${ANDROID_SDK_BUILD}" -eq 1 ]]; then
   sdk_build_init
 # Sets up environment for building Chromium for Android with source. Expects
 # android environment setup and lunch.
-elif [ -z "$ANDROID_BUILD_TOP" -o -z "$ANDROID_TOOLCHAIN" -o \
-  -z "$ANDROID_PRODUCT_OUT" ]; then
+elif [[ -z "$ANDROID_BUILD_TOP" || \
+        -z "$ANDROID_TOOLCHAIN" || \
+        -z "$ANDROID_PRODUCT_OUT" ]]; then
   echo "Android build environment variables must be set."
   echo "Please cd to the root of your Android tree and do: "
   echo "  . build/envsetup.sh"
   echo "  lunch"
   echo "Then try this again."
   echo "Or did you mean NDK/SDK build. Run envsetup.sh with --sdk argument."
   return 1
+elif [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then
+  webview_build_init
 else
   non_sdk_build_init
 fi
 
 # Workaround for valgrind build
-if [ -n "$CHROME_ANDROID_VALGRIND_BUILD" ]; then
+if [[ -n "$CHROME_ANDROID_VALGRIND_BUILD" ]]; then
 # arm_thumb=0 is a workaround for https://bugs.kde.org/show_bug.cgi?id=270709
   DEFINES+=" arm_thumb=0 release_extra_cflags='-fno-inline\
  -fno-omit-frame-pointer -fno-builtin' release_valgrind_build=1\
  release_optimize=1"
 fi
 
 # Source a bunch of helper functions
 . ${CHROME_SRC}/build/android/adb_device_functions.sh
 
 ANDROID_GOMA_WRAPPER=""
 if [[ -d $GOMA_DIR ]]; then
   ANDROID_GOMA_WRAPPER="$GOMA_DIR/gomacc"
 fi
 export ANDROID_GOMA_WRAPPER
 
-export CC_target="${ANDROID_GOMA_WRAPPER} $(echo -n ${ANDROID_TOOLCHAIN}/*-gcc)"
+# Declare Android are cross compile.
+export GYP_CROSSCOMPILE=1
+
 export CXX_target="${ANDROID_GOMA_WRAPPER} \
-  $(echo -n ${ANDROID_TOOLCHAIN}/*-g++)"
-export LINK_target=$(echo -n ${ANDROID_TOOLCHAIN}/*-gcc)
-export AR_target=$(echo -n ${ANDROID_TOOLCHAIN}/*-ar)
+    $(echo -n ${ANDROID_TOOLCHAIN}/*-g++)"
 
 # Performs a gyp_chromium run to convert gyp->Makefile for android code.
 android_gyp() {
   echo "GYP_GENERATORS set to '$GYP_GENERATORS'"
-  "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@"
+  # http://crbug.com/143889.
+  # In case we are doing a Clang build, we have to unset CC_target and
+  # CXX_target. Otherwise GYP ends up generating a gcc build (although we set
+  # 'clang' to 1). This behavior was introduced by
+  # 54d2f6fe6d8a7b9d9786bd1f8540df6b4f46b83f in GYP.
+  (
+    # Fork to avoid side effects on the user's environment variables.
+    if echo "$GYP_DEFINES" | grep -qE '(clang|asan)'; then
+      if echo "$CXX_target" | grep -q g++; then
+        unset CXX_target
+      fi
+    fi
+    "${CHROME_SRC}/build/gyp_chromium" --depth="${CHROME_SRC}" --check "$@"
+  )
 }
 
 # FLOCK needs to be null on system that has no flock
 which flock > /dev/null || export FLOCK=
--- a/media/webrtc/trunk/build/android/envsetup_functions.sh
+++ b/media/webrtc/trunk/build/android/envsetup_functions.sh
@@ -25,17 +25,16 @@ common_check_toolchain() {
 # based on CHROME_SRC and ANDROID_TOOLCHAIN, along with DEFINES for GYP_DEFINES.
 ################################################################################
 common_vars_defines() {
 
   # Set toolchain path according to product architecture.
   toolchain_arch="arm-linux-androideabi"
   if [[ "${TARGET_PRODUCT}" =~ .*x86.* ]]; then
     toolchain_arch="x86"
-    toolchain_dir="linux-x86"
   fi
 
   toolchain_version="4.6"
   toolchain_target=$(basename \
     ${ANDROID_NDK_ROOT}/toolchains/${toolchain_arch}-${toolchain_version})
   toolchain_path="${ANDROID_NDK_ROOT}/toolchains/${toolchain_target}"\
 "/prebuilt/${toolchain_dir}/bin/"
 
@@ -44,33 +43,40 @@ common_vars_defines() {
   export ANDROID_TOOLCHAIN=${ANDROID_TOOLCHAIN:-${toolchain_path}}
 
   common_check_toolchain
 
   # Add Android SDK/NDK tools to system path.
   export PATH=$PATH:${ANDROID_NDK_ROOT}
   export PATH=$PATH:${ANDROID_SDK_ROOT}/tools
   export PATH=$PATH:${ANDROID_SDK_ROOT}/platform-tools
+
+  # This must be set before ANDROID_TOOLCHAIN, so that clang could find the
+  # gold linker.
+  # TODO(michaelbai): Remove this path once the gold linker become the default
+  # linker.
+  export PATH=$PATH:${CHROME_SRC}/build/android/${toolchain_arch}-gold
+
   # Must have tools like arm-linux-androideabi-gcc on the path for ninja
   export PATH=$PATH:${ANDROID_TOOLCHAIN}
 
   # Add Chromium Android development scripts to system path.
   # Must be after CHROME_SRC is set.
   export PATH=$PATH:${CHROME_SRC}/build/android
 
   # TODO(beverloo): Remove these once all consumers updated to --strip-binary.
   export OBJCOPY=$(echo ${ANDROID_TOOLCHAIN}/*-objcopy)
   export STRIP=$(echo ${ANDROID_TOOLCHAIN}/*-strip)
 
   # The set of GYP_DEFINES to pass to gyp. Use 'readlink -e' on directories
   # to canonicalize them (remove double '/', remove trailing '/', etc).
   DEFINES="OS=android"
   DEFINES+=" host_os=${host_os}"
 
-  if [ -n "$CHROME_ANDROID_OFFICIAL_BUILD" ]; then
+  if [[ -n "$CHROME_ANDROID_OFFICIAL_BUILD" ]]; then
     DEFINES+=" branding=Chrome"
     DEFINES+=" buildtype=Official"
 
     # These defines are used by various chrome build scripts to tag the binary's
     # version string as 'official' in linux builds (e.g. in
     # chrome/trunk/src/chrome/tools/build/version.py).
     export OFFICIAL_BUILD=1
     export CHROMIUM_BUILD="_google_chrome"
@@ -87,41 +93,57 @@ common_vars_defines() {
   # --section-ordering-file=<orderfile>. The order file is updated by profiling
   # startup after compiling with the order_profiling=1 GYP_DEFINES flag.
   ORDER_DEFINES="order_text_section=${CHROME_SRC}/orderfiles/orderfile.out"
 
   # The following defines will affect ARM code generation of both C/C++ compiler
   # and V8 mksnapshot.
   case "${TARGET_PRODUCT}" in
     "passion"|"soju"|"sojua"|"sojus"|"yakju"|"mysid"|"nakasi")
-      DEFINES+=" target_arch=arm"
       DEFINES+=" arm_neon=1 armv7=1 arm_thumb=1"
       DEFINES+=" ${ORDER_DEFINES}"
+      TARGET_ARCH="arm"
       ;;
     "trygon"|"tervigon")
-      DEFINES+=" target_arch=arm"
       DEFINES+=" arm_neon=0 armv7=1 arm_thumb=1 arm_fpu=vfpv3-d16"
       DEFINES+=" ${ORDER_DEFINES}"
+      TARGET_ARCH="arm"
       ;;
     "full")
-      DEFINES+=" target_arch=arm"
       DEFINES+=" arm_neon=0 armv7=0 arm_thumb=1 arm_fpu=vfp"
+      TARGET_ARCH="arm"
       ;;
     *x86*)
     # TODO(tedbo): The ia32 build fails on ffmpeg, so we disable it here.
-      DEFINES+=" target_arch=ia32 use_libffmpeg=0"
+      DEFINES+=" use_libffmpeg=0"
 
       host_arch=$(uname -m | sed -e \
         's/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/;s/i86pc/ia32/')
       DEFINES+=" host_arch=${host_arch}"
+      TARGET_ARCH="x86"
       ;;
     *)
       echo "TARGET_PRODUCT: ${TARGET_PRODUCT} is not supported." >& 2
       return 1
   esac
+
+  case "${TARGET_ARCH}" in
+    "arm")
+      DEFINES+=" target_arch=arm"
+      ;;
+    "x86")
+      DEFINES+=" target_arch=ia32"
+      ;;
+    *)
+      echo "TARGET_ARCH: ${TARGET_ARCH} is not supported." >& 2
+      return 1
+  esac
+
+  DEFINES+=" android_gdbserver=${ANDROID_NDK_ROOT}/prebuilt/\
+android-${TARGET_ARCH}/gdbserver/gdbserver"
 }
 
 
 ################################################################################
 # Exports common GYP variables based on variable DEFINES and CHROME_SRC.
 ################################################################################
 common_gyp_vars() {
   export GYP_DEFINES="${DEFINES}"
@@ -148,23 +170,26 @@ common_gyp_vars() {
 #  > export ANDROID_NDK_ROOT=<android ndk root>
 #  > export ANDROID_SDK_ROOT=<android sdk root> # to override the default sdk
 #  > . build/android/envsetup.sh --sdk
 #  > make
 ################################################################################
 sdk_build_init() {
   # If ANDROID_NDK_ROOT is set when envsetup is run, use the ndk pointed to by
   # the environment variable.  Otherwise, use the default ndk from the tree.
-  if [ ! -d "${ANDROID_NDK_ROOT}" ]; then
+  if [[ -z "${ANDROID_NDK_ROOT}" || ! -d "${ANDROID_NDK_ROOT}" ]]; then
     export ANDROID_NDK_ROOT="${CHROME_SRC}/third_party/android_tools/ndk/"
   fi
 
-  # If ANDROID_SDK_ROOT is set when envsetup is run, use the sdk pointed to by
-  # the environment variable.  Otherwise, use the default sdk from the tree.
-  if [ ! -d "${ANDROID_SDK_ROOT}" ]; then
+  # If ANDROID_SDK_ROOT is set when envsetup is run, and if it has the
+  # right SDK-compatible directory layout, use the sdk pointed to by the
+  # environment variable.  Otherwise, use the default sdk from the tree.
+  local sdk_suffix=platforms/android-${ANDROID_SDK_VERSION}
+  if [[ -z "${ANDROID_SDK_ROOT}" || \
+       ! -d "${ANDROID_SDK_ROOT}/${sdk_suffix}" ]]; then
     export ANDROID_SDK_ROOT="${CHROME_SRC}/third_party/android_tools/sdk/"
   fi
 
   # Makes sure ANDROID_BUILD_TOP is unset if build has option --sdk
   unset ANDROID_BUILD_TOP
 
   # Set default target.
   export TARGET_PRODUCT="${TARGET_PRODUCT:-trygon}"
@@ -186,26 +211,25 @@ sdk_build_init() {
 
   # Sets android specific directories to NOT_SDK_COMPLIANT.  This will allow
   # android_gyp to generate make files, but will cause errors when (and only
   # when) building targets that depend on these directories.
   DEFINES+=" android_src='NOT_SDK_COMPLIANT'"
   DEFINES+=" android_product_out=${CHROME_SRC}/out/android"
   DEFINES+=" android_lib='NOT_SDK_COMPLIANT'"
   DEFINES+=" android_static_lib='NOT_SDK_COMPLIANT'"
-  DEFINES+=\
-" android_sdk=${ANDROID_SDK_ROOT}/platforms/android-${ANDROID_SDK_VERSION}"
+  DEFINES+=" android_sdk=${ANDROID_SDK_ROOT}/${sdk_suffix}"
   DEFINES+=" android_sdk_root=${ANDROID_SDK_ROOT}"
   DEFINES+=" android_sdk_tools=${ANDROID_SDK_ROOT}/platform-tools"
   DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}"
   DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}"
 
   common_gyp_vars
 
-  if [ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]; then
+  if [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then
     # Can not build WebView with NDK/SDK because it needs the Android build
     # system and build inside an Android source tree.
     echo "Can not build WebView with NDK/SDK.  Requires android source tree." \
         >& 2
     echo "Try . build/android/envsetup.sh instead." >& 2
     return 1
   fi
 
@@ -220,20 +244,20 @@ sdk_build_init() {
 #  > make
 #############################################################################
 non_sdk_build_init() {
   # We export "TOP" here so that "mmm" can be run to build Java code without
   # having to cd to $ANDROID_BUILD_TOP.
   export TOP="$ANDROID_BUILD_TOP"
 
   # Set "ANDROID_NDK_ROOT" as checked-in version, if it was not set.
-  if [ ! -d "$ANDROID_NDK_ROOT" ] ; then
+  if [[ "${ANDROID_NDK_ROOT}" || ! -d "$ANDROID_NDK_ROOT" ]] ; then
     export ANDROID_NDK_ROOT="${CHROME_SRC}/third_party/android_tools/ndk/"
   fi
-  if [ ! -d "$ANDROID_NDK_ROOT" ] ; then
+  if [[ ! -d "${ANDROID_NDK_ROOT}" ]] ; then
     echo "Can not find Android NDK root ${ANDROID_NDK_ROOT}." >& 2
     return 1
   fi
 
   # We export "ANDROID_SDK_ROOT" for building Java source with the SDK.
   export ANDROID_SDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/sdk/\
 ${ANDROID_SDK_VERSION}
   # Needed by android antfiles when creating apks.
@@ -243,17 +267,17 @@ non_sdk_build_init() {
   # in common_vars_defines
   unset ANDROID_TOOLCHAIN
 
   common_vars_defines
 
   DEFINES+=" sdk_build=0"
   DEFINES+=" android_product_out=${ANDROID_PRODUCT_OUT}"
 
-  if [ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]; then
+  if [[ -n "$CHROME_ANDROID_BUILD_WEBVIEW" ]]; then
     webview_build_init
     return
   fi
 
   # The non-SDK build currently requires the SDK path to build the framework
   # Java aidl files. TODO(steveblock): Investigate avoiding this requirement.
   DEFINES+=" android_sdk=${ANDROID_SDK_ROOT}"
   DEFINES+=" android_sdk_root=${ANDROID_SDK_ROOT}"
@@ -265,35 +289,46 @@ non_sdk_build_init() {
 }
 
 ################################################################################
 # To build WebView, we use the Android build system and build inside an Android
 # source tree. This method is called from non_sdk_build_init() and adds to the
 # settings specified there.
 #############################################################################
 webview_build_init() {
+  # For the WebView build we always use the NDK and SDK in the Android tree,
+  # and we don't touch ANDROID_TOOLCHAIN which is already set by Android.
+  export ANDROID_NDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/ndk/8
+  export ANDROID_SDK_ROOT=${ANDROID_BUILD_TOP}/prebuilts/sdk/\
+${ANDROID_SDK_VERSION}
+
+  common_vars_defines
+
   # We need to supply SDK paths relative to the top of the Android tree to make
   # sure the generated Android makefiles are portable, as they will be checked
   # into the Android tree.
   ANDROID_SDK=$(python -c \
-      "import os.path; print os.path.relpath('${ANDROID_SDK_ROOT}', '${TOP}')")
+      "import os.path; print os.path.relpath('${ANDROID_SDK_ROOT}', \
+      '${ANDROID_BUILD_TOP}')")
   ANDROID_SDK_TOOLS=$(python -c \
       "import os.path; \
       print os.path.relpath('${ANDROID_SDK_ROOT}/../tools/linux', \
-      '${TOP}')")
+      '${ANDROID_BUILD_TOP}')")
   DEFINES+=" android_build_type=1"
+  DEFINES+=" sdk_build=0"
+  DEFINES+=" android_src=\$(GYP_ABS_ANDROID_TOP_DIR)"
+  DEFINES+=" android_product_out=NOT_USED_ON_WEBVIEW"
   DEFINES+=" android_upstream_bringup=1"
   DEFINES+=" android_sdk=\$(GYP_ABS_ANDROID_TOP_DIR)/${ANDROID_SDK}"
-  DEFINES+=" android_sdk_root=${ANDROID_SDK_ROOT}"
+  DEFINES+=" android_sdk_root=\$(GYP_ABS_ANDROID_TOP_DIR)/${ANDROID_SDK}"
   DEFINES+=" android_sdk_tools=\$(GYP_ABS_ANDROID_TOP_DIR)/${ANDROID_SDK_TOOLS}"
   DEFINES+=" android_sdk_version=${ANDROID_SDK_VERSION}"
   DEFINES+=" android_toolchain=${ANDROID_TOOLCHAIN}"
   export GYP_DEFINES="${DEFINES}"
 
   export GYP_GENERATORS="android"
 
   export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} default_target=All"
   export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} limit_to_target_all=1"
   export GYP_GENERATOR_FLAGS="${GYP_GENERATOR_FLAGS} auto_regeneration=0"
 
-  # TODO(torne): This isn't upstream yet. Upstream it or remove this setting.
-  export CHROMIUM_GYP_FILE="${CHROME_SRC}/build/all_android_webview.gyp"
+  export CHROMIUM_GYP_FILE="${CHROME_SRC}/android_webview/all_webview.gyp"
 }
--- a/media/webrtc/trunk/build/android/gdb_apk
+++ b/media/webrtc/trunk/build/android/gdb_apk
@@ -153,17 +153,17 @@ fi
 cmdfile=$(mktemp /tmp/gdb_android_XXXXXXXX)
 cat >$cmdfile<<EOF
 # set solib-absolute-prefix null
 set solib-search-path ${shared_lib_dir}
 file ${app_process}
 target remote :4321
 EOF
 
-gdb=$(echo $ANDROID_TOOLCHAIN/*gdb)
+gdb=$(echo $ANDROID_TOOLCHAIN/../../linux-x86/bin/*gdb)
 if [[ ! -f ${gdb} ]] ; then
   echo "Wow no gdb in env var ANDROID_TOOLCHAIN which is $ANDROID_TOOLCHAIN"
   exit 4
 else
   echo Using $gdb
 fi
 
 # ${gdb} -x $cmdfile $* $app_process
--- a/media/webrtc/trunk/build/android/gtest_filter/content_unittests_disabled
+++ b/media/webrtc/trunk/build/android/gtest_filter/content_unittests_disabled
@@ -7,14 +7,15 @@ AudioRendererHostTest.CreatePlayPauseAnd
 AudioRendererHostTest.SetVolume
 AudioRendererHostTest.CreatePlayAndShutdown
 AudioRendererHostTest.CreatePlayPauseAndShutdown
 AudioRendererHostTest.SimulateError
 AudioRendererHostTest.SimulateErrorAndClose
 # crbug.com/104950
 DeviceOrientationProviderTest.ObserverNotRemoved
 DeviceOrientationProviderTest.StartFailing
-# crbug.com/138138
-GpuMemoryManagerTest.StubMemoryStatsForLastManageTests
 # crbug.com/138930
 SkCanvasVideoRendererTest.*
 # crbug.com/139095
 RenderWidgetTest.OnMsgPaintAtSize
+# crbug.com/147549
+GamepadProviderTest.PollingAccess
+PepperGamepadHostTest.WaitForReply
--- a/media/webrtc/trunk/build/android/gtest_filter/media_unittests_disabled
+++ b/media/webrtc/trunk/build/android/gtest_filter/media_unittests_disabled
@@ -1,15 +1,10 @@
 # List of suppressions
 
-# crbug.com/138848
-AudioOutputControllerTest.CreateAndClose
-AudioOutputControllerTest.PlayPauseClose
-AudioOutputControllerTest.PlayPausePlayClose
-
 # crbug.com/136720
 CrossProcessNotificationMultiProcessTest.Basic
 
 # Death tests are not supported on APK
 # http://crbug.com/138855
 CompositeFilterDeathTest.*
 
 # http://crbug.com/138833
--- a/media/webrtc/trunk/build/android/gtest_filter/net_unittests_disabled
+++ b/media/webrtc/trunk/build/android/gtest_filter/net_unittests_disabled
@@ -1,21 +1,19 @@
 # List of suppressions.
 # Generated by hand to get net_unittests running initially.
 # Likely too aggressive disabling.
 DiskCacheBackendTest.*
-NetUtilTest.GetNetworkList
 TransportSecurityStateTest.ParseSidePins*
 # TODO(jnd): The following tests are disabled because test server spawner is not
 # enabled on Chromium Android. Once the net upstreaming is done, test server
 # spawner can be enabled and those tests should pass.
 # BUG=135165
 X509CertificateTest.*
 X509CertificateParseTest.*
-FtpDirectoryListingParserWindowsTest.Good
 HttpNetworkTransactionSpdy2Test.SOCKS4_HTTP_GET
 HttpNetworkTransactionSpdy2Test.SOCKS4_SSL_GET
 HttpNetworkTransactionSpdy21Test.SOCKS4_HTTP_GET
 HttpNetworkTransactionSpdy21Test.SOCKS4_SSL_GET
 HttpNetworkTransactionSpdy3Test.SOCKS4_HTTP_GET
 HttpNetworkTransactionSpdy3Test.SOCKS4_SSL_GET
 HttpNetworkTransactionTest.SOCKS4_HTTP_GET
 HttpNetworkTransactionTest.SOCKS4_SSL_GET
@@ -49,20 +47,20 @@ WebSocketJobSpdy3Test.ThrottlingWebSocke
 WebSocketJobSpdy3Test.ThrottlingWebSocketSpdyEnabled
 WebSocketJobSpdy3Test.ThrottlingSpdy
 WebSocketJobSpdy3Test.ThrottlingSpdySpdyEnabled
 WebSocketJobTest.ThrottlingWebSocket
 WebSocketJobTest.ThrottlingWebSocketSpdyEnabled
 WebSocketJobTest.ThrottlingSpdy
 WebSocketJobTest.ThrottlingSpdySpdyEnabled
 X509CertificateWeakDigestTest.*
-FtpDirectoryListingParserTest.*
 */X509CertificateWeakDigestTest.*
 TransportSecurityStateTest.BogusPinsHeaders
-TransportSecurityStateTest.ValidPinsHeaders
+TransportSecurityStateTest.ValidPinsHeadersSHA1
+TransportSecurityStateTest.ValidPinsHeadersSHA256
 HTTPSRequestTest.ResumeTest
 HTTPSRequestTest.SSLSessionCacheShardTest
 HTTPSRequestTest.HTTPSErrorsNoClobberTSSTest
 HttpNetworkTransactionSpdy3Test.UploadUnreadableFile
 HttpNetworkTransactionSpdy2Test.UploadUnreadableFile
 HTTPSRequestTest.SSLv3Fallback
 HTTPSEVCRLSetTest.FreshCRLSet
 HTTPSCRLSetTest.ExpiredCRLSet
--- a/media/webrtc/trunk/build/android/gtest_filter/unit_tests_disabled
+++ b/media/webrtc/trunk/build/android/gtest_filter/unit_tests_disabled
@@ -14,20 +14,16 @@ NetworkStatsTestUDP.*
 
 # Missing test resource of 16MB.
 HistoryProfileTest.TypicalProfileVersion
 
 # crbug.com/139408
 SQLitePersistentCookieStoreTest.TestDontLoadOldSessionCookies
 SQLitePersistentCookieStoreTest.PersistIsPersistent
 
-# We don't use the GPU blacklist and we don't fetch the deps project for the
-# blacklist data so this test is not relevant for us.
-GpuBlacklistTest.CurrentBlacklistValidation
-
 # http://crbug.com/117940
 TemplateURLTest.*
 TemplateURLPrepopulateDataTest.*
 TemplateURLServiceSyncTest.*
 SearchHostToURLsMapTest.*
 
 # crbug.com/139427
 TemplateURLFetcherTest.*
@@ -59,19 +55,16 @@ URLFixerUpperTest.FixupRelativeFile
 DownloadPathReservationTrackerTest.CreateDefaultDownloadPath
 
 # crbug.com/139423
 ValueStoreFrontendTest.GetExistingData
 
 # crbug.com/139421
 ChromeSelectFilePolicyTest.ExpectAsynchronousListenerCall
 
-# crbug.com/139412
-UserStyleSheetWatcherTest.StyleLoad
-
 # http://crbug.com/139033
 ChromeDownloadManagerDelegateTest.StartDownload_PromptAlways
 
 # http://crbug.com/139165
 KeywordEditorControllerTest.*
 
 # Extension support is limited on Android.
 # Some of these can be enabled if we register extension related prefs in
@@ -97,20 +90,20 @@ PageActionControllerTest.*
 PermissionsUpdaterTest.*
 ImageLoadingTrackerTest.*
 ScriptBadgeControllerTest.*
 ExtensionSettingsFrontendTest.*
 ExtensionSettingsSyncTest.*
 ExtensionUpdaterTest.*
 UserScriptListenerTest.*
 WebApplicationTest.GetShortcutInfoForTab
+ExtensionActionIconFactoryTest.*
 
 # crbug.com/139411
 AutocompleteProviderTest.*
-HistoryQuickProviderTest.*
 HistoryContentsProviderBodyOnlyTest.*
 HistoryContentsProviderTest.*
 HQPOrderingTest.*
 SearchProviderTest.*
 
 # Test server and forwarder and not ready yet.
 ProtocolHandlerRegistryTest.TestOSRegistrationFailure
 ConnectionTesterTest.*
@@ -125,23 +118,32 @@ SQLiteServerBoundCertStoreTest.TestUpgra
 ProfileSyncComponentsFactoryImplTest.*
 PermissionsTest.GetWarningMessages_Plugins
 ImageOperations.ResizeShouldAverageColors
 
 # crbug.com/138275
 PrerenderTest.*
 RenderWidgetTest.OnMsgPaintAtSize
 
+# crbug.com/146857
+TopSitesTest.Blacklisting
+
 # crbug.com/139643
-VariationsHelperTest.DisableAfterInitialization
-VariationsHelperTest.AssociateGoogleVariationID
-VariationsHelperTest.NoAssociation
+VariationsUtilTest.DisableAfterInitialization
+VariationsUtilTest.AssociateGoogleVariationID
+VariationsUtilTest.NoAssociation
 
 # crbug.com/141473
 AutofillManagerTest.UpdatePasswordSyncState
 AutofillManagerTest.UpdatePasswordGenerationState
 
 # crbug.com/144227
 ExtensionIconImageTest.*
 
-# crbug.com/144161
-PasswordStoreDefaultTest.NonASCIIData
-PasswordStoreTest.IgnoreOldWwwGoogleLogins
+# crbug.com/145843
+EntropyProviderTest.UseOneTimeRandomizationSHA1
+EntropyProviderTest.UseOneTimeRandomizationPermuted
+
+# crbug.com/147500
+ManifestTest.RestrictedKeys
+
+# crbug.com/152599
+SyncSearchEngineDataTypeControllerTest.*
--- a/media/webrtc/trunk/build/android/lighttpd_server.py
+++ b/media/webrtc/trunk/build/android/lighttpd_server.py
@@ -9,27 +9,26 @@
 Usage:
   lighttpd_server PATH_TO_DOC_ROOT
 """
 
 import codecs
 import contextlib
 import httplib
 import os
-import pexpect
 import random
 import shutil
 import socket
 import subprocess
 import sys
 import tempfile
 import time
 
 from pylib import constants
-
+from pylib import pexpect
 
 class LighttpdServer(object):
   """Wraps lighttpd server, providing robust startup.
 
   Args:
     document_root: Path to root of this server's hosted files.
     port: TCP port on the _host_ machine that the server will listen on. If
         ommitted it will attempt to use 9000, or if unavailable it will find
--- a/media/webrtc/trunk/build/android/pylib/android_commands.py
+++ b/media/webrtc/trunk/build/android/pylib/android_commands.py
@@ -6,71 +6,65 @@
 
 Assumes adb binary is currently on system path.
 """
 
 import collections
 import datetime
 import logging
 import os
-import random
 import re
 import shlex
 import subprocess
 import sys
 import tempfile
 import time
 
-import pexpect
 import io_stats_parser
+from pylib import pexpect
 
-# adb_interface.py is under ../../../third_party/android_testrunner/
-sys.path.append(os.path.join(os.path.abspath(os.path.dirname(__file__)), '..',
-                             '..', '..', 'third_party', 'android_testrunner'))
+CHROME_SRC = os.path.join(
+    os.path.abspath(os.path.dirname(__file__)), '..', '..', '..')
+
+sys.path.append(os.path.join(CHROME_SRC, 'third_party', 'android_testrunner'))
 import adb_interface
+
 import cmd_helper
 import errors  #  is under ../../../third_party/android_testrunner/errors.py
 
 
 # Pattern to search for the next whole line of pexpect output and capture it
 # into a match group. We can't use ^ and $ for line start end with pexpect,
 # see http://www.noah.org/python/pexpect/#doc for explanation why.
 PEXPECT_LINE_RE = re.compile('\n([^\r]*)\r')
 
 # Set the adb shell prompt to be a unique marker that will [hopefully] not
 # appear at the start of any line of a command's output.
 SHELL_PROMPT = '~+~PQ\x17RS~+~'
 
-# This only works for single core devices.
-SCALING_GOVERNOR = '/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor'
-DROP_CACHES = '/proc/sys/vm/drop_caches'
-
 # Java properties file
 LOCAL_PROPERTIES_PATH = '/data/local.prop'
 
 # Property in /data/local.prop that controls Java assertions.
 JAVA_ASSERT_PROPERTY = 'dalvik.vm.enableassertions'
 
-BOOT_COMPLETE_RE = re.compile(
-    'android.intent.action.MEDIA_MOUNTED path: /\w+/sdcard\d?'
-    '|PowerManagerService(\(\s+\d+\))?: bootCompleted')
-
 MEMORY_INFO_RE = re.compile('^(?P<key>\w+):\s+(?P<usage_kb>\d+) kB$')
 NVIDIA_MEMORY_INFO_RE = re.compile('^\s*(?P<user>\S+)\s*(?P<name>\S+)\s*'
                                    '(?P<pid>\d+)\s*(?P<usage_bytes>\d+)$')
 
 # Keycode "enum" suitable for passing to AndroidCommands.SendKey().
 KEYCODE_HOME = 3
 KEYCODE_BACK = 4
 KEYCODE_DPAD_UP = 19
 KEYCODE_DPAD_DOWN = 20
 KEYCODE_DPAD_RIGHT = 22
 KEYCODE_ENTER = 66
 KEYCODE_MENU = 82
 
+MD5SUM_DEVICE_PATH = '/data/local/tmp/md5sum_bin'
 
 def GetEmulators():
   """Returns a list of emulators.  Does not filter by status (e.g. offline).
 
   Both devices starting with 'emulator' will be returned in below output:
 
     * daemon not running. starting it now on port 5037 *
     * daemon started successfully *
@@ -108,52 +102,16 @@ def GetAttachedDevices():
   re_device = re.compile('^([a-zA-Z0-9_:.-]+)\tdevice$', re.MULTILINE)
   devices = re_device.findall(cmd_helper.GetCmdOutput(['adb', 'devices']))
   preferred_device = os.environ.get('ANDROID_SERIAL')
   if preferred_device in devices:
     devices.remove(preferred_device)
     devices.insert(0, preferred_device)
   return devices
 
-
-def _GetHostFileInfo(file_name):
-  """Returns a tuple containing size and modified UTC time for file_name."""
-  # The time accuracy on device is only to minute level, remove the second and
-  # microsecond from host results.
-  utc_time = datetime.datetime.utcfromtimestamp(os.path.getmtime(file_name))
-  time_delta = datetime.timedelta(seconds=utc_time.second,
-                                  microseconds=utc_time.microsecond)
-  return os.path.getsize(file_name), utc_time - time_delta
-
-
-def ListHostPathContents(path):
-  """Lists files in all subdirectories of |path|.
-
-  Args:
-    path: The path to list.
-
-  Returns:
-    A dict of {"name": (size, lastmod), ...}.
-  """
-  if os.path.isfile(path):
-    return {os.path.basename(path): _GetHostFileInfo(path)}
-  ret = {}
-  for root, dirs, files in os.walk(path):
-    for d in dirs:
-      if d.startswith('.'):
-        dirs.remove(d)  # Prune the dir for subsequent iterations.
-    for f in files:
-      if f.startswith('.'):
-        continue
-      full_file_name = os.path.join(root, f)
-      file_name = os.path.relpath(full_file_name, path)
-      ret[file_name] = _GetHostFileInfo(full_file_name)
-  return ret
-
-
 def _GetFilesFromRecursiveLsOutput(path, ls_output, re_file, utc_offset=None):
   """Gets a list of files from `ls` command output.
 
   Python's os.walk isn't used because it doesn't work over adb shell.
 
   Args:
     path: The path to list.
     ls_output: A list of lines returned by an `ls -lR` command.
@@ -196,16 +154,30 @@ def _GetFilesFromRecursiveLsOutput(path,
         utc_delta = datetime.timedelta(hours=int(utc_offset[1:3]),
                                        minutes=int(utc_offset[3:5]))
         if utc_offset[0:1] == '-':
           utc_delta = -utc_delta
         lastmod -= utc_delta
       files[filename] = (int(file_match.group('size')), lastmod)
   return files
 
+def _ComputeFileListHash(md5sum_output):
+  """Returns a list of MD5 strings from the provided md5sum output."""
+  return [line.split('  ')[0] for line in md5sum_output]
+
+def _HasAdbPushSucceeded(command_output):
+  """Returns whether adb push has succeeded from the provided output."""
+  if not command_output:
+    return False
+  # Success looks like this: "3035 KB/s (12512056 bytes in 4.025s)"
+  # Errors look like this: "failed to copy  ... "
+  if not re.search('^[0-9]', command_output.splitlines()[-1]):
+    logging.critical('PUSH FAILED: ' + command_output)
+    return False
+  return True
 
 def GetLogTimestamp(log_line, year):
   """Returns the timestamp of the given |log_line| in the given year."""
   try:
     return datetime.datetime.strptime('%s-%s' % (year, log_line[:18]),
                                       '%Y-%m-%d %H:%M:%S.%f')
   except (ValueError, IndexError):
     logging.critical('Error reading timestamp from ' + log_line)
@@ -220,33 +192,55 @@ class AndroidCommands(object):
         Otherwise commands are sent to all attached devices.
   """
 
   def __init__(self, device=None):
     self._adb = adb_interface.AdbInterface()
     if device:
       self._adb.SetTargetSerial(device)
     self._logcat = None
-    self._original_governor = None
+    self.logcat_process = None
     self._pushed_files = []
     self._device_utc_offset = self.RunShellCommand('date +%z')[0]
+    self._md5sum_path = ''
+    self._external_storage = ''
 
   def Adb(self):
     """Returns our AdbInterface to avoid us wrapping all its methods."""
     return self._adb
 
   def IsRootEnabled(self):
     """Checks if root is enabled on the device."""
     root_test_output = self.RunShellCommand('ls /root') or ['']
     return not 'Permission denied' in root_test_output[0]
 
+  def EnableAdbRoot(self):
+    """Enables adb root on the device.
+
+    Returns:
+      True: if output from executing adb root was as expected.
+      False: otherwise.
+    """
+    return_value = self._adb.EnableAdbRoot()
+    # EnableAdbRoot inserts a call for wait-for-device only when adb logcat
+    # output matches what is expected. Just to be safe add a call to
+    # wait-for-device.
+    self._adb.SendCommand('wait-for-device')
+    return return_value
+
   def GetDeviceYear(self):
     """Returns the year information of the date on device."""
     return self.RunShellCommand('date +%Y')[0]
 
+  def GetExternalStorage(self):
+    if not self._external_storage:
+      self._external_storage = self.RunShellCommand('echo $EXTERNAL_STORAGE')[0]
+      assert self._external_storage, 'Unable to find $EXTERNAL_STORAGE'
+    return self._external_storage
+
   def WaitForDevicePm(self):
     """Blocks until the device's package manager is available.
 
     To workaround http://b/5201039, we restart the shell and retry if the
     package manager isn't back after 120 seconds.
 
     Raises:
       errors.WaitForResponseTimedOutError after max retries reached.
@@ -259,20 +253,16 @@ class AndroidCommands(object):
         return  # Success
       except errors.WaitForResponseTimedOutError as e:
         last_err = e
         logging.warning('Restarting and retrying after timeout: %s', e)
         retries -= 1
         self.RestartShell()
     raise last_err  # Only reached after max retries, re-raise the last error.
 
-  def SynchronizeDateTime(self):
-    """Synchronize date/time between host and device."""
-    self._adb.SendShellCommand('date -u %f' % time.time())
-
   def RestartShell(self):
     """Restarts the shell on the device. Does not block for it to return."""
     self.RunShellCommand('stop')
     self.RunShellCommand('start')
 
   def Reboot(self, full_reboot=True):
     """Reboots the device and waits for the package manager to return.
 
@@ -285,19 +275,20 @@ class AndroidCommands(object):
       logging.warning('Ignoring reboot request as we are on hive')
       return
     if full_reboot or not self.IsRootEnabled():
       self._adb.SendCommand('reboot')
       timeout = 300
     else:
       self.RestartShell()
       timeout = 120
+    # To run tests we need at least the package manager and the sd card (or
+    # other external storage) to be ready.
     self.WaitForDevicePm()
-    self.StartMonitoringLogcat(timeout=timeout)
-    self.WaitForLogMatch(BOOT_COMPLETE_RE, None)
+    self.WaitForSdCardReady(timeout)
 
   def Uninstall(self, package):
     """Uninstalls the specified package from the device.
 
     Args:
       package: Name of the package to remove.
 
     Returns:
@@ -313,17 +304,18 @@ class AndroidCommands(object):
 
     Args:
       package_file_path: Path to .apk file to install.
       reinstall: Reinstall an existing apk, keeping the data.
 
     Returns:
       A status string returned by adb install
     """
-    assert os.path.isfile(package_file_path)
+    assert os.path.isfile(package_file_path), ('<%s> is not file' %
+                                               package_file_path)
 
     install_cmd = ['install']
 
     if reinstall:
       install_cmd.append('-r')
 
     install_cmd.append(package_file_path)
     install_cmd = ' '.join(install_cmd)
@@ -422,18 +414,19 @@ class AndroidCommands(object):
           'sys.boot_completed flag was not set after %s seconds' % wait_time)
 
   def WaitForSdCardReady(self, timeout_time):
     """Wait for the SD card ready before pushing data into it."""
     logging.info('Waiting for SD card ready...')
     sdcard_ready = False
     attempts = 0
     wait_period = 5
+    external_storage = self.GetExternalStorage()
     while not sdcard_ready and attempts * wait_period < timeout_time:
-      output = self.RunShellCommand('ls /sdcard/')
+      output = self.RunShellCommand('ls ' + external_storage)
       if output:
         sdcard_ready = True
       else:
         time.sleep(wait_period)
         attempts += 1
     if not sdcard_ready:
       raise errors.WaitForResponseTimedOutError(
           'SD card not ready after %s seconds' % timeout_time)
@@ -468,23 +461,48 @@ class AndroidCommands(object):
 
   def KillAll(self, process):
     """Android version of killall, connected via adb.
 
     Args:
       process: name of the process to kill off
 
     Returns:
-      the number of processess killed
+      the number of processes killed
     """
     pids = self.ExtractPid(process)
     if pids:
       self.RunShellCommand('kill ' + ' '.join(pids))
     return len(pids)
 
+  def KillAllBlocking(self, process, timeout_sec):
+    """Blocking version of killall, connected via adb.
+
+    This waits until no process matching the corresponding name appears in ps'
+    output anymore.
+
+    Args:
+      process: name of the process to kill off
+      timeout_sec: the timeout in seconds
+
+    Returns:
+      the number of processes killed
+    """
+    processes_killed = self.KillAll(process)
+    if processes_killed:
+      elapsed = 0
+      wait_period = 0.1
+      # Note that this doesn't take into account the time spent in ExtractPid().
+      while self.ExtractPid(process) and elapsed < timeout_sec:
+        time.sleep(wait_period)
+        elapsed += wait_period
+      if elapsed >= timeout_sec:
+        return 0
+    return processes_killed
+
   def StartActivity(self, package, activity, wait_for_completion=False,
                     action='android.intent.action.VIEW',
                     category=None, data=None,
                     extras=None, trace_file_name=None):
     """Starts |package|'s activity on the device.
 
     Args:
       package: Name of package to start (e.g. 'com.google.android.apps.chrome').
@@ -518,16 +536,21 @@ class AndroidCommands(object):
         else:
           raise NotImplementedError(
               'Need to teach StartActivity how to pass %s extras' % type(value))
         cmd += ' %s %s' % (key, value)
     if trace_file_name:
       cmd += ' --start-profiler ' + trace_file_name
     self.RunShellCommand(cmd)
 
+  def GoHome(self):
+    """Tell the device to return to the home screen. Blocks until completion."""
+    self.RunShellCommand('am start -W '
+        '-a android.intent.action.MAIN -c android.intent.category.HOME')
+
   def CloseApplication(self, package):
     """Attempt to close down the application, using increasing violence.
 
     Args:
       package: Name of the process to kill off, e.g.
       com.google.android.apps.chrome
     """
     self.RunShellCommand('am force-stop ' + package)
@@ -547,53 +570,57 @@ class AndroidCommands(object):
       keycode: Numeric keycode to send (see "enum" at top of file).
     """
     self.RunShellCommand('input keyevent %d' % keycode)
 
   def PushIfNeeded(self, local_path, device_path):
     """Pushes |local_path| to |device_path|.
 
     Works for files and directories. This method skips copying any paths in
-    |test_data_paths| that already exist on the device with the same timestamp
-    and size.
+    |test_data_paths| that already exist on the device with the same hash.
 
     All pushed files can be removed by calling RemovePushedFiles().
     """
     assert os.path.exists(local_path), 'Local path not found %s' % local_path
-    self._pushed_files.append(device_path)
 
-    # If the path contents are the same, there's nothing to do.
-    local_contents = ListHostPathContents(local_path)
-    device_contents = self.ListPathContents(device_path)
-    # Only compare the size and timestamp if only copying a file because
-    # the filename on device can be renamed.
-    if os.path.isfile(local_path):
-      assert len(local_contents) == 1
-      is_equal = local_contents.values() == device_contents.values()
-    else:
-      is_equal = local_contents == device_contents
-    if is_equal:
-      logging.info('%s is up-to-date. Skipping file push.', device_path)
+    if not self._md5sum_path:
+      default_build_type = os.environ.get('BUILD_TYPE', 'Debug')
+      md5sum_path = '%s/out/%s/md5sum_bin' % (CHROME_SRC, default_build_type)
+      if not os.path.exists(md5sum_path):
+        md5sum_path = '%s/out/Release/md5sum_bin' % (CHROME_SRC)
+        if not os.path.exists(md5sum_path):
+          print >> sys.stderr, 'Please build md5sum.'
+          sys.exit(1)
+      command = 'push %s %s' % (md5sum_path, MD5SUM_DEVICE_PATH)
+      assert _HasAdbPushSucceeded(self._adb.SendCommand(command))
+      self._md5sum_path = md5sum_path
+
+    self._pushed_files.append(device_path)
+    hashes_on_device = _ComputeFileListHash(
+        self.RunShellCommand(MD5SUM_DEVICE_PATH + ' ' + device_path))
+    assert os.path.exists(local_path), 'Local path not found %s' % local_path
+    hashes_on_host = _ComputeFileListHash(
+        subprocess.Popen(
+            '%s_host %s' % (self._md5sum_path, local_path),
+            stdout=subprocess.PIPE, shell=True).stdout)
+    if hashes_on_device == hashes_on_host:
       return
 
     # They don't match, so remove everything first and then create it.
     if os.path.isdir(local_path):
       self.RunShellCommand('rm -r %s' % device_path, timeout_time=2*60)
       self.RunShellCommand('mkdir -p %s' % device_path)
 
     # NOTE: We can't use adb_interface.Push() because it hardcodes a timeout of
     # 60 seconds which isn't sufficient for a lot of users of this method.
     push_command = 'push %s %s' % (local_path, device_path)
     logging.info('>>> $' + push_command)
     output = self._adb.SendCommand(push_command, timeout_time=30*60)
-    assert output
-    # Success looks like this: "3035 KB/s (12512056 bytes in 4.025s)"
-    # Errors look like this: "failed to copy  ... "
-    if not re.search('^[0-9]', output.splitlines()[-1]):
-      logging.critical('PUSH FAILED: ' + output)
+    assert _HasAdbPushSucceeded(output)
+
 
   def GetFileContents(self, filename, log_result=False):
     """Gets contents from the file specified by |filename|."""
     return self.RunShellCommand('if [ -f "' + filename + '" ]; then cat "' +
                                 filename + '"; fi', log_result=log_result)
 
   def SetFileContents(self, filename, contents):
     """Writes |contents| to the file specified by |filename|."""
@@ -625,31 +652,16 @@ class AndroidCommands(object):
                          '(?P<size>[^\s]+)\s+'
                          '(?P<date>[^\s]+)\s+'
                          '(?P<time>[^\s]+)\s+'
                          '(?P<filename>[^\s]+)$')
     return _GetFilesFromRecursiveLsOutput(
         path, self.RunShellCommand('ls -lR %s' % path), re_file,
         self._device_utc_offset)
 
-  def SetupPerformanceTest(self):
-    """Sets up performance tests."""
-    # Disable CPU scaling to reduce noise in tests
-    if not self._original_governor:
-      self._original_governor = self.GetFileContents(
-          SCALING_GOVERNOR, log_result=False)
-      self.RunShellCommand('echo performance > ' + SCALING_GOVERNOR)
-    self.DropRamCaches()
-
-  def TearDownPerformanceTest(self):
-    """Tears down performance tests."""
-    if self._original_governor:
-      self.RunShellCommand('echo %s > %s' % (self._original_governor[0],
-                                             SCALING_GOVERNOR))
-    self._original_governor = None
 
   def SetJavaAssertsEnabled(self, enable):
     """Sets or removes the device java assertions property.
 
     Args:
       enable: If True the property will be set.
 
     Returns:
@@ -677,19 +689,27 @@ class AndroidCommands(object):
     was_set = 'all' in self.RunShellCommand('getprop ' + JAVA_ASSERT_PROPERTY)
     if was_set == enable:
       return False
 
     self.RunShellCommand('setprop %s "%s"' % (JAVA_ASSERT_PROPERTY,
                                               enable and 'all' or ''))
     return True
 
-  def DropRamCaches(self):
-    """Drops the filesystem ram caches for performance testing."""
-    self.RunShellCommand('echo 3 > ' + DROP_CACHES)
+  def GetBuildId(self):
+    """Returns the build ID of the system (e.g. JRM79C)."""
+    build_id = self.RunShellCommand('getprop ro.build.id')[0]
+    assert build_id
+    return build_id
+
+  def GetBuildType(self):
+    """Returns the build type of the system (e.g. eng)."""
+    build_type = self.RunShellCommand('getprop ro.build.type')[0]
+    assert build_type
+    return build_type
 
   def StartMonitoringLogcat(self, clear=True, timeout=10, logfile=None,
                             filters=None):
     """Starts monitoring the output of logcat, for use with WaitForLogMatch.
 
     Args:
       clear: If True the existing logcat output will be cleared, to avoiding
              matching historical output lurking in the log.
@@ -702,16 +722,19 @@ class AndroidCommands(object):
     if self._adb._target_arg:
       args += shlex.split(self._adb._target_arg)
     args += ['logcat', '-v', 'threadtime']
     if filters:
       args.extend(filters)
     else:
       args.append('*:v')
 
+    if logfile:
+      logfile = NewLineNormalizer(logfile)
+
     # Spawn logcat and syncronize with it.
     for _ in range(4):
       self._logcat = pexpect.spawn('adb', args, timeout=timeout,
                                    logfile=logfile)
       self.RunShellCommand('log startup_sync')
       if self._logcat.expect(['startup_sync', pexpect.EOF,
                               pexpect.TIMEOUT]) == 0:
         break
@@ -738,41 +761,54 @@ class AndroidCommands(object):
 
     Raises:
       pexpect.TIMEOUT upon the timeout specified by StartMonitoringLogcat().
 
     Returns:
       The re match object if |success_re| is matched first or None if |error_re|
       is matched first.
     """
-    if not self._logcat:
-      self.StartMonitoringLogcat(clear)
     logging.info('<<< Waiting for logcat:' + str(success_re.pattern))
     t0 = time.time()
-    try:
-      while True:
-        # Note this will block for upto the timeout _per log line_, so we need
-        # to calculate the overall timeout remaining since t0.
-        time_remaining = t0 + self._logcat.timeout - time.time()
-        if time_remaining < 0: raise pexpect.TIMEOUT(self._logcat)
-        self._logcat.expect(PEXPECT_LINE_RE, timeout=time_remaining)
-        line = self._logcat.match.group(1)
-        if error_re:
-          error_match = error_re.search(line)
-          if error_match:
-            return None
-        success_match = success_re.search(line)
-        if success_match:
-          return success_match
-        logging.info('<<< Skipped Logcat Line:' + str(line))
-    except pexpect.TIMEOUT:
-      raise pexpect.TIMEOUT(
-          'Timeout (%ds) exceeded waiting for pattern "%s" (tip: use -vv '
-          'to debug)' %
-          (self._logcat.timeout, success_re.pattern))
+    while True:
+      if not self._logcat:
+        self.StartMonitoringLogcat(clear)
+      try:
+        while True:
+          # Note this will block for upto the timeout _per log line_, so we need
+          # to calculate the overall timeout remaining since t0.
+          time_remaining = t0 + self._logcat.timeout - time.time()
+          if time_remaining < 0: raise pexpect.TIMEOUT(self._logcat)
+          self._logcat.expect(PEXPECT_LINE_RE, timeout=time_remaining)
+          line = self._logcat.match.group(1)
+          if error_re:
+            error_match = error_re.search(line)
+            if error_match:
+              return None
+          success_match = success_re.search(line)
+          if success_match:
+            return success_match
+          logging.info('<<< Skipped Logcat Line:' + str(line))
+      except pexpect.TIMEOUT:
+        raise pexpect.TIMEOUT(
+            'Timeout (%ds) exceeded waiting for pattern "%s" (tip: use -vv '
+            'to debug)' %
+            (self._logcat.timeout, success_re.pattern))
+      except pexpect.EOF:
+        # It seems that sometimes logcat can end unexpectedly. This seems
+        # to happen during Chrome startup after a reboot followed by a cache
+        # clean. I don't understand why this happens, but this code deals with
+        # getting EOF in logcat.
+        logging.critical('Found EOF in adb logcat. Restarting...')
+        # Rerun spawn with original arguments. Note that self._logcat.args[0] is
+        # the path of adb, so we don't want it in the arguments.
+        self._logcat = pexpect.spawn('adb',
+                                     self._logcat.args[1:],
+                                     timeout=self._logcat.timeout,
+                                     logfile=self._logcat.logfile)
 
   def StartRecordingLogcat(self, clear=True, filters=['*:v']):
     """Starts recording logcat output to eventually be saved as a string.
 
     This call should come before some series of tests are run, with either
     StopRecordingLogcat or SearchLogcatRecord following the tests.
 
     Args:
@@ -989,39 +1025,47 @@ class AndroidCommands(object):
           # Column 1 is the pid
           # Column 8 is the Inode in use
           if process_results[8] == socket_name:
             pids.append((int(process_results[1]), process_results[0]))
         break
     logging.info('PidsUsingDevicePort: %s', pids)
     return pids
 
-  def RunMonkey(self, package_name, category=None, throttle=100, seed=None,
-                event_count=10000, verbosity=1, extra_args=''):
-    """Runs monkey test for a given package.
+  def FileExistsOnDevice(self, file_name):
+    """Checks whether the given file exists on the device.
 
     Args:
-      package_name: Allowed package.
-      category: A list of allowed categories.
-      throttle: Delay between events (ms).
-      seed: Seed value for pseduo-random generator. Same seed value
-        generates the same sequence of events. Seed is randomized by
-        default.
-      event_count: Number of events to generate.
-      verbosity: Verbosity level [0-3].
-      extra_args: A string of other args to pass to the command verbatim.
+      file_name: Full path of file to check.
 
     Returns:
-      Output of the test run.
+      True if the file exists, False otherwise.
     """
-    category = category or []
-    seed = seed or random.randint(1, 100)
+    assert '"' not in file_name, 'file_name cannot contain double quotes'
+    status = self._adb.SendShellCommand(
+        '\'test -e "%s"; echo $?\'' % (file_name))
+    if 'test: not found' not in status:
+      return int(status) == 0
+
+    status = self._adb.SendShellCommand(
+        '\'ls "%s" >/dev/null 2>&1; echo $?\'' % (file_name))
+    return int(status) == 0
+
+
+class NewLineNormalizer(object):
+  """A file-like object to normalize EOLs to '\n'.
 
-    cmd = ['monkey',
-           '-p %s' % package_name,
-           ' '.join(['-c %s' % c for c in category]),
-           '--throttle %d' % throttle,
-           '-s %d' % seed,
-           '-v ' * verbosity,
-           extra_args,
-           '%s' % event_count]
-    return self.RunShellCommand(' '.join(cmd),
-                                timeout_time=event_count*throttle*1.5)
+  Pexpect runs adb within a pseudo-tty device (see
+  http://www.noah.org/wiki/pexpect), so any '\n' printed by adb is written
+  as '\r\n' to the logfile. Since adb already uses '\r\n' to terminate
+  lines, the log ends up having '\r\r\n' at the end of each line. This
+  filter replaces the above with a single '\n' in the data stream.
+  """
+  def __init__(self, output):
+    self._output = output
+
+  def write(self, data):
+    data = data.replace('\r\r\n', '\n')
+    self._output.write(data)
+
+  def flush(self):
+    self._output.flush()
+
--- a/media/webrtc/trunk/build/android/pylib/base_test_runner.py
+++ b/media/webrtc/trunk/build/android/pylib/base_test_runner.py
@@ -5,28 +5,29 @@
 import contextlib
 import httplib
 import logging
 import os
 import tempfile
 import time
 
 import android_commands
+import constants
 from chrome_test_server_spawner import SpawningServer
 import constants
 from flag_changer import FlagChanger
 from forwarder import Forwarder
 import lighttpd_server
 import ports
 from valgrind_tools import CreateTool
 
 
 # A file on device to store ports of net test server. The format of the file is
 # test-spawner-server-port:test-server-port
-NET_TEST_SERVER_PORT_INFO_FILE = '/data/local/tmp/net-test-server-ports'
+NET_TEST_SERVER_PORT_INFO_FILE = 'net-test-server-ports'
 
 
 class BaseTestRunner(object):
   """Base class for running tests on a single device.
 
   A subclass should implement RunTests() with no parameter, so that calling
   the Run() method will set up tests, run them and tear them down.
   """
@@ -36,21 +37,16 @@ class BaseTestRunner(object):
       Args:
         device: Tests will run on the device of this ID.
         shard_index: Index number of the shard on which the test suite will run.
         build_type: 'Release' or 'Debug'.
     """
     self.device = device
     self.adb = android_commands.AndroidCommands(device=device)
     self.tool = CreateTool(tool, self.adb)
-    # Synchronize date/time between host and device. Otherwise same file on
-    # host and device may have different timestamp which may cause
-    # AndroidCommands.PushIfNeeded failed, or a test which may compare timestamp
-    # got from http head and local time could be failed.
-    self.adb.SynchronizeDateTime()
     self._http_server = None
     self._forwarder = None
     self._forwarder_device_port = 8000
     self.forwarder_base_url = ('http://localhost:%d' %
         self._forwarder_device_port)
     self.flags = FlagChanger(self.adb)
     self.shard_index = shard_index
     self.flags.AddFlags(['--disable-fre'])
@@ -60,17 +56,18 @@ class BaseTestRunner(object):
     # LaunchChromeTestServerSpawner and allocate port for test server when
     # starting it in TestServerThread.
     self.test_server_spawner_port = 0
     self.test_server_port = 0
     self.build_type = build_type
 
   def _PushTestServerPortInfoToDevice(self):
     """Pushes the latest port information to device."""
-    self.adb.SetFileContents(NET_TEST_SERVER_PORT_INFO_FILE,
+    self.adb.SetFileContents(self.adb.GetExternalStorage() + '/' +
+                             NET_TEST_SERVER_PORT_INFO_FILE,
                              '%d:%d' % (self.test_server_spawner_port,
                                         self.test_server_port))
 
   def Run(self):
     """Calls subclass functions to set up tests, run them and tear them down.
 
     Returns:
       Test results returned from RunTests().
@@ -108,39 +105,16 @@ class BaseTestRunner(object):
           |CHROME_DIR|.
       dest_dir: Absolute path to copy to on the device.
     """
     for p in test_data_paths:
       self.adb.PushIfNeeded(
           os.path.join(constants.CHROME_DIR, p),
           os.path.join(dest_dir, p))
 
-  def LinkSdCardPathsToTempDir(self, paths):
-    """Link |paths| which are under sdcard to /data/local/tmp.
-
-    For example, the test data '/sdcard/my_data' will be linked to
-    '/data/local/tmp/my_data'.
-
-    Args:
-      paths: A list of files and directories relative to /sdcard.
-    """
-    links = set()
-    for path in paths:
-      link_name = os.path.dirname(path)
-      assert link_name, 'Linked paths must be in a subdir of /sdcard/.'
-      link_name = link_name.split('/')[0]
-      if link_name not in links:
-        mapped_device_path = '/data/local/tmp/' + link_name
-        # Unlink the mapped_device_path at first in case it was mapped to
-        # a wrong path. Add option '-r' becuase the old path could be a dir.
-        self.adb.RunShellCommand('rm -r %s' %  mapped_device_path)
-        self.adb.RunShellCommand(
-            'ln -s /sdcard/%s %s' % (link_name, mapped_device_path))
-        links.add(link_name)
-
   def LaunchTestHttpServer(self, document_root, port=None,
                            extra_config_contents=None):
     """Launches an HTTP server to serve HTTP tests.
 
     Args:
       document_root: Document root of the HTTP server.
       port: port on which we want to the http server bind.
       extra_config_contents: Extra config contents for the HTTP server.
@@ -148,27 +122,24 @@ class BaseTestRunner(object):
     self._http_server = lighttpd_server.LighttpdServer(
         document_root, port=port, extra_config_contents=extra_config_contents)
     if self._http_server.StartupHttpServer():
       logging.info('http server started: http://localhost:%s',
                    self._http_server.port)
     else:
       logging.critical('Failed to start http server')
     self.StartForwarderForHttpServer()
+    return (self._forwarder_device_port, self._http_server.port)
 
   def StartForwarder(self, port_pairs):
     """Starts TCP traffic forwarding for the given |port_pairs|.
 
     Args:
       host_port_pairs: A list of (device_port, local_port) tuples to forward.
     """
-    # Sometimes the forwarder device port may be already used. We have to kill
-    # all forwarder processes to ensure that the forwarder can be started since
-    # currently we can not associate the specified port to related pid.
-    self.adb.KillAll('forwarder')
     if self._forwarder:
       self._forwarder.Close()
     self._forwarder = Forwarder(
         self.adb, port_pairs, self.tool, '127.0.0.1', self.build_type)
 
   def StartForwarderForHttpServer(self):
     """Starts a forwarder for the HTTP server.
 
@@ -189,17 +160,17 @@ class BaseTestRunner(object):
   def ShutdownHelperToolsForTestSuite(self):
     """Shuts down the server and the forwarder."""
     # Forwarders should be killed before the actual servers they're forwarding
     # to as they are clients potentially with open connections and to allow for
     # proper hand-shake/shutdown.
     if self._forwarder or self._spawner_forwarder:
       # Kill all forwarders on the device and then kill the process on the host
       # (if it exists)
-      self.adb.KillAll('forwarder')
+      self.adb.KillAll('device_forwarder')
       if self._forwarder:
         self._forwarder.Close()
       if self._spawner_forwarder:
         self._spawner_forwarder.Close()
     if self._http_server:
       self._http_server.ShutdownHttpServer()
     if self._spawning_server:
       self._spawning_server.Stop()
@@ -210,17 +181,19 @@ class BaseTestRunner(object):
     server_ready = False
     error_msgs = []
     # Try 3 times to launch test spawner server.
     for i in xrange(0, 3):
       # Do not allocate port for test server here. We will allocate
       # different port for individual test in TestServerThread.
       self.test_server_spawner_port = ports.AllocateTestServerPort()
       self._spawning_server = SpawningServer(self.test_server_spawner_port,
-                                             self.test_server_port)
+                                             self.adb,
+                                             self.tool,
+                                             self.build_type)
       self._spawning_server.Start()
       server_ready, error_msg = ports.IsHttpServerConnectable(
           '127.0.0.1', self.test_server_spawner_port, path='/ping',
           expected_read='ready')
       if server_ready:
         break
       else:
         error_msgs.append(error_msg)
--- a/media/webrtc/trunk/build/android/pylib/base_test_sharder.py
+++ b/media/webrtc/trunk/build/android/pylib/base_test_sharder.py
@@ -11,18 +11,21 @@ from test_result import TestResults
 
 def _ShardedTestRunnable(test):
   """Standalone function needed by multiprocessing.Pool."""
   log_format = '[' + test.device + '] # %(asctime)-15s: %(message)s'
   if logging.getLogger().handlers:
     logging.getLogger().handlers[0].setFormatter(logging.Formatter(log_format))
   else:
     logging.basicConfig(format=log_format)
-  return test.Run()
-
+  # Handle SystemExit here since python has a bug to exit current process
+  try:
+    return test.Run()
+  except SystemExit:
+    return TestResults()
 
 def SetTestsContainer(tests_container):
   """Sets tests container.
 
   multiprocessing.Queue can't be pickled across processes, so we need to set
   this as a 'global', per process, via multiprocessing.Pool.
   """
   BaseTestSharder.tests_container = tests_container
@@ -84,17 +87,20 @@ class BaseTestSharder(object):
         logging.warning('Creating shard %d for %s', index, device)
         logging.warning('*' * 80)
         test_runner = self.CreateShardedTestRunner(device, index)
         test_runners += [test_runner]
       logging.warning('Starting...')
       pool = multiprocessing.Pool(len(self.attached_devices),
                                   SetTestsContainer,
                                   [BaseTestSharder.tests_container])
-      results_lists = pool.map(_ShardedTestRunnable, test_runners)
+      # map can't handle KeyboardInterrupt exception. It's a python bug.
+      # So use map_async instead.
+      async_results = pool.map_async(_ShardedTestRunnable, test_runners)
+      results_lists = async_results.get(999999)
       test_results = TestResults.FromTestResults(results_lists)
       if retry == self.retries - 1:
         all_passed = final_results.ok + test_results.ok
         final_results = test_results
         final_results.ok = all_passed
         break
       else:
         final_results.ok += test_results.ok
--- a/media/webrtc/trunk/build/android/pylib/buildbot_report.py
+++ b/media/webrtc/trunk/build/android/pylib/buildbot_report.py
@@ -18,16 +18,25 @@ def PrintMsg(msg):
   """Appends |msg| to the current buildbot step text.
 
   Args:
     msg: String to be appended.
   """
   print '@@@STEP_TEXT@%s@@@' % msg
 
 
+def PrintSummaryText(msg):
+  """Appends |msg| to main build summary. Visible from waterfall.
+
+  Args:
+    msg: String to be appended.
+  """
+  print '@@@STEP_SUMMARY_TEXT@%s@@@' % msg
+
+
 def PrintError():
   """Marks the current step as failed."""
   print '@@@STEP_FAILURE@@@'
 
 
 def PrintWarning():
   """Marks the current step with a warning."""
   print '@@@STEP_WARNINGS@@@'
--- a/media/webrtc/trunk/build/android/pylib/chrome_test_server_spawner.py
+++ b/media/webrtc/trunk/build/android/pylib/chrome_test_server_spawner.py
@@ -4,111 +4,399 @@
 
 """A "Test Server Spawner" that handles killing/stopping per-test test servers.
 
 It's used to accept requests from the device to spawn and kill instances of the
 chrome test server on the host.
 """
 
 import BaseHTTPServer
+import json
 import logging
 import os
-import sys
+import select
+import struct
+import subprocess
 import threading
 import time
 import urlparse
 
-# Path that are needed to import testserver
-cr_src = os.path.join(os.path.abspath(os.path.dirname(__file__)),
-                      '..', '..', '..')
-sys.path.append(os.path.join(cr_src, 'third_party'))
-sys.path.append(os.path.join(cr_src, 'third_party', 'tlslite'))
-sys.path.append(os.path.join(cr_src, 'third_party', 'pyftpdlib', 'src'))
-sys.path.append(os.path.join(cr_src, 'net', 'tools', 'testserver'))
-import testserver
+import constants
+from forwarder import Forwarder
+import ports
+
+
+# Path that are needed to import necessary modules when running testserver.py.
+os.environ['PYTHONPATH'] = os.environ.get('PYTHONPATH', '') + ':%s:%s:%s:%s' % (
+    os.path.join(constants.CHROME_DIR, 'third_party'),
+    os.path.join(constants.CHROME_DIR, 'third_party', 'tlslite'),
+    os.path.join(constants.CHROME_DIR, 'third_party', 'pyftpdlib', 'src'),
+    os.path.join(constants.CHROME_DIR, 'net', 'tools', 'testserver'))
+
+
+SERVER_TYPES = {
+    'http': '',
+    'ftp': '-f',
+    'sync': '--sync',
+    'tcpecho': '--tcp-echo',
+    'udpecho': '--udp-echo',
+}
+
+
+# The timeout (in seconds) of starting up the Python test server.
+TEST_SERVER_STARTUP_TIMEOUT = 10
+
+
+def _CheckPortStatus(port, expected_status):
+  """Returns True if port has expected_status.
+
+  Args:
+    port: the port number.
+    expected_status: boolean of expected status.
+
+  Returns:
+    Returns True if the status is expected. Otherwise returns False.
+  """
+  for timeout in range(1, 5):
+    if ports.IsHostPortUsed(port) == expected_status:
+      return True
+    time.sleep(timeout)
+  return False
+
+
+def _GetServerTypeCommandLine(server_type):
+  """Returns the command-line by the given server type.
+
+  Args:
+    server_type: the server type to be used (e.g. 'http').
+
+  Returns:
+    A string containing the command-line argument.
+  """
+  if server_type not in SERVER_TYPES:
+    raise NotImplementedError('Unknown server type: %s' % server_type)
+  if server_type == 'udpecho':
+    raise Exception('Please do not run UDP echo tests because we do not have '
+                    'a UDP forwarder tool.')
+  return SERVER_TYPES[server_type]
+
+
+class TestServerThread(threading.Thread):
+  """A thread to run the test server in a separate process."""
+
+  def __init__(self, ready_event, arguments, adb, tool, build_type):
+    """Initialize TestServerThread with the following argument.
+
+    Args:
+      ready_event: event which will be set when the test server is ready.
+      arguments: dictionary of arguments to run the test server.
+      adb: instance of AndroidCommands.
+      tool: instance of runtime error detection tool.
+      build_type: 'Release' or 'Debug'.
+    """
+    threading.Thread.__init__(self)
+    self.wait_event = threading.Event()
+    self.stop_flag = False
+    self.ready_event = ready_event
+    self.ready_event.clear()
+    self.arguments = arguments
+    self.adb = adb
+    self.tool = tool
+    self.test_server_process = None
+    self.is_ready = False
+    self.host_port = self.arguments['port']
+    assert isinstance(self.host_port, int)
+    self._test_server_forwarder = None
+    # The forwarder device port now is dynamically allocated.
+    self.forwarder_device_port = 0
+    # Anonymous pipe in order to get port info from test server.
+    self.pipe_in = None
+    self.pipe_out = None
+    self.command_line = []
+    self.build_type = build_type
+
+  def _WaitToStartAndGetPortFromTestServer(self):
+    """Waits for the Python test server to start and gets the port it is using.
+
+    The port information is passed by the Python test server with a pipe given
+    by self.pipe_out. It is written as a result to |self.host_port|.
 
-_test_servers = []
+    Returns:
+      Whether the port used by the test server was successfully fetched.
+    """
+    assert self.host_port == 0 and self.pipe_out and self.pipe_in
+    (in_fds, _, _) = select.select([self.pipe_in, ], [], [],
+                                   TEST_SERVER_STARTUP_TIMEOUT)
+    if len(in_fds) == 0:
+      logging.error('Failed to wait to the Python test server to be started.')
+      return False
+    # First read the data length as an unsigned 4-byte value.  This
+    # is _not_ using network byte ordering since the Python test server packs
+    # size as native byte order and all Chromium platforms so far are
+    # configured to use little-endian.
+    # TODO(jnd): Change the Python test server and local_test_server_*.cc to
+    # use a unified byte order (either big-endian or little-endian).
+    data_length = os.read(self.pipe_in, struct.calcsize('=L'))
+    if data_length:
+      (data_length,) = struct.unpack('=L', data_length)
+      assert data_length
+    if not data_length:
+      logging.error('Failed to get length of server data.')
+      return False
+    port_json = os.read(self.pipe_in, data_length)
+    if not port_json:
+      logging.error('Failed to get server data.')
+      return False
+    logging.info('Got port json data: %s', port_json)
+    port_json = json.loads(port_json)
+    if port_json.has_key('port') and isinstance(port_json['port'], int):
+      self.host_port = port_json['port']
+      return _CheckPortStatus(self.host_port, True)
+    logging.error('Failed to get port information from the server data.')
+    return False
+
+  def _GenerateCommandLineArguments(self):
+    """Generates the command line to run the test server.
+
+    Note that all options are processed by following the definitions in
+    testserver.py.
+    """
+    if self.command_line:
+      return
+    # The following arguments must exist.
+    type_cmd = _GetServerTypeCommandLine(self.arguments['server-type'])
+    if type_cmd:
+      self.command_line.append(type_cmd)
+    self.command_line.append('--port=%d' % self.host_port)
+    # Use a pipe to get the port given by the instance of Python test server
+    # if the test does not specify the port.
+    if self.host_port == 0:
+      (self.pipe_in, self.pipe_out) = os.pipe()
+      self.command_line.append('--startup-pipe=%d' % self.pipe_out)
+    self.command_line.append('--host=%s' % self.arguments['host'])
+    data_dir = self.arguments['data-dir'] or 'chrome/test/data'
+    if not os.path.isabs(data_dir):
+      data_dir = os.path.join(constants.CHROME_DIR, data_dir)
+    self.command_line.append('--data-dir=%s' % data_dir)
+    # The following arguments are optional depending on the individual test.
+    if self.arguments.has_key('log-to-console'):
+      self.command_line.append('--log-to-console')
+    if self.arguments.has_key('auth-token'):
+      self.command_line.append('--auth-token=%s' % self.arguments['auth-token'])
+    if self.arguments.has_key('https'):
+      self.command_line.append('--https')
+      if self.arguments.has_key('cert-and-key-file'):
+        self.command_line.append('--cert-and-key-file=%s' % os.path.join(
+            constants.CHROME_DIR, self.arguments['cert-and-key-file']))
+      if self.arguments.has_key('ocsp'):
+        self.command_line.append('--ocsp=%s' % self.arguments['ocsp'])
+      if self.arguments.has_key('https-record-resume'):
+        self.command_line.append('--https-record-resume')
+      if self.arguments.has_key('ssl-client-auth'):
+        self.command_line.append('--ssl-client-auth')
+      if self.arguments.has_key('tls-intolerant'):
+        self.command_line.append('--tls-intolerant=%s' %
+                                 self.arguments['tls-intolerant'])
+      if self.arguments.has_key('ssl-client-ca'):
+        for ca in self.arguments['ssl-client-ca']:
+          self.command_line.append('--ssl-client-ca=%s' %
+                                   os.path.join(constants.CHROME_DIR, ca))
+      if self.arguments.has_key('ssl-bulk-cipher'):
+        for bulk_cipher in self.arguments['ssl-bulk-cipher']:
+          self.command_line.append('--ssl-bulk-cipher=%s' % bulk_cipher)
+
+  def run(self):
+    logging.info('Start running the thread!')
+    self.wait_event.clear()
+    self._GenerateCommandLineArguments()
+    command = [os.path.join(constants.CHROME_DIR, 'net', 'tools',
+                            'testserver', 'testserver.py')] + self.command_line
+    logging.info('Running: %s', command)
+    self.process = subprocess.Popen(command)
+    if self.process:
+      if self.pipe_out:
+        self.is_ready = self._WaitToStartAndGetPortFromTestServer()
+      else:
+        self.is_ready = _CheckPortStatus(self.host_port, True)
+    if self.is_ready:
+      self._test_server_forwarder = Forwarder(
+          self.adb, [(0, self.host_port)], self.tool, '127.0.0.1',
+          self.build_type)
+      # Check whether the forwarder is ready on the device.
+      self.is_ready = False
+      device_port = self._test_server_forwarder.DevicePortForHostPort(
+          self.host_port)
+      if device_port:
+        for timeout in range(1, 5):
+          if ports.IsDevicePortUsed(self.adb, device_port, 'LISTEN'):
+            self.is_ready = True
+            self.forwarder_device_port = device_port
+            break
+          time.sleep(timeout)
+    # Wake up the request handler thread.
+    self.ready_event.set()
+    # Keep thread running until Stop() gets called.
+    while not self.stop_flag:
+      time.sleep(1)
+    if self.process.poll() is None:
+      self.process.kill()
+    if self._test_server_forwarder:
+      self._test_server_forwarder.Close()
+    self.process = None
+    self.is_ready = False
+    if self.pipe_out:
+      os.close(self.pipe_in)
+      os.close(self.pipe_out)
+      self.pipe_in = None
+      self.pipe_out = None
+    logging.info('Test-server has died.')
+    self.wait_event.set()
+
+  def Stop(self):
+    """Blocks until the loop has finished.
+
+    Note that this must be called in another thread.
+    """
+    if not self.process:
+      return
+    self.stop_flag = True
+    self.wait_event.wait()
+
 
 class SpawningServerRequestHandler(BaseHTTPServer.BaseHTTPRequestHandler):
-  """A handler used to process http GET request.
-  """
+  """A handler used to process http GET/POST request."""
+
+  def _SendResponse(self, response_code, response_reason, additional_headers,
+                    contents):
+    """Generates a response sent to the client from the provided parameters.
 
-  def GetServerType(self, server_type):
-    """Returns the server type to use when starting the test server.
+    Args:
+      response_code: number of the response status.
+      response_reason: string of reason description of the response.
+      additional_headers: dict of additional headers. Each key is the name of
+                          the header, each value is the content of the header.
+      contents: string of the contents we want to send to client.
+    """
+    self.send_response(response_code, response_reason)
+    self.send_header('Content-Type', 'text/html')
+    # Specify the content-length as without it the http(s) response will not
+    # be completed properly (and the browser keeps expecting data).
+    self.send_header('Content-Length', len(contents))
+    for header_name in additional_headers:
+      self.send_header(header_name, additional_headers[header_name])
+    self.end_headers()
+    self.wfile.write(contents)
+    self.wfile.flush()
 
-    This function translate the command-line argument into the appropriate
-    numerical constant.
-    # TODO(yfriedman): Do that translation!
-    """
-    if server_type:
-      pass
-    return 0
+  def _StartTestServer(self):
+    """Starts the test server thread."""
+    logging.info('Handling request to spawn a test server.')
+    content_type = self.headers.getheader('content-type')
+    if content_type != 'application/json':
+      raise Exception('Bad content-type for start request.')
+    content_length = self.headers.getheader('content-length')
+    if not content_length:
+      content_length = 0
+    try:
+      content_length = int(content_length)
+    except:
+      raise Exception('Bad content-length for start request.')
+    logging.info(content_length)
+    test_server_argument_json = self.rfile.read(content_length)
+    logging.info(test_server_argument_json)
+    assert not self.server.test_server_instance
+    ready_event = threading.Event()
+    self.server.test_server_instance = TestServerThread(
+        ready_event,
+        json.loads(test_server_argument_json),
+        self.server.adb,
+        self.server.tool,
+        self.server.build_type)
+    self.server.test_server_instance.setDaemon(True)
+    self.server.test_server_instance.start()
+    ready_event.wait()
+    if self.server.test_server_instance.is_ready:
+      self._SendResponse(200, 'OK', {}, json.dumps(
+          {'port': self.server.test_server_instance.forwarder_device_port,
+           'message': 'started'}))
+      logging.info('Test server is running on port: %d.',
+                   self.server.test_server_instance.host_port)
+    else:
+      self.server.test_server_instance.Stop()
+      self.server.test_server_instance = None
+      self._SendResponse(500, 'Test Server Error.', {}, '')
+      logging.info('Encounter problem during starting a test server.')
+
+  def _KillTestServer(self):
+    """Stops the test server instance."""
+    # There should only ever be one test server at a time. This may do the
+    # wrong thing if we try and start multiple test servers.
+    if not self.server.test_server_instance:
+      return
+    port = self.server.test_server_instance.host_port
+    logging.info('Handling request to kill a test server on port: %d.', port)
+    self.server.test_server_instance.Stop()
+    # Make sure the status of test server is correct before sending response.
+    if _CheckPortStatus(port, False):
+      self._SendResponse(200, 'OK', {}, 'killed')
+      logging.info('Test server on port %d is killed', port)
+    else:
+      self._SendResponse(500, 'Test Server Error.', {}, '')
+      logging.info('Encounter problem during killing a test server.')
+    self.server.test_server_instance = None
+
+  def do_POST(self):
+    parsed_path = urlparse.urlparse(self.path)
+    action = parsed_path.path
+    logging.info('Action for POST method is: %s.', action)
+    if action == '/start':
+      self._StartTestServer()
+    else:
+      self._SendResponse(400, 'Unknown request.', {}, '')
+      logging.info('Encounter unknown request: %s.', action)
 
   def do_GET(self):
     parsed_path = urlparse.urlparse(self.path)
     action = parsed_path.path
     params = urlparse.parse_qs(parsed_path.query, keep_blank_values=1)
-    logging.info('Action is: %s' % action)
-    if action == '/killserver':
-      # There should only ever be one test server at a time. This may do the
-      # wrong thing if we try and start multiple test servers.
-      _test_servers.pop().Stop()
-    elif action == '/start':
-      logging.info('Handling request to spawn a test webserver')
-      for param in params:
-        logging.info('%s=%s' % (param, params[param][0]))
-      s_type = 0
-      doc_root = None
-      if 'server_type' in params:
-        s_type = self.GetServerType(params['server_type'][0])
-      if 'doc_root' in params:
-        doc_root = params['doc_root'][0]
-      self.webserver_thread = threading.Thread(
-          target=self.SpawnTestWebServer, args=(s_type, doc_root))
-      self.webserver_thread.setDaemon(True)
-      self.webserver_thread.start()
-    self.send_response(200, 'OK')
-    self.send_header('Content-type', 'text/html')
-    self.end_headers()
-    self.wfile.write('<html><head><title>started</title></head></html>')
-    logging.info('Returned OK!!!')
-
-  def SpawnTestWebServer(self, s_type, doc_root):
-    class Options(object):
-      log_to_console = True
-      server_type = s_type
-      port = self.server.test_server_port
-      data_dir = doc_root or 'chrome/test/data'
-      file_root_url = '/files/'
-      cert = False
-      policy_keys = None
-      policy_user = None
-      startup_pipe = None
-    options = Options()
-    logging.info('Listening on %d, type %d, data_dir %s' % (options.port,
-        options.server_type, options.data_dir))
-    testserver.main(options, None, server_list=_test_servers)
-    logging.info('Test-server has died.')
+    logging.info('Action for GET method is: %s.', action)
+    for param in params:
+      logging.info('%s=%s', param, params[param][0])
+    if action == '/kill':
+      self._KillTestServer()
+    elif action == '/ping':
+      # The ping handler is used to check whether the spawner server is ready
+      # to serve the requests. We don't need to test the status of the test
+      # server when handling ping request.
+      self._SendResponse(200, 'OK', {}, 'ready')
+      logging.info('Handled ping request and sent response.')
+    else:
+      self._SendResponse(400, 'Unknown request', {}, '')
+      logging.info('Encounter unknown request: %s.', action)
 
 
 class SpawningServer(object):
-  """The class used to start/stop a http server.
-  """
+  """The class used to start/stop a http server."""
 
-  def __init__(self, test_server_spawner_port, test_server_port):
-    logging.info('Creating new spawner %d', test_server_spawner_port)
-    self.server = testserver.StoppableHTTPServer(('', test_server_spawner_port),
-                                                 SpawningServerRequestHandler)
+  def __init__(self, test_server_spawner_port, adb, tool, build_type):
+    logging.info('Creating new spawner on port: %d.', test_server_spawner_port)
+    self.server = BaseHTTPServer.HTTPServer(('', test_server_spawner_port),
+                                            SpawningServerRequestHandler)
     self.port = test_server_spawner_port
-    self.server.test_server_port = test_server_port
+    self.server.adb = adb
+    self.server.tool = tool
+    self.server.test_server_instance = None
+    self.server.build_type = build_type
 
-  def Listen(self):
+  def _Listen(self):
     logging.info('Starting test server spawner')
     self.server.serve_forever()
 
   def Start(self):
-    listener_thread = threading.Thread(target=self.Listen)
+    listener_thread = threading.Thread(target=self._Listen)
     listener_thread.setDaemon(True)
     listener_thread.start()
     time.sleep(1)
 
   def Stop(self):
-    self.server.Stop()
+    if self.server.test_server_instance:
+      self.server.test_server_instance.Stop()
+    self.server.shutdown()
--- a/media/webrtc/trunk/build/android/pylib/constants.py
+++ b/media/webrtc/trunk/build/android/pylib/constants.py
@@ -10,28 +10,38 @@ import os
 CHROME_PACKAGE = 'com.google.android.apps.chrome'
 CHROME_ACTIVITY = 'com.google.android.apps.chrome.Main'
 CHROME_TESTS_PACKAGE = 'com.google.android.apps.chrome.tests'
 LEGACY_BROWSER_PACKAGE = 'com.google.android.browser'
 LEGACY_BROWSER_ACTIVITY = 'com.android.browser.BrowserActivity'
 CONTENT_SHELL_PACKAGE = "org.chromium.content_shell"
 CONTENT_SHELL_ACTIVITY = "org.chromium.content_shell.ContentShellActivity"
 CHROME_SHELL_PACKAGE = 'org.chromium.chrome.browser.test'
+CHROMIUM_TEST_SHELL_PACKAGE = 'org.chromium.chrome.testshell'
 
 CHROME_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__),
                                           '..', '..', '..'))
 
-# Ports arrangement for various test servers used in Clank.
+# Ports arrangement for various test servers used in Chrome for Android.
 # Lighttpd server will attempt to use 9000 as default port, if unavailable it
 # will find a free port from 8001 - 8999.
 LIGHTTPD_DEFAULT_PORT = 9000
 LIGHTTPD_RANDOM_PORT_FIRST = 8001
 LIGHTTPD_RANDOM_PORT_LAST = 8999
 TEST_SYNC_SERVER_PORT = 9031
 
 # The net test server is started from 10000. Reserve 20000 ports for the all
 # test-server based tests should be enough for allocating different port for
 # individual test-server based test.
 TEST_SERVER_PORT_FIRST = 10000
 TEST_SERVER_PORT_LAST = 30000
 # A file to record next valid port of test server.
 TEST_SERVER_PORT_FILE = '/tmp/test_server_port'
 TEST_SERVER_PORT_LOCKFILE = '/tmp/test_server_port.lock'
+
+TEST_EXECUTABLE_DIR = '/data/local/tmp'
+# Directories for common java libraries for SDK build.
+# These constants are defined in build/android/ant/common.xml
+SDK_BUILD_TEST_JAVALIB_DIR = 'test.lib.java'
+SDK_BUILD_APKS_DIR = 'apks'
+
+# The directory on the device where perf test output gets saved to.
+DEVICE_PERF_OUTPUT_DIR = '/data/data/' + CHROME_PACKAGE + '/files'
--- a/media/webrtc/trunk/build/android/pylib/device_stats_monitor.py
+++ b/media/webrtc/trunk/build/android/pylib/device_stats_monitor.py
@@ -18,18 +18,19 @@ import io_stats_parser
 class DeviceStatsMonitor(object):
   """Class for collecting device stats such as IO/CPU usage.
 
   Args:
       adb: Instance of AndroidComannds.
       hz: Frequency at which to sample device stats.
   """
 
-  DEVICE_PATH = '/data/local/tmp/device_stats_monitor'
-  PROFILE_PATH = '/sdcard/Download/device_stats_monitor.profile'
+  DEVICE_PATH = constants.TEST_EXECUTABLE_DIR + '/device_stats_monitor'
+  PROFILE_PATH = (constants.DEVICE_PERF_OUTPUT_DIR +
+      '/device_stats_monitor.profile')
   RESULT_VIEWER_PATH = os.path.abspath(os.path.join(
       os.path.dirname(os.path.realpath(__file__)), 'device_stats_monitor.html'))
 
   def __init__(self, adb, hz, build_type):
     self._adb = adb
     host_path = os.path.abspath(os.path.join(
         constants.CHROME_DIR, 'out', build_type, 'device_stats_monitor'))
     self._adb.PushIfNeeded(host_path, DeviceStatsMonitor.DEVICE_PATH)
--- a/media/webrtc/trunk/build/android/pylib/fake_dns.py
+++ b/media/webrtc/trunk/build/android/pylib/fake_dns.py
@@ -7,17 +7,17 @@ import constants
 import logging
 import os
 import subprocess
 import time
 
 
 class FakeDns(object):
   """Wrapper class for the fake_dns tool."""
-  _FAKE_DNS_PATH = '/data/local/tmp/fake_dns'
+  _FAKE_DNS_PATH = constants.TEST_EXECUTABLE_DIR + '/fake_dns'
 
   def __init__(self, adb, build_type):
     """
       Args:
         adb: the AndroidCommands to use.
         build_type: 'Release' or 'Debug'.
     """
     self._adb = adb
--- a/media/webrtc/trunk/build/android/pylib/flag_changer.py
+++ b/media/webrtc/trunk/build/android/pylib/flag_changer.py
@@ -1,18 +1,19 @@
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
+import constants
 import traceback
 import warnings
 
 
 # Location where chrome reads command line flags from
-CHROME_COMMAND_FILE = '/data/local/tmp/chrome-command-line'
+CHROME_COMMAND_FILE = constants.TEST_EXECUTABLE_DIR + '/chrome-command-line'
 
 class FlagChanger(object):
   """Changes the flags Chrome runs with.
 
   There are two different use cases for this file:
   * Flags are permanently set by calling Set().
   * Flags can be temporarily set for a particular set of unit tests.  These
     tests should call Restore() to revert the flags to their original state
--- a/media/webrtc/trunk/build/android/pylib/forwarder.py
+++ b/media/webrtc/trunk/build/android/pylib/forwarder.py
@@ -1,25 +1,32 @@
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 import logging
 import os
-import pexpect
 import re
 import sys
+import time
 
 import android_commands
-from constants import CHROME_DIR
+import cmd_helper
+import constants
+import ports
+
+from pylib import pexpect
 
 class Forwarder(object):
   """Class to manage port forwards from the device to the host."""
 
-  _FORWARDER_PATH = '/data/local/tmp/forwarder'
+  _DEVICE_FORWARDER_PATH = constants.TEST_EXECUTABLE_DIR + '/device_forwarder'
+
+  # Unix Abstract socket path:
+  _DEVICE_ADB_CONTROL_PORT = 'chrome_device_forwarder'
   _TIMEOUT_SECS = 30
 
   def __init__(self, adb, port_pairs, tool, host_name, build_type):
     """Forwards TCP ports on the device back to the host.
 
     Works like adb forward, but in reverse.
 
     Args:
@@ -35,87 +42,157 @@ class Forwarder(object):
                  host machine. Usually use loopback '127.0.0.1'.
       build_type: 'Release' or 'Debug'.
 
     Raises:
       Exception on failure to forward the port.
     """
     self._adb = adb
     self._host_to_device_port_map = dict()
-    self._process = None
+    self._host_process = None
+    self._device_process = None
+    self._adb_forward_process = None
+
+    self._host_adb_control_port = ports.AllocateTestServerPort()
+    if not self._host_adb_control_port:
+      raise Exception('Failed to allocate a TCP port in the host machine.')
     adb.PushIfNeeded(
-        os.path.join(CHROME_DIR, 'out', build_type, 'forwarder'),
-        Forwarder._FORWARDER_PATH)
+        os.path.join(constants.CHROME_DIR, 'out', build_type,
+                     'device_forwarder'),
+        Forwarder._DEVICE_FORWARDER_PATH)
+    self._host_forwarder_path = os.path.join(constants.CHROME_DIR,
+                                             'out',
+                                             build_type,
+                                             'host_forwarder')
     forward_string = ['%d:%d:%s' %
                       (device, host, host_name) for device, host in port_pairs]
-
-    # Kill off any existing forwarders on conflicting non-dynamically allocated
-    # ports.
-    for device_port, _ in port_pairs:
-      if device_port != 0:
-        self._KillForwardersUsingDevicePort(device_port)
+    logging.info('Forwarding ports: %s', forward_string)
+    timeout_sec = 5
+    host_pattern = 'host_forwarder.*' + ' '.join(forward_string)
+    # TODO(felipeg): Rather than using a blocking kill() here, the device
+    # forwarder could try to bind the Unix Domain Socket until it succeeds or
+    # while it fails because the socket is already bound (with appropriate
+    # timeout handling obviously).
+    self._KillHostForwarderBlocking(host_pattern, timeout_sec)
+    self._KillDeviceForwarderBlocking(timeout_sec)
+    self._adb_forward_process = pexpect.spawn(
+        'adb', ['-s',
+                adb._adb.GetSerialNumber(),
+                'forward',
+                'tcp:%s' % self._host_adb_control_port,
+                'localabstract:%s' % Forwarder._DEVICE_ADB_CONTROL_PORT])
+    self._device_process = pexpect.spawn(
+        'adb', ['-s',
+                adb._adb.GetSerialNumber(),
+                'shell',
+                '%s %s -D --adb_sock=%s' % (
+                    tool.GetUtilWrapper(),
+                    Forwarder._DEVICE_FORWARDER_PATH,
+                    Forwarder._DEVICE_ADB_CONTROL_PORT)])
 
-    logging.info('Forwarding ports: %s' % (forward_string))
-    process = pexpect.spawn(
-      'adb', ['-s', adb._adb.GetSerialNumber(),
-              'shell', '%s %s -D %s' % (
-          tool.GetUtilWrapper(), Forwarder._FORWARDER_PATH,
-          ' '.join(forward_string))])
+    device_success_re = re.compile('Starting Device Forwarder.')
+    device_failure_re = re.compile('.*:ERROR:(.*)')
+    index = self._device_process.expect([device_success_re,
+                                         device_failure_re,
+                                         pexpect.EOF,
+                                         pexpect.TIMEOUT],
+                                        Forwarder._TIMEOUT_SECS)
+    if index == 1:
+      # Failure
+      error_msg = str(self._device_process.match.group(1))
+      logging.error(self._device_process.before)
+      self._CloseProcess()
+      raise Exception('Failed to start Device Forwarder with Error: %s' %
+                      error_msg)
+    elif index == 2:
+      logging.error(self._device_process.before)
+      self._CloseProcess()
+      raise Exception('Unexpected EOF while trying to start Device Forwarder.')
+    elif index == 3:
+      logging.error(self._device_process.before)
+      self._CloseProcess()
+      raise Exception('Timeout while trying start Device Forwarder')
+
+    self._host_process = pexpect.spawn(self._host_forwarder_path,
+                                       ['--adb_port=%s' % (
+                                           self._host_adb_control_port)] +
+                                       forward_string)
 
     # Read the output of the command to determine which device ports where
     # forwarded to which host ports (necessary if
-    success_re = re.compile('Forwarding device port (\d+) to host (\d+):')
-    failure_re = re.compile('Couldn\'t start forwarder server for port spec: '
-                            '(\d+):(\d+)')
+    host_success_re = re.compile('Forwarding device port (\d+) to host (\d+):')
+    host_failure_re = re.compile('Couldn\'t start forwarder server for port '
+                                 'spec: (\d+):(\d+)')
     for pair in port_pairs:
-      index = process.expect([success_re, failure_re, pexpect.EOF,
-                              pexpect.TIMEOUT],
-                             Forwarder._TIMEOUT_SECS)
+      index = self._host_process.expect([host_success_re,
+                                         host_failure_re,
+                                         pexpect.EOF,
+                                         pexpect.TIMEOUT],
+                                        Forwarder._TIMEOUT_SECS)
       if index == 0:
         # Success
-        device_port = int(process.match.group(1))
-        host_port = int(process.match.group(2))
+        device_port = int(self._host_process.match.group(1))
+        host_port = int(self._host_process.match.group(2))
         self._host_to_device_port_map[host_port] = device_port
         logging.info("Forwarding device port: %d to host port: %d." %
                      (device_port, host_port))
       elif index == 1:
         # Failure
-        device_port = int(process.match.group(1))
-        host_port = int(process.match.group(2))
-        process.close()
+        device_port = int(self._host_process.match.group(1))
+        host_port = int(self._host_process.match.group(2))
+        self._CloseProcess()
         raise Exception('Failed to forward port %d to %d' % (device_port,
                                                              host_port))
       elif index == 2:
-        logging.error(process.before)
-        process.close()
+        logging.error(self._host_process.before)
+        self._CloseProcess()
         raise Exception('Unexpected EOF while trying to forward ports %s' %
                         port_pairs)
       elif index == 3:
-        logging.error(process.before)
-        process.close()
+        logging.error(self._host_process.before)
+        self._CloseProcess()
         raise Exception('Timeout while trying to forward ports %s' % port_pairs)
 
-    self._process = process
+  def _KillHostForwarderBlocking(self, host_pattern, timeout_sec):
+    """Kills any existing host forwarders using the provided pattern.
+
+    Note that this waits until the process terminates.
+    """
+    cmd_helper.RunCmd(['pkill', '-f', host_pattern])
+    elapsed = 0
+    wait_period = 0.1
+    while not cmd_helper.RunCmd(['pgrep', '-f', host_pattern]) and (
+        elapsed < timeout_sec):
+      time.sleep(wait_period)
+      elapsed += wait_period
+    if elapsed >= timeout_sec:
+        raise Exception('Timed out while killing ' + host_pattern)
+
+  def _KillDeviceForwarderBlocking(self, timeout_sec):
+    """Kills any existing device forwarders.
 
-  def _KillForwardersUsingDevicePort(self, device_port):
-    """Check if the device port is in use and if it is try to terminate the
-       forwarder process (if any) that may already be forwarding it"""
-    processes = self._adb.ProcessesUsingDevicePort(device_port)
-    for pid, name in processes:
-      if name == 'forwarder':
-        logging.warning(
-            'Killing forwarder process with pid %d using device_port %d' % (
-                 pid, device_port))
-        self._adb.RunShellCommand('kill %d' % pid)
-      else:
-        logging.error(
-             'Not killing process with pid %d (%s) using device_port %d' % (
-                 pid, name, device_port))
+    Note that this waits until the process terminates.
+    """
+    processes_killed = self._adb.KillAllBlocking(
+        'device_forwarder', timeout_sec)
+    if not processes_killed:
+      pids = self._adb.ExtractPid('device_forwarder')
+      if pids:
+        raise Exception('Timed out while killing device_forwarder')
+
+  def _CloseProcess(self):
+    if self._host_process:
+      self._host_process.close()
+    if self._device_process:
+      self._device_process.close()
+    if self._adb_forward_process:
+      self._adb_forward_process.close()
+    self._host_process = None
+    self._device_process = None
+    self._adb_forward_process = None
 
   def DevicePortForHostPort(self, host_port):
     """Get the device port that corresponds to a given host port."""
     return self._host_to_device_port_map.get(host_port)
 
   def Close(self):
     """Terminate the forwarder process."""
-    if self._process:
-      self._process.close()
-      self._process = None
+    self._CloseProcess()
--- a/media/webrtc/trunk/build/android/pylib/json_perf_parser.py
+++ b/media/webrtc/trunk/build/android/pylib/json_perf_parser.py
@@ -11,22 +11,22 @@ import json
 def GetAverageRunInfo(json_data, name):
   """Summarizes TraceEvent JSON data for performance metrics.
 
   Example JSON Inputs (More tags can be added but these are required):
   Measuring Duration:
   [
     { "cat": "Java",
       "ts": 10000000000,
-      "ph": "B",
+      "ph": "S",
       "name": "TestTrace"
     },
     { "cat": "Java",
       "ts": 10000004000,
-      "ph": "E",
+      "ph": "F",
       "name": "TestTrace"
     },
     ...
   ]
 
   Measuring Call Frequency (FPS):
   [
     { "cat": "Java",
@@ -101,21 +101,21 @@ def GetAverageRunInfo(json_data, name):
         result['units'] = 'ms'
       else:
         raise Exception('Entry did not contain valid value info: %s' % entry)
 
     if not val_type in entry:
       raise Exception('Entry did not contain expected value type "%s" '
                       'information: %s' % (val_type, entry))
     val = GetVal(entry)
-    if (entry['ph'] == 'B' and
+    if (entry['ph'] == 'S' and
         (result['type'] == 'Unknown' or result['type'] == 'Span')):
       result['type'] = 'Span'
       last_val = val
-    elif ((entry['ph'] == 'E' and result['type'] == 'Span') or
+    elif ((entry['ph'] == 'F' and result['type'] == 'Span') or
           (entry['ph'] == 'I' and (result['type'] == 'Unknown' or
                                    result['type'] == 'Instant'))):
       if last_val > 0:
         delta = val - last_val
         if result['min'] == -1 or result['min'] > delta:
           result['min'] = delta
         if result['max'] == -1 or result['max'] < delta:
           result['max'] = delta
--- a/media/webrtc/trunk/build/android/pylib/perf_tests_helper.py
+++ b/media/webrtc/trunk/build/android/pylib/perf_tests_helper.py
@@ -1,14 +1,16 @@
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 import re
 
+import android_commands
+import math
 
 # Valid values of result type.
 RESULT_TYPES = {'unimportant': 'RESULT ',
                 'default': '*RESULT ',
                 'informational': ''}
 
 
 def _EscapePerfResult(s):
@@ -40,20 +42,24 @@ def PrintPerfResult(measurement, trace, 
       String of the formated perf result.
   """
   assert result_type in RESULT_TYPES, 'result type: %s is invalid' % result_type
 
   assert isinstance(values, list)
   assert len(values)
   assert '/' not in measurement
   avg = None
+  sd = None
   if len(values) > 1:
     try:
       value = '[%s]' % ','.join([str(v) for v in values])
       avg = sum([float(v) for v in values]) / len(values)
+      sqdiffs = [(float(v) - avg) ** 2 for v in values]
+      variance = sum(sqdiffs) / (len(values) - 1)
+      sd = math.sqrt(variance)
     except ValueError:
       value = ", ".join(values)
   else:
     value = values[0]
 
   trace_name = _EscapePerfResult(trace)
   output = '%s%s: %s%s%s %s' % (
     RESULT_TYPES[result_type],
@@ -61,11 +67,54 @@ def PrintPerfResult(measurement, trace, 
     trace_name,
     # Do not show equal sign if the trace is empty. Usually it happens when
     # measurement is enough clear to describe the result.
     '= ' if trace_name else '',
     value,
     units)
   if avg:
     output += '\nAvg %s: %f%s' % (measurement, avg, units)
+  if sd:
+    output += '\nSd  %s: %f%s' % (measurement, sd, units)
   if print_to_stdout:
     print output
   return output
+
+
+class PerfTestSetup(object):
+  """Provides methods for setting up a device for perf testing."""
+  _DROP_CACHES = '/proc/sys/vm/drop_caches'
+  _SCALING_GOVERNOR = '/sys/devices/system/cpu/cpu%d/cpufreq/scaling_governor'
+
+  def __init__(self, adb):
+    self._adb = adb
+    num_cpus = self._adb.GetFileContents('/sys/devices/system/cpu/online',
+                                         log_result=False)
+    assert num_cpus, 'Unable to find /sys/devices/system/cpu/online'
+    self._num_cpus = int(num_cpus[0].split('-')[-1])
+    self._original_scaling_governor = None
+
+  def DropRamCaches(self):
+    """Drops the filesystem ram caches for performance testing."""
+    if not self._adb.IsRootEnabled():
+      self._adb.EnableAdbRoot()
+    self._adb.RunShellCommand('sync')
+    self._adb.RunShellCommand('echo 3 > ' + PerfTestSetup._DROP_CACHES)
+
+  def SetUp(self):
+    """Sets up performance tests."""
+    if not self._original_scaling_governor:
+      self._original_scaling_governor = self._adb.GetFileContents(
+          PerfTestSetup._SCALING_GOVERNOR % 0,
+          log_result=False)[0]
+      self._SetScalingGovernorInternal('performance')
+    self.DropRamCaches()
+
+  def TearDown(self):
+    """Tears down performance tests."""
+    if self._original_scaling_governor:
+      self._SetScalingGovernorInternal(self._original_scaling_governor)
+    self._original_scaling_governor = None
+
+  def _SetScalingGovernorInternal(self, value):
+    for cpu in range(self._num_cpus):
+      self._adb.RunShellCommand(
+          ('echo %s > ' + PerfTestSetup._SCALING_GOVERNOR) % (value, cpu))
--- a/media/webrtc/trunk/build/android/pylib/ports.py
+++ b/media/webrtc/trunk/build/android/pylib/ports.py
@@ -41,38 +41,45 @@ def ResetTestServerPortAllocation():
 def AllocateTestServerPort():
   """Allocate a port incrementally.
 
   Returns:
     Returns a valid port which should be in between TEST_SERVER_PORT_FIRST and
     TEST_SERVER_PORT_LAST. Returning 0 means no more valid port can be used.
   """
   port = 0
+  ports_tried = []
   try:
     fp_lock = open(constants.TEST_SERVER_PORT_LOCKFILE, 'w')
     fcntl.flock(fp_lock, fcntl.LOCK_EX)
     # Get current valid port and calculate next valid port.
     assert os.path.exists(constants.TEST_SERVER_PORT_FILE)
     with open(constants.TEST_SERVER_PORT_FILE, 'r+') as fp:
       port = int(fp.read())
+      ports_tried.append(port)
       while IsHostPortUsed(port):
         port += 1
+        ports_tried.append(port)
       if (port > constants.TEST_SERVER_PORT_LAST or
           port < constants.TEST_SERVER_PORT_FIRST):
         port = 0
       else:
         fp.seek(0, os.SEEK_SET)
         fp.write('%d' % (port + 1))
   except Exception as e:
     logging.info(e)
   finally:
     if fp_lock:
       fcntl.flock(fp_lock, fcntl.LOCK_UN)
       fp_lock.close()
-  logging.info('Allocate port %d for test server.', port)
+  if port:
+    logging.info('Allocate port %d for test server.', port)
+  else:
+    logging.error('Could not allocate port for test server. '
+                  'List of ports tried: %s', str(ports_tried))
   return port
 
 
 def IsHostPortUsed(host_port):
   """Checks whether the specified host port is used or not.
 
   Uses -n -P to inhibit the conversion of host/port numbers to host/port names.
 
--- a/media/webrtc/trunk/build/android/pylib/python_test_base.py
+++ b/media/webrtc/trunk/build/android/pylib/python_test_base.py
@@ -21,18 +21,17 @@ the Java test results into Python test r
 
 import logging
 import os
 import time
 
 import android_commands
 import apk_info
 from run_java_tests import TestRunner
-import test_options_parser
-from test_result import SingleTestResult, TestResults, PYTHON
+from test_result import SingleTestResult, TestResults
 
 
 # aka the parent of com.google.android
 BASE_ROOT = 'src' + os.sep
 
 
 class PythonTestBase(object):
   """Base class for Python-driven tests."""
@@ -40,23 +39,24 @@ class PythonTestBase(object):
   def __init__(self, test_name):
     # test_name must match one of the test methods defined on a subclass which
     # inherits from this class.
     # It's stored so we can do the attr lookup on demand, allowing this class
     # to be pickled, a requirement for the multiprocessing module.
     self.test_name = test_name
     class_name = self.__class__.__name__
     self.qualified_name = class_name + '.' + self.test_name
+
+  def SetUp(self, options):
+    self.options = options
+    self.shard_index = self.options.shard_index
+    self.device_id = self.options.device_id
+    self.adb = android_commands.AndroidCommands(self.device_id)
     self.ports_to_forward = []
 
-  def SetUp(self, device_id, shard_index):
-    self.shard_index = shard_index
-    self.device_id = device_id
-    self.adb = android_commands.AndroidCommands(self.device_id)
-
   def TearDown(self):
     pass
 
   def Run(self):
     logging.warning('Running Python-driven test: %s', self.test_name)
     return getattr(self, self.test_name)()
 
   def _RunJavaTest(self, fname, suite, test):
@@ -66,20 +66,19 @@ class PythonTestBase(object):
       fname: filename for the test (e.g. foo/bar/baz/tests/FooTest.py)
       suite: name of the Java test suite (e.g. FooTest)
       test: name of the test method to run (e.g. testFooBar)
 
     Returns:
       TestResults object with a single test result.
     """
     test = self._ComposeFullTestName(fname, suite, test)
-    # Get a set of default options
-    options = test_options_parser.ParseInstrumentationArgs([''])
-    apks = [apk_info.ApkInfo(options.test_apk_path, options.test_apk_jar_path)]
-    java_test_runner = TestRunner(options, self.device_id, [test], False,
+    apks = [apk_info.ApkInfo(self.options.test_apk_path,
+            self.options.test_apk_jar_path)]
+    java_test_runner = TestRunner(self.options, self.device_id, [test], False,
                                   self.shard_index,
                                   apks,
                                   self.ports_to_forward)
     return java_test_runner.Run()
 
   def _RunJavaTests(self, fname, tests):
     """Calls a list of tests and stops at the first test failure.
 
@@ -133,40 +132,32 @@ class PythonTestBase(object):
     if broken:
       # Since we have run only one test, take the first and only item.
       single_result = broken[0]
 
       log = single_result.log
       if not log:
         log = 'No logging information.'
 
-      short_error_msg = single_result.log.split('\n')[0]
-      # err_info is ostensibly for Sponge to consume; it's a short error
-      # message and a longer one.
-      err_info = (short_error_msg, log)
-
       python_result = SingleTestResult(self.qualified_name, start_ms,
                                        duration_ms,
-                                       PYTHON,
-                                       log,
-                                       err_info)
+                                       log)
 
       # Figure out where the test belonged. There's probably a cleaner way of
       # doing this.
       if single_result in result.crashed:
         test_results.crashed = [python_result]
       elif single_result in result.failed:
         test_results.failed = [python_result]
       elif single_result in result.unknown:
         test_results.unknown = [python_result]
 
     else:
       python_result = SingleTestResult(self.qualified_name, start_ms,
-                                       duration_ms,
-                                       PYTHON)
+                                       duration_ms)
       test_results.ok = [python_result]
 
     return test_results
 
   def _ComposeFullTestName(self, fname, suite, test):
     package_name = self._GetPackageName(fname)
     return package_name + '.' + suite + '#' + test
 
--- a/media/webrtc/trunk/build/android/pylib/python_test_caller.py
+++ b/media/webrtc/trunk/build/android/pylib/python_test_caller.py
@@ -7,17 +7,17 @@
 
 import logging
 import sys
 import time
 
 from test_result import TestResults
 
 
-def CallPythonTest(test, device_id, shard_index):
+def CallPythonTest(test, options):
   """Invokes a test function and translates Python exceptions into test results.
 
   This method invokes SetUp()/TearDown() on the test. It is intended to be
   resilient to exceptions in SetUp(), the test itself, and TearDown(). Any
   Python exception means the test is marked as failed, and the test result will
   contain information about the exception.
 
   If SetUp() raises an exception, the test is not run.
@@ -27,29 +27,28 @@ def CallPythonTest(test, device_id, shar
   precedence whether or not TearDown() also raised an exception.
 
   shard_index is not applicable in single-device scenarios, when test execution
   is serial rather than parallel. Tests can use this to bring up servers with
   unique port numbers, for example. See also python_test_sharder.
 
   Args:
     test: an object which is ostensibly a subclass of PythonTestBase.
-    device_id: device ID against which the test will run.
-    shard_index: index # of the shard on which this test is running
+    options: Options to use for setting up tests.
 
   Returns:
     A TestResults object which contains any results produced by the test or, in
     the case of a Python exception, the Python exception info.
   """
 
   start_date_ms = int(time.time()) * 1000
   failed = False
 
   try:
-    test.SetUp(device_id, shard_index)
+    test.SetUp(options)
   except Exception:
     failed = True
     logging.exception(
         'Caught exception while trying to run SetUp() for test: ' +
         test.qualified_name)
     # Tests whose SetUp() method has failed are likely to fail, or at least
     # yield invalid results.
     exc_info = sys.exc_info()
--- a/media/webrtc/trunk/build/android/pylib/python_test_sharder.py
+++ b/media/webrtc/trunk/build/android/pylib/python_test_sharder.py
@@ -1,14 +1,15 @@
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """Takes care of sharding the python-drive tests in multiple devices."""
 
+import copy
 import logging
 import multiprocessing
 
 from python_test_caller import CallPythonTest
 from run_java_tests import FatalTestException
 import sharded_tests_queue
 from test_result import TestResults
 
@@ -45,63 +46,62 @@ class PythonTestRunner(object):
 
   This is meant to be a long-lived object which can run multiple Python tests
   within its lifetime. Tests will receive the device_id and shard_index.
 
   The shard index affords the ability to create unique port numbers (e.g.
   DEFAULT_PORT + shard_index) if the test so wishes.
   """
 
-  def __init__(self, device_id, shard_index):
+  def __init__(self, options):
     """Constructor.
 
     Args:
-      device_id: ID of the device which this test will talk to.
-      shard_index: shard index, used to create such as unique port numbers.
+      options: Options to use for setting up tests.
     """
-    self.device_id = device_id
-    self.shard_index = shard_index
+    self.options = options
 
   def RunTests(self):
     """Runs tests from the shared pool of tests, aggregating results.
 
     Returns:
       A list of test results for all of the tests which this runner executed.
     """
     tests = PythonTestSharder.tests_container
 
     results = []
     for t in tests:
-      res = CallPythonTest(t, self.device_id, self.shard_index)
+      res = CallPythonTest(t, self.options)
       results.append(res)
 
     return TestResults.FromTestResults(results)
 
 
 class PythonTestSharder(object):
   """Runs Python tests in parallel on multiple devices.
 
   This is lifted more or less wholesale from BaseTestRunner.
 
   Under the covers, it creates a pool of long-lived PythonTestRunners, which
   execute tests from the pool of tests.
 
   Args:
     attached_devices: a list of device IDs attached to the host.
-    shard_retries: number of retries for any given test.
     available_tests: a list of tests to run which subclass PythonTestBase.
+    options: Options to use for setting up tests.
 
   Returns:
     An aggregated list of test results.
   """
   tests_container = None
 
-  def __init__(self, attached_devices, shard_retries, available_tests):
+  def __init__(self, attached_devices, available_tests, options):
+    self.options = options
     self.attached_devices = attached_devices
-    self.retries = shard_retries
+    self.retries = options.shard_retries
     self.tests = available_tests
 
   def _SetupSharding(self, tests):
     """Creates the shared pool of tests and makes it available to test runners.
 
     Args:
       tests: the list of tests which will be consumed by workers.
     """
@@ -173,17 +173,20 @@ class PythonTestSharder(object):
     """
     test_runners = []
     for index, device in enumerate(attached_devices):
       logging.warning('*' * 80)
       logging.warning('Creating shard %d for %s', index, device)
       logging.warning('*' * 80)
       # Bind the PythonTestRunner to a device & shard index. Give it the
       # runnable which it will use to actually execute the tests.
-      test_runner = PythonTestRunner(device, index)
+      test_options = copy.deepcopy(self.options)
+      test_options.ensure_value('device_id', device)
+      test_options.ensure_value('shard_index', index)
+      test_runner = PythonTestRunner(test_options)
       test_runners.append(test_runner)
 
     return test_runners
 
   def _GetTestsToRetry(self, available_tests, failed_tests):
     """Infers a list of tests to retry from failed tests and available tests.
 
     Args:
--- a/media/webrtc/trunk/build/android/pylib/run_java_tests.py
+++ b/media/webrtc/trunk/build/android/pylib/run_java_tests.py
@@ -18,18 +18,18 @@ from base_test_runner import BaseTestRun
 from base_test_sharder import BaseTestSharder, SetTestsContainer
 import cmd_helper
 import constants
 import errors
 from forwarder import Forwarder
 from json_perf_parser import GetAverageRunInfoFromJSONString
 from perf_tests_helper import PrintPerfResult
 import sharded_tests_queue
-from test_result import JAVA, SingleTestResult, TestResults
-
+from test_result import SingleTestResult, TestResults
+import valgrind_tools
 
 _PERF_TEST_ANNOTATION = 'PerfTest'
 
 
 class FatalTestException(Exception):
   """A fatal test exception."""
   pass
 
@@ -60,32 +60,31 @@ def FilterTests(test_names, pattern_list
     if has_match == inclusive:
       ret += [t]
   return ret
 
 
 class TestRunner(BaseTestRunner):
   """Responsible for running a series of tests connected to a single device."""
 
-  _DEVICE_DATA_DIR = '/data/local/tmp/chrome/test/data'
+  _DEVICE_DATA_DIR = 'chrome/test/data'
   _EMMA_JAR = os.path.join(os.environ.get('ANDROID_BUILD_TOP', ''),
                            'external/emma/lib/emma.jar')
   _COVERAGE_MERGED_FILENAME = 'unittest_coverage.es'
   _COVERAGE_WEB_ROOT_DIR = os.environ.get('EMMA_WEB_ROOTDIR')
   _COVERAGE_FILENAME = 'coverage.ec'
   _COVERAGE_RESULT_PATH = ('/data/data/com.google.android.apps.chrome/files/' +
                            _COVERAGE_FILENAME)
   _COVERAGE_META_INFO_PATH = os.path.join(os.environ.get('ANDROID_BUILD_TOP',
                                                          ''),
                                           'out/target/common/obj/APPS',
                                           'Chrome_intermediates/coverage.em')
   _HOSTMACHINE_PERF_OUTPUT_FILE = '/tmp/chrome-profile'
-  _DEVICE_PERF_OUTPUT_DIR = '/sdcard/Download/'
-  _DEVICE_PERF_OUTPUT_SEARCH_PREFIX = (_DEVICE_PERF_OUTPUT_DIR +
-                                       'chrome-profile*')
+  _DEVICE_PERF_OUTPUT_SEARCH_PREFIX = (constants.DEVICE_PERF_OUTPUT_DIR +
+                                       '/chrome-profile*')
   _DEVICE_HAS_TEST_FILES = {}
 
   def __init__(self, options, device, tests_iter, coverage, shard_index, apks,
                ports_to_forward):
     """Create a new TestRunner.
 
     Args:
       options: An options object with the following required attributes:
@@ -125,18 +124,17 @@ class TestRunner(BaseTestRunner):
     self.tests_iter = tests_iter
     self.coverage = coverage
     self.apks = apks
     self.test_apk = apks[0]
     self.instrumentation_class_path = self.test_apk.GetPackageName()
     self.ports_to_forward = ports_to_forward
 
     self.test_results = TestResults()
-    # List of forwarders created by this instance of TestRunner.
-    self.forwarders = []
+    self.forwarder = None
 
     if self.coverage:
       if os.path.exists(TestRunner._COVERAGE_MERGED_FILENAME):
         os.remove(TestRunner._COVERAGE_MERGED_FILENAME)
       if not os.path.exists(TestRunner._COVERAGE_META_INFO_PATH):
         raise FatalTestException('FATAL ERROR in ' + sys.argv[0] +
                                  ' : Coverage meta info [' +
                                  TestRunner._COVERAGE_META_INFO_PATH +
@@ -157,26 +155,31 @@ class TestRunner(BaseTestRunner):
     return self.tests_iter
 
   def CopyTestFilesOnce(self):
     """Pushes the test data files to the device. Installs the apk if opted."""
     if TestRunner._DEVICE_HAS_TEST_FILES.get(self.device, False):
       logging.warning('Already copied test files to device %s, skipping.',
                       self.device)
       return
-    host_test_files_path = (constants.CHROME_DIR +
-                            '/chrome/test/data/android/device_files')
-    if os.path.exists(host_test_files_path):
-      self.adb.PushIfNeeded(host_test_files_path,
-                            TestRunner._DEVICE_DATA_DIR)
+    host_test_files = [
+        ('android_webview/test/data/device_files', 'webview'),
+        ('content/test/data/android/device_files', 'content'),
+        ('chrome/test/data/android/device_files', 'chrome')
+    ]
+    for (host_src, dst_layer) in host_test_files:
+      host_test_files_path = constants.CHROME_DIR + '/' + host_src
+      if os.path.exists(host_test_files_path):
+        self.adb.PushIfNeeded(host_test_files_path,
+                              self.adb.GetExternalStorage() + '/' +
+                              TestRunner._DEVICE_DATA_DIR + '/' + dst_layer)
     if self.install_apk:
-      # Install -r is not reliable, so uninstall it first.
       for apk in self.apks:
-        self.adb.Adb().SendCommand('uninstall ' + apk.GetPackageName())
-        self.adb.Adb().SendCommand('install ' + apk.GetApkPath())
+        self.adb.ManagedInstall(apk.GetApkPath(),
+                                package_name=apk.GetPackageName())
     self.tool.CopyFiles()
     TestRunner._DEVICE_HAS_TEST_FILES[self.device] = True
 
   def SaveCoverageData(self, test):
     """Saves the Emma coverage data before it's overwritten by the next test.
 
     Args:
       test: the test whose coverage data is collected.
@@ -233,59 +236,60 @@ class TestRunner(BaseTestRunner):
     if self.coverage:
       ret['coverage'] = 'true'
     if self.wait_for_debugger:
       ret['debug'] = 'true'
     return ret
 
   def _TakeScreenshot(self, test):
     """Takes a screenshot from the device."""
-    screenshot_tool = os.path.join(os.getenv('ANDROID_HOST_OUT'), 'bin',
-                                   'screenshot2')
+    screenshot_tool = os.path.join(constants.CHROME_DIR,
+        'third_party/android_tools/sdk/tools/monkeyrunner')
+    screenshot_script = os.path.join(constants.CHROME_DIR,
+        'build/android/monkeyrunner_screenshot.py')
     screenshot_path = os.path.join(constants.CHROME_DIR,
                                    'out_screenshots')
     if not os.path.exists(screenshot_path):
       os.mkdir(screenshot_path)
     screenshot_name = os.path.join(screenshot_path, test + '.png')
     logging.info('Taking screenshot named %s', screenshot_name)
-    cmd_helper.RunCmd([screenshot_tool, '-s', self.device, screenshot_name])
+    cmd_helper.RunCmd([screenshot_tool, screenshot_script,
+                       '--serial', self.device,
+                       '--file', screenshot_name])
 
   def SetUp(self):
     """Sets up the test harness and device before all tests are run."""
     super(TestRunner, self).SetUp()
     if not self.adb.IsRootEnabled():
       logging.warning('Unable to enable java asserts for %s, non rooted device',
                       self.device)
     else:
       if self.adb.SetJavaAssertsEnabled(enable=True):
         self.adb.Reboot(full_reboot=False)
 
     # We give different default value to launch HTTP server based on shard index
     # because it may have race condition when multiple processes are trying to
     # launch lighttpd with same port at same time.
-    # This line *must* come before the forwarding below, as it nukes all
-    # the other forwarders. A more comprehensive fix might be to pull the
-    # forwarder-killing line up to here, but that might violate assumptions
-    # implicit in other places.
-    self.LaunchTestHttpServer(os.path.join(constants.CHROME_DIR),
-                              (constants.LIGHTTPD_RANDOM_PORT_FIRST +
-                               self.shard_index))
-
+    http_server_ports = self.LaunchTestHttpServer(
+        os.path.join(constants.CHROME_DIR),
+        (constants.LIGHTTPD_RANDOM_PORT_FIRST + self.shard_index))
     if self.ports_to_forward:
-      for port in self.ports_to_forward:
-        self.forwarders.append(Forwarder(
-            self.adb, [(port, port)], self.tool, '127.0.0.1', self.build_type))
+      port_pairs = [(port, port) for port in self.ports_to_forward]
+      # We need to remember which ports the HTTP server is using, since the
+      # forwarder will stomp on them otherwise.
+      port_pairs.append(http_server_ports)
+      self.forwarder = Forwarder(
+         self.adb, port_pairs, self.tool, '127.0.0.1', self.build_type)
     self.CopyTestFilesOnce()
     self.flags.AddFlags(['--enable-test-intents'])
 
   def TearDown(self):
     """Cleans up the test harness and saves outstanding data from test run."""
-    if self.forwarders:
-      for forwarder in self.forwarders:
-        forwarder.Close()
+    if self.forwarder:
+      self.forwarder.Close()
     self.GenerateCoverageReportIfNeeded()
     super(TestRunner, self).TearDown()
 
   def TestSetup(self, test):
     """Sets up the test harness for running a particular test.
 
     Args:
       test: The name of the test that will be run.
@@ -395,21 +399,17 @@ class TestRunner(BaseTestRunner):
           # Process the performance data
           result = GetAverageRunInfoFromJSONString(json_string, perf_set[0])
 
           PrintPerfResult(perf_set[1], perf_set[2],
                           [result['average']], result['units'])
 
   def _SetupIndividualTestTimeoutScale(self, test):
     timeout_scale = self._GetIndividualTestTimeoutScale(test)
-    if timeout_scale == 1:
-      value = '""'
-    else:
-      value = '%f' % timeout_scale
-    self.adb.RunShellCommand('setprop chrome.timeout_scale %s' % value)
+    valgrind_tools.SetChromeTimeoutScale(self.adb, timeout_scale)
 
   def _GetIndividualTestTimeoutScale(self, test):
     """Returns the timeout scale for the given |test|."""
     annotations = self.apks[0].GetTestAnnotations(test)
     timeout_scale = 1
     if 'TimeoutScale' in annotations:
       for annotation in annotations:
         scale_match = re.match('TimeoutScale:([0-9]+)', annotation)
@@ -463,40 +463,37 @@ class TestRunner(BaseTestRunner):
         test_result = test_results[0]
         status_code = test_result.GetStatusCode()
         if status_code:
           log = test_result.GetFailureReason()
           if not log:
             log = 'No information.'
           if self.screenshot_failures or log.find('INJECT_EVENTS perm') >= 0:
             self._TakeScreenshot(test)
-          result = (log.split('\n')[0], log)
           self.test_results.failed += [SingleTestResult(test, start_date_ms,
-                                                        duration_ms, JAVA, log,
-                                                        result)]
+                                                        duration_ms, log)]
         else:
-          result = [SingleTestResult(test, start_date_ms, duration_ms, JAVA)]
+          result = [SingleTestResult(test, start_date_ms, duration_ms)]
           self.test_results.ok += result
       # Catch exceptions thrown by StartInstrumentation().
       # See ../../third_party/android/testrunner/adb_interface.py
       except (errors.WaitForResponseTimedOutError,
               errors.DeviceUnresponsiveError,
               errors.InstrumentationError), e:
         if start_date_ms:
           duration_ms = int(time.time()) * 1000 - start_date_ms
         else:
           start_date_ms = int(time.time()) * 1000
           duration_ms = 0
         message = str(e)
         if not message:
           message = 'No information.'
         self.test_results.crashed += [SingleTestResult(test, start_date_ms,
                                                        duration_ms,
-                                                       JAVA, message,
-                                                       (message, message))]
+                                                       message)]
         test_result = None
       self.TestTeardown(test, test_result)
     return self.test_results
 
 
 class TestSharder(BaseTestSharder):
   """Responsible for sharding the tests on the connected devices."""
 
@@ -580,18 +577,15 @@ def DispatchJavaTests(options, apks):
 
   if not attached_devices:
     raise FatalTestException('You have no devices attached or visible!')
   if options.device:
     attached_devices = [options.device]
 
   logging.info('Will run: %s', str(tests))
 
-  if (len(attached_devices) > 1 and
-      not coverage and
-      not options.wait_for_debugger):
-    sharder = TestSharder(attached_devices, options, tests, apks)
-    test_results = sharder.RunShardedTests()
-  else:
-    runner = TestRunner(options, attached_devices[0], tests, coverage, 0, apks,
-                        [])
-    test_results = runner.Run()
+  if len(attached_devices) > 1 and (coverage or options.wait_for_debugger):
+    logging.warning('Coverage / debugger can not be sharded, '
+                    'using first available device')
+    attached_devices = attached_devices[:1]
+  sharder = TestSharder(attached_devices, options, tests, apks)
+  test_results = sharder.RunShardedTests()
   return test_results
--- a/media/webrtc/trunk/build/android/pylib/run_python_tests.py
+++ b/media/webrtc/trunk/build/android/pylib/run_python_tests.py
@@ -85,45 +85,27 @@ def DispatchPythonTests(options):
   for device_id in attached_devices:
     logging.debug('Pushing files to device %s', device_id)
     apks = [apk_info.ApkInfo(options.test_apk_path, options.test_apk_jar_path)]
     test_files_copier = run_java_tests.TestRunner(options, device_id,
                                                   None, False, 0, apks, [])
     test_files_copier.CopyTestFilesOnce()
 
   # Actually run the tests.
-  if (len(attached_devices) > 1 and
-      not options.wait_for_debugger):
-    logging.debug('Sharding Python tests.')
-    sharder = PythonTestSharder(attached_devices, options.shard_retries,
-                                available_tests)
-    test_results = sharder.RunShardedTests()
-  else:
-    logging.debug('Running Python tests serially.')
-    test_results = _RunPythonTests(available_tests, attached_devices[0])
+  if len(attached_devices) > 1 and options.wait_for_debugger:
+    logging.warning('Debugger can not be sharded, '
+                    'using first available device')
+    attached_devices = attached_devices[:1]
+  logging.debug('Running Python tests')
+  sharder = PythonTestSharder(attached_devices, available_tests, options)
+  test_results = sharder.RunShardedTests()
 
   return test_results
 
 
-def _RunPythonTests(tests_to_run, device_id):
-  """Runs a list of Python tests serially on one device and returns results.
-
-  Args:
-    tests_to_run: a list of objects inheriting from PythonTestBase.
-    device_id: ID of the device to run tests on.
-
-  Returns:
-    A list of test results, aggregated across all the tests run.
-  """
-  # This is a list of TestResults objects.
-  results = [CallPythonTest(t, device_id, 0) for t in tests_to_run]
-  # Merge the list of TestResults into one TestResults.
-  return TestResults.FromTestResults(results)
-
-
 def _GetTestModules(python_test_root, is_official_build):
   """Retrieve a sorted list of pythonDrivenTests.
 
   Walks the location of pythonDrivenTests, imports them, and provides the list
   of imported modules to the caller.
 
   Args:
     python_test_root: the path to walk, looking for pythonDrivenTests
--- a/media/webrtc/trunk/build/android/pylib/sharded_tests_queue.py
+++ b/media/webrtc/trunk/build/android/pylib/sharded_tests_queue.py
@@ -18,17 +18,16 @@ class ShardedTestsQueue(object):
     tests: a list of tests to be run.
     tests_queue: if sharding, a JoinableQueue object that holds tests from
         |tests|. Otherwise, a list holding tests.
     results_queue: a Queue object to hold TestResults objects.
   """
   _STOP_SENTINEL = 'STOP'  # sentinel value for iter()
 
   def __init__(self, num_devices, tests):
-    assert num_devices > 1, 'At least two devices must be attached.'
     self.num_devices = num_devices
     self.tests_queue = multiprocessing.Queue()
     for test in tests:
       self.tests_queue.put(test)
     for _ in xrange(self.num_devices):
       self.tests_queue.put(ShardedTestsQueue._STOP_SENTINEL)
 
   def __iter__(self):
--- a/media/webrtc/trunk/build/android/pylib/single_test_runner.py
+++ b/media/webrtc/trunk/build/android/pylib/single_test_runner.py
@@ -5,16 +5,17 @@
 import glob
 import logging
 import os
 import sys
 
 from base_test_runner import BaseTestRunner
 import debug_info
 import constants
+import perf_tests_helper
 import run_tests_helper
 from test_package_apk import TestPackageApk
 from test_package_executable import TestPackageExecutable
 from test_result import TestResults
 
 
 class SingleTestRunner(BaseTestRunner):
   """Single test suite attached to a single device.
@@ -54,16 +55,19 @@ class SingleTestRunner(BaseTestRunner):
       self.test_package = TestPackageApk(self.adb, device,
           test_suite, timeout, rebaseline, performance_test, cleanup_test_files,
           self.tool, self.dump_debug_info)
     else:
       self.test_package = TestPackageExecutable(
           self.adb, device,
           test_suite, timeout, rebaseline, performance_test, cleanup_test_files,
           self.tool, self.dump_debug_info)
+    self._performance_test_setup = None
+    if performance_test:
+      self._performance_test_setup = perf_tests_helper.PerfTestSetup(self.adb)
 
   def _TestSuiteRequiresMockTestServer(self):
     """Returns True if the test suite requires mock test server."""
     return False
   # TODO(yfriedman): Disabled because of flakiness.
   # (self.test_package.test_suite_basename == 'unit_tests' or
   #          self.test_package.test_suite_basename == 'net_unittests' or
   #          False)
@@ -140,20 +144,16 @@ class SingleTestRunner(BaseTestRunner):
     # of the files are not relevant (some are used for browser_tests, others for
     # features not supported, etc..).
     if self.test_package.test_suite_basename in ['base_unittests',
                                                  'sql_unittests',
                                                  'unit_tests']:
       test_files = [
           'base/data/file_util_unittest',
           'base/data/json/bom_feff.json',
-          'net/data/cache_tests/insert_load1',
-          'net/data/cache_tests/dirty_entry5',
-          'net/data/ssl/certificates/',
-          'ui/base/test/data/data_pack_unittest',
           'chrome/test/data/download-test1.lib',
           'chrome/test/data/extensions/bad_magic.crx',
           'chrome/test/data/extensions/good.crx',
           'chrome/test/data/extensions/icon1.png',
           'chrome/test/data/extensions/icon2.png',
           'chrome/test/data/extensions/icon3.png',
           'chrome/test/data/extensions/allow_silent_upgrade/',
           'chrome/test/data/extensions/app/',
@@ -176,16 +176,21 @@ class SingleTestRunner(BaseTestRunner):
           'chrome/test/data/serializer_test.js',
           'chrome/test/data/serializer_test_nowhitespace.js',
           'chrome/test/data/top_sites/',
           'chrome/test/data/web_app_info/',
           'chrome/test/data/web_database',
           'chrome/test/data/webui/',
           'chrome/test/data/zip',
           'chrome/third_party/mock4js/',
+          'content/browser/gpu/software_rendering_list.json',
+          'net/data/cache_tests/insert_load1',
+          'net/data/cache_tests/dirty_entry5',
+          'net/data/ssl/certificates/',
+          'ui/base/test/data/data_pack_unittest',
         ]
       if self.test_package.test_suite_basename == 'unit_tests':
         test_files += ['chrome/test/data/simple_open_search.xml']
         # The following are spell check data. Now only list the data under
         # third_party/hunspell_dictionaries which are used by unit tests.
         old_cwd = os.getcwd()
         os.chdir(constants.CHROME_DIR)
         test_files += glob.glob('third_party/hunspell_dictionaries/*.bdic')
@@ -220,17 +225,17 @@ class SingleTestRunner(BaseTestRunner):
           raise Exception('Page cycler data not found.')
       return data
     elif self.test_package.test_suite_basename == 'webkit_unit_tests':
       return [
           'third_party/WebKit/Source/WebKit/chromium/tests/data',
           ]
     elif self.test_package.test_suite_basename == 'content_unittests':
       return [
-          'chrome/test/gpu/webgl_conformance_test_expectations.txt',
+          'content/test/data/gpu/webgl_conformance_test_expectations.txt',
           'net/data/ssl/certificates/',
           'webkit/data/dom_storage/webcore_test_database.localstorage',
           'third_party/hyphen/hyph_en_US.dic',
           ]
     elif self.test_package.test_suite_basename == 'media_unittests':
       return [
           'media/test/data',
           ]
@@ -247,23 +252,20 @@ class SingleTestRunner(BaseTestRunner):
 
   def StripAndCopyFiles(self):
     """Strips and copies the required data files for the test suite."""
     self.test_package.StripAndCopyExecutable()
     self.test_package.PushDataAndPakFiles()
     self.tool.CopyFiles()
     test_data = self.GetDataFilesForTestSuite()
     if test_data and not self.fast_and_loose:
-      # Due to the large size of certain test data, we use sdcard to store the
-      # test data and create symbolic links to map them to data/local/tmp/.
-      # Before that, make sure SD card is ready.
+      # Make sure SD card is ready.
       self.adb.WaitForSdCardReady(20)
       for data in test_data:
-        self.CopyTestData([data], '/sdcard/')
-      self.LinkSdCardPathsToTempDir(test_data)
+        self.CopyTestData([data], self.adb.GetExternalStorage())
 
   def RunTestsWithFilter(self):
     """Runs a tests via a small, temporary shell script."""
     self.test_package.CreateTestRunnerScript(self._gtest_filter,
                                              self._test_arguments)
     self.test_results = self.test_package.RunTestsAndListResults()
 
   def RebaselineTests(self):
@@ -314,28 +316,28 @@ class SingleTestRunner(BaseTestRunner):
                                      self.test_package.GetDisabledPrefixes()]))
       self.RunTestsWithFilter()
     return self.test_results
 
   def SetUp(self):
     """Sets up necessary test enviroment for the test suite."""
     super(SingleTestRunner, self).SetUp()
     self.adb.ClearApplicationState(constants.CHROME_PACKAGE)
-    if self.test_package.performance_test:
-      self.adb.SetupPerformanceTest()
+    if self._performance_test_setup:
+      self._performance_test_setup.SetUp()
     if self.dump_debug_info:
       self.dump_debug_info.StartRecordingLog(True)
     self.StripAndCopyFiles()
     self.LaunchHelperToolsForTestSuite()
     self.tool.SetupEnvironment()
 
   def TearDown(self):
     """Cleans up the test enviroment for the test suite."""
     self.tool.CleanUpEnvironment()
     if self.test_package.cleanup_test_files:
       self.adb.RemovePushedFiles()
     if self.dump_debug_info:
       self.dump_debug_info.StopRecordingLog()
-    if self.test_package.performance_test:
-      self.adb.TearDownPerformanceTest()
+    if self._performance_test_setup:
+      self._performance_test_setup.TearDown()
     if self.dump_debug_info:
       self.dump_debug_info.ArchiveNewCrashFiles()
     super(SingleTestRunner, self).TearDown()
--- a/media/webrtc/trunk/build/android/pylib/test_options_parser.py
+++ b/media/webrtc/trunk/build/android/pylib/test_options_parser.py
@@ -2,37 +2,47 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """Parses options for the instrumentation tests."""
 
 import constants
 import optparse
 import os
+import sys
 
 _SDK_OUT_DIR = os.path.join(constants.CHROME_DIR, 'out')
 
 
 def AddBuildTypeOption(option_parser):
+  """Decorates OptionParser with build type option."""
   default_build_type = 'Debug'
   if 'BUILDTYPE' in os.environ:
     default_build_type = os.environ['BUILDTYPE']
   option_parser.add_option('--debug', action='store_const', const='Debug',
                            dest='build_type', default=default_build_type,
                            help='If set, run test suites under out/Debug. '
                                 'Default is env var BUILDTYPE or Debug')
   option_parser.add_option('--release', action='store_const', const='Release',
                            dest='build_type',
                            help='If set, run test suites under out/Release. '
                                 'Default is env var BUILDTYPE or Debug.')
 
+def AddInstallAPKOption(option_parser):
+  """Decorates OptionParser with apk option used to install the APK."""
+  option_parser.add_option('--apk',
+                           help=('The name of the apk containing the '
+                                 ' application (with the .apk extension).'))
+  option_parser.add_option('--apk_package',
+                           help=('The package name used by the apk containing '
+                                 'the application.'))
 
-def CreateTestRunnerOptionParser(usage=None, default_timeout=60):
-  """Returns a new OptionParser with arguments applicable to all tests."""
-  option_parser = optparse.OptionParser(usage=usage)
+def AddTestRunnerOptions(option_parser, default_timeout=60):
+  """Decorates OptionParser with options applicable to all tests."""
+
   option_parser.add_option('-t', dest='timeout',
                            help='Timeout to wait for each test',
                            type='int',
                            default=default_timeout)
   option_parser.add_option('-c', dest='cleanup_test_files',
                            help='Cleanup test files on the device after run',
                            action='store_true')
   option_parser.add_option('-v',
@@ -48,23 +58,22 @@ def CreateTestRunnerOptionParser(usage=N
                            help='Profiling tool to run during test. '
                            'Pass multiple times to run multiple profilers. '
                            'Available profilers: %s' % profilers)
   option_parser.add_option('--tool',
                            dest='tool',
                            help='Run the test under a tool '
                            '(use --tool help to list them)')
   AddBuildTypeOption(option_parser)
-  return option_parser
 
 
-def ParseInstrumentationArgs(args):
-  """Parse arguments and return options with defaults."""
+def AddInstrumentationOptions(option_parser):
+  """Decorates OptionParser with instrumentation tests options."""
 
-  option_parser = CreateTestRunnerOptionParser()
+  AddTestRunnerOptions(option_parser)
   option_parser.add_option('-w', '--wait_debugger', dest='wait_for_debugger',
                            action='store_true', help='Wait for debugger.')
   option_parser.add_option('-I', dest='install_apk', help='Install APK.',
                            action='store_true')
   option_parser.add_option('-f', '--test_filter',
                            help='Test filter (if not fully qualified, '
                            'will run all matches).')
   option_parser.add_option('-A', '--annotation', dest='annotation_str',
@@ -79,55 +88,56 @@ def ParseInstrumentationArgs(args):
   option_parser.add_option('-p', '--python_only', action='store_true',
                            help='Run only the Python tests.')
   option_parser.add_option('-n', '--run_count', type='int',
                            dest='number_of_runs', default=1,
                            help=('How many times to run each test, regardless '
                                  'of the result. (Default is 1)'))
   option_parser.add_option('--test-apk', dest='test_apk',
                            help=('The name of the apk containing the tests '
-                                 '(without the .apk extension) or for SDK '
-                                 'builds, the path to the APK from '
-                                 'out/(Debug|Release) (for example, '
-                                 'content_shell_test/ContentShellTest-debug).'))
+                                 '(without the .apk extension). For SDK '
+                                 'builds, the apk name without the debug '
+                                 'suffix(for example, ContentShellTest).'))
   option_parser.add_option('--screenshot', dest='screenshot_failures',
                            action='store_true',
                            help='Capture screenshots of test failures')
   option_parser.add_option('--save-perf-json', action='store_true',
                            help='Saves the JSON file for each UI Perf test.')
   option_parser.add_option('--shard_retries', type=int, default=1,
                            help=('Number of times to retry each failure when '
                                  'sharding.'))
   option_parser.add_option('--official-build', help='Run official build tests.')
   option_parser.add_option('--device',
                            help='Serial number of device we should use.')
   option_parser.add_option('--python_test_root',
                            help='Root of the python-driven tests.')
 
-  options, args = option_parser.parse_args(args)
+def ValidateInstrumentationOptions(option_parser, options, args):
+  """Validate options/arguments and populate options with defaults."""
   if len(args) > 1:
-    option_parser.error('Unknown argument:', args[1:])
+    option_parser.print_help(sys.stderr)
+    option_parser.error('Unknown arguments: %s' % args[1:])
   if options.java_only and options.python_only:
     option_parser.error('Options java_only (-j) and python_only (-p) '
-                        'are mutually exclusive')
+                        'are mutually exclusive.')
 
   options.run_java_tests = True
   options.run_python_tests = True
   if options.java_only:
     options.run_python_tests = False
   elif options.python_only:
     options.run_java_tests = False
 
+  # In case of SDK Build, the jars and apks have a -debug suffix.
   options.test_apk_path = os.path.join(_SDK_OUT_DIR,
                                        options.build_type,
-                                       '%s.apk' % options.test_apk)
+                                       constants.SDK_BUILD_APKS_DIR,
+                                       '%s-debug.apk' % options.test_apk)
   options.test_apk_jar_path = os.path.join(_SDK_OUT_DIR,
                                            options.build_type,
-                                           '%s.jar'
-                                           % options.test_apk)
+                                           constants.SDK_BUILD_TEST_JAVALIB_DIR,
+                                           '%s-debug.jar' % options.test_apk)
   if options.annotation_str:
     options.annotation = options.annotation_str.split()
   elif options.test_filter:
     options.annotation = []
   else:
     options.annotation = ['Smoke', 'SmallTest', 'MediumTest', 'LargeTest']
-
-  return options
--- a/media/webrtc/trunk/build/android/pylib/test_package.py
+++ b/media/webrtc/trunk/build/android/pylib/test_package.py
@@ -1,19 +1,20 @@
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 
 import logging
 import re
 import os
-import pexpect
 
+import constants
 from perf_tests_helper import PrintPerfResult
+from pylib import pexpect
 from test_result import BaseTestResult, TestResults
 
 
 # TODO(bulach): TestPackage, TestPackageExecutable and
 # TestPackageApk are a work in progress related to making the native tests
 # run as a NDK-app from an APK rather than a stand-alone executable.
 class TestPackage(object):
   """A helper base class for both APK and stand-alone executables.
@@ -33,17 +34,17 @@ class TestPackage(object):
   def __init__(self, adb, device, test_suite, timeout, rebaseline,
                performance_test, cleanup_test_files, tool, dump_debug_info):
     self.adb = adb
     self.device = device
     self.test_suite_full = test_suite
     self.test_suite = os.path.splitext(test_suite)[0]
     self.test_suite_basename = self._GetTestSuiteBaseName()
     self.test_suite_dirname = os.path.dirname(
-        self.test_suite.split(self.test_suite_basename)[0]);
+        self.test_suite.split(self.test_suite_basename)[0])
     self.rebaseline = rebaseline
     self.performance_test = performance_test
     self.cleanup_test_files = cleanup_test_files
     self.tool = tool
     if timeout == 0:
       timeout = 60
     # On a VM (e.g. chromium buildbots), this timeout is way too small.
     if os.environ.get('BUILDBOT_SLAVENAME'):
@@ -90,105 +91,105 @@ class TestPackage(object):
 
   def _ParseGTestListTests(self, all_tests):
     ret = []
     current = ''
     disabled_prefixes = self.GetDisabledPrefixes()
     for test in all_tests:
       if not test:
         continue
+      if test[0] != ' ' and not test.endswith('.'):
+        # Ignore any lines with unexpected format.
+        continue
       if test[0] != ' ' and test.endswith('.'):
         current = test
         continue
       if 'YOU HAVE' in test:
         break
       test_name = test[2:]
       if not any([test_name.startswith(x) for x in disabled_prefixes]):
         ret += [current + test_name]
     return ret
 
   def PushDataAndPakFiles(self):
+    external_storage = self.adb.GetExternalStorage()
     if (self.test_suite_basename == 'ui_unittests' or
         self.test_suite_basename == 'unit_tests'):
       self.adb.PushIfNeeded(
           self.test_suite_dirname + '/chrome.pak',
-          '/data/local/tmp/paks/chrome.pak')
+          external_storage + '/paks/chrome.pak')
       self.adb.PushIfNeeded(
           self.test_suite_dirname + '/locales/en-US.pak',
-          '/data/local/tmp/paks/en-US.pak')
+          external_storage + '/paks/en-US.pak')
     if self.test_suite_basename == 'unit_tests':
       self.adb.PushIfNeeded(
           self.test_suite_dirname + '/resources.pak',
-          '/data/local/tmp/paks/resources.pak')
+          external_storage + '/paks/resources.pak')
       self.adb.PushIfNeeded(
           self.test_suite_dirname + '/chrome_100_percent.pak',
-          '/data/local/tmp/paks/chrome_100_percent.pak')
+          external_storage + '/paks/chrome_100_percent.pak')
       self.adb.PushIfNeeded(self.test_suite_dirname + '/test_data',
-                            '/data/local/tmp/test_data')
+                            external_storage + '/test_data')
     if self.test_suite_basename == 'content_unittests':
       self.adb.PushIfNeeded(
           self.test_suite_dirname + '/content_resources.pak',
-          '/data/local/tmp/paks/content_resources.pak')
+          external_storage + '/paks/content_resources.pak')
 
   def _WatchTestOutput(self, p):
     """Watches the test output.
     Args:
       p: the process generating output as created by pexpect.spawn.
     """
     ok_tests = []
     failed_tests = []
     crashed_tests = []
     timed_out = False
     overall_fail = False
     re_run = re.compile('\[ RUN      \] ?(.*)\r\n')
-    # APK tests rely on the END tag.
-    re_end = re.compile('\[ END      \] ?(.*)\r\n')
+    # APK tests rely on the PASSED tag.
+    re_passed = re.compile('\[  PASSED  \] ?(.*)\r\n')
     # Signal handlers are installed before starting tests
     # to output the CRASHED marker when a crash happens.
     re_crash = re.compile('\[ CRASHED      \](.*)\r\n')
     re_fail = re.compile('\[  FAILED  \] ?(.*)\r\n')
     re_runner_fail = re.compile('\[ RUNNER_FAILED \] ?(.*)\r\n')
-    re_ok = re.compile('\[       OK \] ?(.*)\r\n')
+    re_ok = re.compile('\[       OK \] ?(.*?) .*\r\n')
     io_stats_before = self._BeginGetIOStats()
-    while True:
-      found = p.expect([re_run, pexpect.EOF, re_end, re_runner_fail],
-                       timeout=self.timeout)
-      if found == 1:  # matched pexpect.EOF
-        break
-      if found == 2:  # matched END.
-        break
-      if found == 3:  # RUNNER_FAILED
-        logging.error('RUNNER_FAILED')
-        overall_fail = True
-        break
-      if self.dump_debug_info:
-        self.dump_debug_info.TakeScreenshot('_Test_Start_Run_')
-      full_test_name = p.match.group(1)
-      found = p.expect([re_ok, re_fail, re_crash, pexpect.EOF, pexpect.TIMEOUT],
-                       timeout=self.timeout)
-      if found == 0:  # re_ok
-        ok_tests += [BaseTestResult(full_test_name.replace('\r', ''),
-                                    p.before)]
-        continue
-      if found == 2: # re_crash
-        crashed_tests += [BaseTestResult(full_test_name.replace('\r', ''),
-                                         p.before)]
-        overall_fail = True
-        break
-      # The test failed.
-      failed_tests += [BaseTestResult(full_test_name.replace('\r', ''),
-                                      p.before)]
-      if found >= 3:
-        # The test bailed out (i.e., didn't print OK or FAIL).
-        if found == 4:  # pexpect.TIMEOUT
-          logging.error('Test terminated after %d second timeout.',
-                        self.timeout)
-          timed_out = True
-        break
-    p.close()
+    try:
+      while True:
+        found = p.expect([re_run, re_passed, re_runner_fail],
+                         timeout=self.timeout)
+        if found == 1:  # matched PASSED.
+          break
+        if found == 2:  # RUNNER_FAILED
+          logging.error('RUNNER_FAILED')
+          overall_fail = True
+          break
+        if self.dump_debug_info:
+          self.dump_debug_info.TakeScreenshot('_Test_Start_Run_')
+        full_test_name = p.match.group(1).replace('\r', '')
+        found = p.expect([re_ok, re_fail, re_crash], timeout=self.timeout)
+        if found == 0:  # re_ok
+          if full_test_name == p.match.group(1).replace('\r', ''):
+            ok_tests += [BaseTestResult(full_test_name, p.before)]
+            continue
+        if found == 2: # re_crash
+          crashed_tests += [BaseTestResult(full_test_name, p.before)]
+          overall_fail = True
+          break
+        # The test failed.
+        failed_tests += [BaseTestResult(full_test_name, p.before)]
+    except pexpect.EOF:
+      logging.error('Test terminated - EOF')
+    except pexpect.TIMEOUT:
+      logging.error('Test terminated after %d second timeout.',
+                    self.timeout)
+      timed_out = True
+    finally:
+      p.close()
     if not self.rebaseline:
       ok_tests += self._EndGetIOStats(io_stats_before)
       ret_code = self._GetGTestReturnCode()
       if ret_code:
         failed_tests += [BaseTestResult('gtest exit code: %d' % ret_code,
                                         'pexpect.before: %s'
                                         '\npexpect.after: %s'
                                         % (p.before,
--- a/media/webrtc/trunk/build/android/pylib/test_package_apk.py
+++ b/media/webrtc/trunk/build/android/pylib/test_package_apk.py
@@ -1,103 +1,118 @@
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 
 import os
-import re
+import shlex
 import sys
+import tempfile
+import time
 
-import cmd_helper
-import logging
-import shutil
-import tempfile
+import android_commands
+import constants
 from test_package import TestPackage
-
+from pylib import pexpect
 
 class TestPackageApk(TestPackage):
   """A helper class for running APK-based native tests.
 
   Args:
     adb: ADB interface the tests are using.
     device: Device to run the tests.
     test_suite: A specific test suite to run, empty to run all.
     timeout: Timeout for each test.
     rebaseline: Whether or not to run tests in isolation and update the filter.
     performance_test: Whether or not performance test(s).
     cleanup_test_files: Whether or not to cleanup test files on device.
     tool: Name of the Valgrind tool.
     dump_debug_info: A debug_info object.
   """
 
-  # The stdout.txt path is determined by:
-  # testing/android/java/src/org/chromium/native_test/
-  #     ChromeNativeTestActivity.java
-  APK_STDOUT_FILE = '/sdcard/native_tests/stdout.txt'
-
   def __init__(self, adb, device, test_suite, timeout, rebaseline,
                performance_test, cleanup_test_files, tool,
                dump_debug_info):
     TestPackage.__init__(self, adb, device, test_suite, timeout,
                          rebaseline, performance_test, cleanup_test_files,
                          tool, dump_debug_info)
 
   def _CreateTestRunnerScript(self, options):
     command_line_file = tempfile.NamedTemporaryFile()
     # GTest expects argv[0] to be the executable path.
     command_line_file.write(self.test_suite_basename + ' ' + options)
     command_line_file.flush()
     self.adb.PushIfNeeded(command_line_file.name,
-                          '/data/local/tmp/' +
-                          'chrome-native-tests-command-line')
+                          constants.TEST_EXECUTABLE_DIR +
+                          '/chrome-native-tests-command-line')
 
   def _GetGTestReturnCode(self):
     return None
 
+  def _GetFifo(self):
+    # The test.fifo path is determined by:
+    # testing/android/java/src/org/chromium/native_test/
+    #     ChromeNativeTestActivity.java and
+    # testing/android/native_test_launcher.cc
+    return '/data/data/org.chromium.native_test/files/test.fifo'
+
+  def _ClearFifo(self):
+    self.adb.RunShellCommand('rm -f ' + self._GetFifo())
+
+  def _WatchFifo(self, timeout, logfile=None):
+    for i in range(10):
+      if self.adb.FileExistsOnDevice(self._GetFifo()):
+        print 'Fifo created...'
+        break
+      time.sleep(i)
+    else:
+      raise Exception('Unable to find fifo on device %s ' % self._GetFifo())
+    args = shlex.split(self.adb.Adb()._target_arg)
+    args += ['shell', 'cat', self._GetFifo()]
+    return pexpect.spawn('adb', args, timeout=timeout, logfile=logfile)
+
   def GetAllTests(self):
     """Returns a list of all tests available in the test suite."""
     self._CreateTestRunnerScript('--gtest_list_tests')
     try:
       self.tool.SetupEnvironment()
       # Clear and start monitoring logcat.
-      self.adb.StartMonitoringLogcat(clear=True,
-                                     timeout=30 * self.tool.GetTimeoutScale())
+      self._ClearFifo()
       self.adb.RunShellCommand(
           'am start -n '
           'org.chromium.native_test/'
           'org.chromium.native_test.ChromeNativeTestActivity')
       # Wait for native test to complete.
-      self.adb.WaitForLogMatch(re.compile('<<nativeRunTests'), None)
+      p = self._WatchFifo(timeout=30 * self.tool.GetTimeoutScale())
+      p.expect("<<ScopedMainEntryLogger")
+      p.close()
     finally:
       self.tool.CleanUpEnvironment()
-    # Copy stdout.txt and read contents.
-    stdout_file = tempfile.NamedTemporaryFile()
-    ret = []
-    self.adb.Adb().Pull(TestPackageApk.APK_STDOUT_FILE, stdout_file.name)
     # We need to strip the trailing newline.
-    content = [line.rstrip() for line in open(stdout_file.name)]
+    content = [line.rstrip() for line in p.before.splitlines()]
     ret = self._ParseGTestListTests(content)
     return ret
 
   def CreateTestRunnerScript(self, gtest_filter, test_arguments):
-     self._CreateTestRunnerScript('--gtest_filter=%s %s' % (gtest_filter,
-                                                            test_arguments))
+    self._CreateTestRunnerScript('--gtest_filter=%s %s' % (gtest_filter,
+                                                           test_arguments))
 
   def RunTestsAndListResults(self):
-    self.adb.StartMonitoringLogcat(clear=True, logfile=sys.stdout)
     try:
       self.tool.SetupEnvironment()
+      self._ClearFifo()
       self.adb.RunShellCommand(
        'am start -n '
         'org.chromium.native_test/'
         'org.chromium.native_test.ChromeNativeTestActivity')
     finally:
       self.tool.CleanUpEnvironment()
-    return self._WatchTestOutput(self.adb.GetMonitoredLogCat())
+    logfile = android_commands.NewLineNormalizer(sys.stdout)
+    return self._WatchTestOutput(self._WatchFifo(timeout=10, logfile=logfile))
 
   def StripAndCopyExecutable(self):
     # Always uninstall the previous one (by activity name); we don't
     # know what was embedded in it.
     self.adb.ManagedInstall(self.test_suite_full, False,
                             package_name='org.chromium.native_test')
 
   def _GetTestSuiteBaseName(self):
--- a/media/webrtc/trunk/build/android/pylib/test_package_executable.py
+++ b/media/webrtc/trunk/build/android/pylib/test_package_executable.py
@@ -1,28 +1,29 @@
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 
 import logging
 import os
-import pexpect
 import shutil
 import sys
 import tempfile
 
 import cmd_helper
+import constants
 from test_package import TestPackage
+from pylib import pexpect
 
 
 class TestPackageExecutable(TestPackage):
   """A helper class for running stand-alone executables."""
 
-  _TEST_RUNNER_RET_VAL_FILE = '/data/local/tmp/gtest_retval'
+  _TEST_RUNNER_RET_VAL_FILE = 'gtest_retval'
 
   def __init__(self, adb, device, test_suite, timeout, rebaseline,
                performance_test, cleanup_test_files, tool, dump_debug_info,
                symbols_dir=None):
     """
     Args:
       adb: ADB interface the tests are using.
       device: Device to run the tests.
@@ -42,17 +43,19 @@ class TestPackageExecutable(TestPackage)
     self.symbols_dir = symbols_dir
 
   def _GetGTestReturnCode(self):
     ret = None
     ret_code = 1  # Assume failure if we can't find it
     ret_code_file = tempfile.NamedTemporaryFile()
     try:
       if not self.adb.Adb().Pull(
-          TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE, ret_code_file.name):
+          self.adb.GetExternalStorage() + '/' +
+          TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE,
+          ret_code_file.name):
         logging.critical('Unable to pull gtest ret val file %s',
                          ret_code_file.name)
         raise ValueError
       ret_code = file(ret_code_file.name).read()
       ret = int(ret_code)
     except ValueError:
       logging.critical('Error reading gtest ret val file %s [%s]',
                        ret_code_file.name, ret_code)
@@ -68,62 +71,68 @@ class TestPackageExecutable(TestPackage)
     # Ex: /usr/local/google/code/chrome will become
     #     /code/chrome if GCOV_PREFIX_STRIP=3
     try:
       depth = os.environ['NATIVE_COVERAGE_DEPTH_STRIP']
     except KeyError:
       logging.info('NATIVE_COVERAGE_DEPTH_STRIP is not defined: '
                    'No native coverage.')
       return ''
-    export_string = 'export GCOV_PREFIX="/data/local/tmp/gcov"\n'
+    export_string = ('export GCOV_PREFIX="%s/gcov"\n' %
+                     self.adb.GetExternalStorage())
     export_string += 'export GCOV_PREFIX_STRIP=%s\n' % depth
     return export_string
 
   def GetAllTests(self):
     """Returns a list of all tests available in the test suite."""
     all_tests = self.adb.RunShellCommand(
-        '%s /data/local/tmp/%s --gtest_list_tests' %
-        (self.tool.GetTestWrapper(), self.test_suite_basename))
+        '%s %s/%s --gtest_list_tests' %
+        (self.tool.GetTestWrapper(),
+         constants.TEST_EXECUTABLE_DIR,
+         self.test_suite_basename))
     return self._ParseGTestListTests(all_tests)
 
   def CreateTestRunnerScript(self, gtest_filter, test_arguments):
     """Creates a test runner script and pushes to the device.
 
     Args:
       gtest_filter: A gtest_filter flag.
       test_arguments: Additional arguments to pass to the test binary.
     """
     tool_wrapper = self.tool.GetTestWrapper()
     sh_script_file = tempfile.NamedTemporaryFile()
     # We need to capture the exit status from the script since adb shell won't
     # propagate to us.
-    sh_script_file.write('cd /data/local/tmp\n'
+    sh_script_file.write('cd %s\n'
                          '%s'
-                         '%s /data/local/tmp/%s --gtest_filter=%s %s\n'
+                         '%s %s/%s --gtest_filter=%s %s\n'
                          'echo $? > %s' %
-                         (self._AddNativeCoverageExports(),
-                          tool_wrapper, self.test_suite_basename,
+                         (constants.TEST_EXECUTABLE_DIR,
+                          self._AddNativeCoverageExports(),
+                          tool_wrapper, constants.TEST_EXECUTABLE_DIR,
+                          self.test_suite_basename,
                           gtest_filter, test_arguments,
                           TestPackageExecutable._TEST_RUNNER_RET_VAL_FILE))
     sh_script_file.flush()
     cmd_helper.RunCmd(['chmod', '+x', sh_script_file.name])
-    self.adb.PushIfNeeded(sh_script_file.name,
-                          '/data/local/tmp/chrome_test_runner.sh')
+    self.adb.PushIfNeeded(
+            sh_script_file.name,
+            constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh')
     logging.info('Conents of the test runner script: ')
     for line in open(sh_script_file.name).readlines():
       logging.info('  ' + line.rstrip())
 
   def RunTestsAndListResults(self):
     """Runs all the tests and checks for failures.
 
     Returns:
       A TestResults object.
     """
     args = ['adb', '-s', self.device, 'shell', 'sh',
-            '/data/local/tmp/chrome_test_runner.sh']
+            constants.TEST_EXECUTABLE_DIR + '/chrome_test_runner.sh']
     logging.info(args)
     p = pexpect.spawn(args[0], args[1:], logfile=sys.stdout)
     return self._WatchTestOutput(p)
 
   def StripAndCopyExecutable(self):
     """Strips and copies the executable to the device."""
     if self.tool.NeedsDebugInfo():
       target_name = self.test_suite
@@ -145,14 +154,14 @@ class TestPackageExecutable(TestPackage)
         # Whenever we generate a stripped binary, copy to the symbols dir. If we
         # aren't stripping a new binary, assume it's there.
         if self.symbols_dir:
           if not os.path.exists(self.symbols_dir):
             os.makedirs(self.symbols_dir)
           shutil.copy(self.test_suite, self.symbols_dir)
         strip = os.environ['STRIP']
         cmd_helper.RunCmd([strip, self.test_suite, '-o', target_name])
-    test_binary = '/data/local/tmp/' + self.test_suite_basename
+    test_binary = constants.TEST_EXECUTABLE_DIR + '/' + self.test_suite_basename
     self.adb.PushIfNeeded(target_name, test_binary)
 
   def _GetTestSuiteBaseName(self):
     """Returns the  base name of the test suite."""
     return os.path.basename(self.test_suite)
--- a/media/webrtc/trunk/build/android/pylib/test_result.py
+++ b/media/webrtc/trunk/build/android/pylib/test_result.py
@@ -4,58 +4,49 @@
 
 
 import json
 import logging
 import os
 import time
 import traceback
 
+import buildbot_report
 import constants
 
 
-# Language values match constants in Sponge protocol buffer (sponge.proto).
-JAVA = 5
-PYTHON = 7
-
-
 class BaseTestResult(object):
   """A single result from a unit test."""
 
   def __init__(self, name, log):
     self.name = name
-    self.log = log
+    self.log = log.replace('\r', '')
 
 
 class SingleTestResult(BaseTestResult):
   """Result information for a single test.
 
   Args:
     full_name: Full name of the test.
     start_date: Date in milliseconds when the test began running.
     dur: Duration of the test run in milliseconds.
-    lang: Language of the test (JAVA or PYTHON).
     log: An optional string listing any errors.
-    error: A tuple of a short error message and a longer version used by Sponge
-    if test resulted in a fail or error.  An empty tuple implies a pass.
   """
 
-  def __init__(self, full_name, start_date, dur, lang, log='', error=()):
+  def __init__(self, full_name, start_date, dur, log=''):
     BaseTestResult.__init__(self, full_name, log)
     name_pieces = full_name.rsplit('#')
     if len(name_pieces) > 1:
       self.test_name = name_pieces[1]
       self.class_name = name_pieces[0]
     else:
       self.class_name = full_name
       self.test_name = full_name
     self.start_date = start_date
     self.dur = dur
-    self.error = error
-    self.lang = lang
 
 
 class TestResults(object):
   """Results of a test run."""
 
   def __init__(self):
     self.ok = []
     self.failed = []
@@ -107,19 +98,17 @@ class TestResults(object):
                                                     exc_traceback))
     log_msg = 'Exception:\n' + trace_info
     duration_ms = (int(time.time()) * 1000) - start_date_ms
 
     exc_result = SingleTestResult(
                      full_name='PythonWrapper#' + test_name,
                      start_date=start_date_ms,
                      dur=duration_ms,
-                     lang=PYTHON,
-                     log=log_msg,
-                     error=(str(exc_type), log_msg))
+                     log=(str(exc_type) + ' ' + log_msg))
 
     results = TestResults()
     results.failed.append(exc_result)
     return results
 
   def _Log(self, sorted_list):
     for t in sorted_list:
       logging.critical(t.name)
@@ -188,8 +177,17 @@ class TestResults(object):
     summary_string += 'FAILED=%d %s\n' % (len(self.failed),
                                           [t.name for t in self.failed])
     summary_string += 'CRASHED=%d %s\n' % (len(self.crashed),
                                            [t.name for t in self.crashed])
     summary_string += 'UNKNOWN=%d %s\n' % (len(self.unknown),
                                            [t.name for t in self.unknown])
     logging.critical(summary_string)
     return summary_string
+
+  def PrintAnnotation(self):
+    """Print buildbot annotations for test results."""
+    if self.timed_out:
+      buildbot_report.PrintWarning()
+    elif self.failed or self.crashed or self.overall_fail:
+      buildbot_report.PrintError()
+    else:
+      print 'Step success!'  # No annotation needed
--- a/media/webrtc/trunk/build/android/pylib/valgrind_tools.py
+++ b/media/webrtc/trunk/build/android/pylib/valgrind_tools.py
@@ -22,29 +22,40 @@ Call tool.CleanUpEnvironment().
 """
 
 import os.path
 import sys
 
 from constants import CHROME_DIR
 
 
+def SetChromeTimeoutScale(adb, scale):
+  """Sets the timeout scale in /data/local/tmp/chrome_timeout_scale to scale."""
+  path = '/data/local/tmp/chrome_timeout_scale'
+  if not scale or scale == 1.0:
+    # Delete if scale is None/0.0/1.0 since the default timeout scale is 1.0
+    adb.RunShellCommand('rm %s' % path)
+  else:
+    adb.SetFileContents(path, '%f' % scale)
+
+
 class BaseTool(object):
   """A tool that does nothing."""
 
-  def __init__(self, *args, **kwargs):
-    pass
-
   def GetTestWrapper(self):
     """Returns a string that is to be prepended to the test command line."""
     return ''
 
   def GetUtilWrapper(self):
-    """Returns a string that is to be prepended to the command line of utility
-    processes (forwarder, etc.)"""
+    """Returns the wrapper name for the utilities.
+
+    Returns:
+       A string that is to be prepended to the command line of utility
+    processes (forwarder, etc.).
+    """
     return ''
 
   def CopyFiles(self):
     """Copies tool-specific files to the device, create directories, etc."""
     pass
 
   def SetupEnvironment(self):
     """Sets up the system environment for a test.
@@ -59,125 +70,128 @@ class BaseTool(object):
 
   def GetTimeoutScale(self):
     """Returns a multiplier that should be applied to timeout values."""
     return 1.0
 
   def NeedsDebugInfo(self):
     """Whether this tool requires debug info.
 
-    Returns True if this tool can not work with stripped binaries.
+    Returns:
+      True if this tool can not work with stripped binaries.
     """
     return False
 
 
 class AddressSanitizerTool(BaseTool):
   """AddressSanitizer tool."""
 
-  WRAPPER_PATH = "/system/bin/asanwrapper"
+  WRAPPER_PATH = '/system/bin/asanwrapper'
 
   def __init__(self, adb):
-    self.adb = adb
-    self.wrap_properties = ['wrap.com.google.android.apps.ch',
-                            'wrap.org.chromium.native_test']
+    self._adb = adb
+    self._wrap_properties = ['wrap.com.google.android.apps.ch',
+                             'wrap.org.chromium.native_test']
 
   def CopyFiles(self):
     """Copies ASan tools to the device."""
     files = ['system/lib/libasan_preload.so',
              'system/bin/asanwrapper',
              'system/bin/asan/app_process',
              'system/bin/linker']
     android_product_out = os.environ['ANDROID_PRODUCT_OUT']
-    self.adb.MakeSystemFolderWritable()
+    self._adb.MakeSystemFolderWritable()
     for f in files:
-      self.adb.PushIfNeeded(os.path.join(android_product_out, f),
-                            os.path.join('/', f))
+      self._adb.PushIfNeeded(os.path.join(android_product_out, f),
+                             os.path.join('/', f))
 
   def GetTestWrapper(self):
     return AddressSanitizerTool.WRAPPER_PATH
 
   def GetUtilWrapper(self):
-    """ AddressSanitizer wrapper must be added to all instrumented binaries,
+    """Returns the wrapper for utilities, such as forwarder.
+
+    AddressSanitizer wrapper must be added to all instrumented binaries,
     including forwarder and the like. This can be removed if such binaries
     were built without instrumentation. """
     return AddressSanitizerTool.WRAPPER_PATH
 
   def SetupEnvironment(self):
-    for prop in self.wrap_properties:
-      self.adb.RunShellCommand('setprop %s "logwrapper %s"' % (
+    for prop in self._wrap_properties:
+      self._adb.RunShellCommand('setprop %s "logwrapper %s"' % (
           prop, self.GetTestWrapper()))
-    self.adb.RunShellCommand('setprop chrome.timeout_scale %f' % (
-        self.GetTimeoutScale()))
+    SetChromeTimeoutScale(self._adb, self.GetTimeoutScale())
 
   def CleanUpEnvironment(self):
-    for prop in self.wrap_properties:
-      self.adb.RunShellCommand('setprop %s ""' % (prop,))
-    self.adb.RunShellCommand('setprop chrome.timeout_scale ""')
+    for prop in self._wrap_properties:
+      self._adb.RunShellCommand('setprop %s ""' % (prop,))
+    SetChromeTimeoutScale(self._adb, None)
 
   def GetTimeoutScale(self):
     # Very slow startup.
     return 20.0
 
 
 class ValgrindTool(BaseTool):
   """Base abstract class for Valgrind tools."""
 
   VG_DIR = '/data/local/tmp/valgrind'
   VGLOGS_DIR = '/data/local/tmp/vglogs'
 
-  def __init__(self, adb, renderer=False):
-    self.adb = adb
+  def __init__(self, adb):
+    self._adb = adb
     # exactly 31 chars, SystemProperties::PROP_NAME_MAX
-    self.wrap_properties = ['wrap.com.google.android.apps.ch',
-                            'wrap.org.chromium.native_test']
+    self._wrap_properties = ['wrap.com.google.android.apps.ch',
+                             'wrap.org.chromium.native_test']
 
   def CopyFiles(self):
     """Copies Valgrind tools to the device."""
-    self.adb.RunShellCommand('rm -r %s; mkdir %s' %
-                             (ValgrindTool.VG_DIR, ValgrindTool.VG_DIR))
-    self.adb.RunShellCommand('rm -r %s; mkdir %s' %
-                             (ValgrindTool.VGLOGS_DIR, ValgrindTool.VGLOGS_DIR))
+    self._adb.RunShellCommand('rm -r %s; mkdir %s' %
+                              (ValgrindTool.VG_DIR, ValgrindTool.VG_DIR))
+    self._adb.RunShellCommand('rm -r %s; mkdir %s' %
+                              (ValgrindTool.VGLOGS_DIR,
+                               ValgrindTool.VGLOGS_DIR))
     files = self.GetFilesForTool()
     for f in files:
-      self.adb.PushIfNeeded(os.path.join(CHROME_DIR, f),
-                            os.path.join(ValgrindTool.VG_DIR,
-                                         os.path.basename(f)))
+      self._adb.PushIfNeeded(os.path.join(CHROME_DIR, f),
+                             os.path.join(ValgrindTool.VG_DIR,
+                                          os.path.basename(f)))
 
   def SetupEnvironment(self):
     """Sets up device environment."""
-    self.adb.RunShellCommand('chmod 777 /data/local/tmp')
-    for prop in self.wrap_properties:
-      self.adb.RunShellCommand('setprop %s "logwrapper %s"' % (
+    self._adb.RunShellCommand('chmod 777 /data/local/tmp')
+    for prop in self._wrap_properties:
+      self._adb.RunShellCommand('setprop %s "logwrapper %s"' % (
           prop, self.GetTestWrapper()))
-    self.adb.RunShellCommand('setprop chrome.timeout_scale %f' % (
-        self.GetTimeoutScale()))
+    SetChromeTimeoutScale(self._adb, self.GetTimeoutScale())
 
   def CleanUpEnvironment(self):
     """Cleans up device environment."""
-    for prop in self.wrap_properties:
-      self.adb.RunShellCommand('setprop %s ""' % (prop,))
-    self.adb.RunShellCommand('setprop chrome.timeout_scale ""')
+    for prop in self._wrap_properties:
+      self._adb.RunShellCommand('setprop %s ""' % (prop,))
+    SetChromeTimeoutScale(self._adb, None)
 
   def GetFilesForTool(self):
     """Returns a list of file names for the tool."""
     raise NotImplementedError()
 
   def NeedsDebugInfo(self):
     """Whether this tool requires debug info.
 
-    Returns True if this tool can not work with stripped binaries.
+    Returns:
+      True if this tool can not work with stripped binaries.
     """
     return True
 
 
 class MemcheckTool(ValgrindTool):
   """Memcheck tool."""
 
-  def __init__(self, adb, renderer=False):
-    super(MemcheckTool, self).__init__(adb, renderer)
+  def __init__(self, adb):
+    super(MemcheckTool, self).__init__(adb)
 
   def GetFilesForTool(self):
     """Returns a list of file names for the tool."""
     return ['tools/valgrind/android/vg-chrome-wrapper.sh',
             'tools/valgrind/memcheck/suppressions.txt',
             'tools/valgrind/memcheck/suppressions_android.txt']
 
   def GetTestWrapper(self):
@@ -187,53 +201,55 @@ class MemcheckTool(ValgrindTool):
   def GetTimeoutScale(self):
     """Returns a multiplier that should be applied to timeout values."""
     return 30
 
 
 class TSanTool(ValgrindTool):
   """ThreadSanitizer tool. See http://code.google.com/p/data-race-test ."""
 
-  def __init__(self, adb, renderer=False):
-    super(TSanTool, self).__init__(adb, renderer)
+  def __init__(self, adb):
+    super(TSanTool, self).__init__(adb)
 
   def GetFilesForTool(self):
     """Returns a list of file names for the tool."""
     return ['tools/valgrind/android/vg-chrome-wrapper-tsan.sh',
             'tools/valgrind/tsan/suppressions.txt',
             'tools/valgrind/tsan/suppressions_android.txt',
             'tools/valgrind/tsan/ignores.txt']
 
   def GetTestWrapper(self):
     """Returns a string that is to be prepended to the test command line."""
     return ValgrindTool.VG_DIR + '/' + 'vg-chrome-wrapper-tsan.sh'
 
   def GetTimeoutScale(self):
     """Returns a multiplier that should be applied to timeout values."""
-    return 30
+    return 30.0
 
 
 TOOL_REGISTRY = {
-  'memcheck': lambda x: MemcheckTool(x, False),
-  'memcheck-renderer': lambda x: MemcheckTool(x, True),
-  'tsan': lambda x: TSanTool(x, False),
-  'tsan-renderer': lambda x: TSanTool(x, True),
-  'asan': lambda x: AddressSanitizerTool(x)
+    'memcheck': lambda x: MemcheckTool(x),
+    'memcheck-renderer': lambda x: MemcheckTool(x),
+    'tsan': lambda x: TSanTool(x),
+    'tsan-renderer': lambda x: TSanTool(x),
+    'asan': lambda x: AddressSanitizerTool(x),
 }
 
 
 def CreateTool(tool_name, adb):
   """Creates a tool with the specified tool name.
 
   Args:
     tool_name: Name of the tool to create.
     adb: ADB interface the tool will use.
+  Returns:
+    A tool for the specified tool_name.
   """
   if not tool_name:
     return BaseTool()
 
   ctor = TOOL_REGISTRY.get(tool_name)
   if ctor:
     return ctor(adb)
   else:
     print 'Unknown tool %s, available tools: %s' % (
-      tool_name, ', '.join(sorted(TOOL_REGISTRY.keys())))
+        tool_name, ', '.join(sorted(TOOL_REGISTRY.keys())))
     sys.exit(1)
--- a/media/webrtc/trunk/build/android/run_instrumentation_tests.py
+++ b/media/webrtc/trunk/build/android/run_instrumentation_tests.py
@@ -1,24 +1,27 @@
 #!/usr/bin/env python
 #
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """Runs both the Python and Java tests."""
 
+import optparse
 import sys
 import time
 
 from pylib import apk_info
-from pylib import test_options_parser
+from pylib import buildbot_report
+from pylib import ports
 from pylib import run_java_tests
 from pylib import run_python_tests
 from pylib import run_tests_helper
+from pylib import test_options_parser
 from pylib.test_result import TestResults
 
 
 def SummarizeResults(java_results, python_results, annotation, build_type):
   """Summarize the results from the various test types.
 
   Args:
     java_results: a TestResults object with java test case results.
@@ -46,16 +49,20 @@ def DispatchInstrumentationTests(options
   run. If neither are set, run both Java and Python tests.
 
   Args:
     options: command-line options for running the Java and Python tests.
 
   Returns:
     An integer representing the number of failing tests.
   """
+  # Reset the test port allocation. It's important to do it before starting
+  # to dispatch any tests.
+  if not ports.ResetTestServerPortAllocation():
+    raise Exception('Failed to reset test server port.')
   start_date = int(time.time() * 1000)
   java_results = TestResults()
   python_results = TestResults()
 
   if options.run_java_tests:
     java_results = run_java_tests.DispatchJavaTests(
         options,
         [apk_info.ApkInfo(options.test_apk_path, options.test_apk_jar_path)])
@@ -63,15 +70,23 @@ def DispatchInstrumentationTests(options
     python_results = run_python_tests.DispatchPythonTests(options)
 
   all_results, summary_string, num_failing = SummarizeResults(
       java_results, python_results, options.annotation, options.build_type)
   return num_failing
 
 
 def main(argv):
-  options = test_options_parser.ParseInstrumentationArgs(argv)
+  option_parser = optparse.OptionParser()
+  test_options_parser.AddInstrumentationOptions(option_parser)
+  options, args = option_parser.parse_args(argv)
+  test_options_parser.ValidateInstrumentationOptions(option_parser, options,
+                                                     args)
+
   run_tests_helper.SetLogLevel(options.verbose_count)
+  buildbot_report.PrintNamedStep(
+      'Instrumentation tests: %s - %s' % (', '.join(options.annotation),
+                                          options.test_apk))
   return DispatchInstrumentationTests(options)
 
 
 if __name__ == '__main__':
   sys.exit(main(sys.argv))
--- a/media/webrtc/trunk/build/android/run_tests.py
+++ b/media/webrtc/trunk/build/android/run_tests.py
@@ -3,27 +3,28 @@
 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
 """Runs all the native unit tests.
 
 1. Copy over test binary to /data/local on device.
 2. Resources: chrome/unit_tests requires resources (chrome.pak and en-US.pak)
-   to be deployed to the device (in /data/local/tmp).
+   to be deployed to the device. We use the device's $EXTERNAL_STORAGE as the
+   base dir (which maps to Context.getExternalFilesDir()).
 3. Environment:
 3.1. chrome/unit_tests requires (via chrome_paths.cc) a directory named:
-     /data/local/tmp/chrome/test/data
+     $EXTERNAL_STORAGE + /chrome/test/data
 3.2. page_cycler_tests have following requirements,
 3.2.1  the following data on host:
        <chrome_src_dir>/tools/page_cycler
        <chrome_src_dir>/data/page_cycler
 3.2.2. two data directories to store above test data on device named:
-       /data/local/tmp/tools/ (for database perf test)
-       /data/local/tmp/data/ (for other perf tests)
+       $EXTERNAL_STORAGE + /tools/ (for database perf test)
+       $EXTERNAL_STORAGE + /data/ (for other perf tests)
 3.2.3. a http server to serve http perf tests.
        The http root is host's <chrome_src_dir>/data/page_cycler/, port 8000.
 3.2.4  a tool named forwarder is also required to run on device to
        forward the http request/response between host and device.
 3.2.5  Chrome is installed on device.
 4. Run the binary in the device and stream the log to the host.
 4.1. Optionally, filter specific tests.
 4.2. Optionally, rebaseline: run the available tests and update the
@@ -45,16 +46,17 @@ one test per line. Here is an example:
 This file is generated by the tests running on devices. If running on emulator,
 additonal filter file which lists the tests only failed in emulator will be
 loaded. We don't care about the rare testcases which succeeded on emuatlor, but
 failed on device.
 """
 
 import fnmatch
 import logging
+import optparse
 import os
 import signal
 import subprocess
 import sys
 import time
 
 from pylib import android_commands
 from pylib.base_test_sharder import BaseTestSharder
@@ -179,25 +181,16 @@ class Xvfb(object):
       try:
         os.kill(self._pid, signal.SIGKILL)
       except:
         pass
       del os.environ['DISPLAY']
       self._pid = 0
 
 
-def PrintAnnotationForTestResults(test_results):
-  if test_results.timed_out:
-    buildbot_report.PrintWarning()
-  elif test_results.failed or test_results.crashed or test_results.overall_fail:
-    buildbot_report.PrintError()
-  else:
-    print 'Step success!'  # No annotation needed
-
-
 class TestSharder(BaseTestSharder):
   """Responsible for sharding the tests on the connected devices."""
 
   def __init__(self, attached_devices, test_suite, gtest_filter,
                test_arguments, timeout, rebaseline, performance_test,
                cleanup_test_files, tool, log_dump_name, fast_and_loose,
                build_type):
     BaseTestSharder.__init__(self, attached_devices)
@@ -253,17 +246,17 @@ class TestSharder(BaseTestSharder):
                             self.cleanup_test_files, self.tool, index,
                             not not self.log_dump_name, self.fast_and_loose,
                             self.build_type)
 
   def OnTestsCompleted(self, test_runners, test_results):
     """Notifies that we completed the tests."""
     test_results.LogFull('Unit test', os.path.basename(self.test_suite),
                          self.build_type)
-    PrintAnnotationForTestResults(test_results)
+    test_results.PrintAnnotation()
     if test_results.failed and self.rebaseline:
       test_runners[0].UpdateFilter(test_results.failed)
     if self.log_dump_name:
       # Zip all debug info outputs into a file named by log_dump_name.
       debug_info.GTestDebugInfo.ZipAndCleanResults(
           os.path.join(TestSuiteDir(self.build_type), 'debug_info_dumps'),
           self.log_dump_name)
 
@@ -277,17 +270,17 @@ def _RunATestSuite(options):
 
   Args:
     options: options for running the tests.
 
   Returns:
     0 if successful, number of failing tests otherwise.
   """
   step_name = os.path.basename(options.test_suite).replace('-debug.apk', '')
-  buildbot_report.PrintNamedStep('Test suite %s' % step_name)
+  buildbot_report.PrintNamedStep(step_name)
   attached_devices = []
   buildbot_emulators = []
 
   if options.use_emulator:
     for n in range(options.emulator_count):
       t = TimeProfile('Emulator launch %d' % n)
       avd_name =  None
       if n > 0:
@@ -378,18 +371,18 @@ def Dispatch(options):
 def ListTestSuites():
   """Display a list of available test suites."""
   print 'Available test suites are:'
   for test_suite in _TEST_SUITES:
     print test_suite
 
 
 def main(argv):
-  option_parser = test_options_parser.CreateTestRunnerOptionParser(
-      None, default_timeout=0)
+  option_parser = optparse.OptionParser()
+  test_options_parser.AddTestRunnerOptions(option_parser, default_timeout=0)
   option_parser.add_option('-s', '--suite', dest='test_suite',
                            help='Executable name of the test suite to run '
                            '(use -s help to list them)')
   option_parser.add_option('-d', '--device', dest='test_device',
                            help='Target device the test suite to run ')
   option_parser.add_option('-r', dest='rebaseline',
                            help='Rebaseline and update *testsuite_disabled',
                            action='store_true')
--- a/media/webrtc/trunk/build/apk_test.gypi
+++ b/media/webrtc/trunk/build/apk_test.gypi
@@ -15,17 +15,20 @@
 #     'input_jars_paths': ['/path/to/test_suite.jar', ... ],  # list
 #   },
 #   'includes': ['path/to/this/gypi/file'],
 # }
 #
 
 {
   'variables': {
-    'input_jars_paths': [],
+    'input_jars_paths': [
+      # Needed by ChromeNativeTestActivity.java.
+      '<(PRODUCT_DIR)/lib.java/chromium_base.jar',
+    ],
   },
   'target_conditions': [
     ['_toolset == "target"', {
       'conditions': [
         ['OS == "android" and gtest_target_type == "shared_library"', {
           'actions': [{
             'action_name': 'apk_<(test_suite_name)',
             'message': 'Building <(test_suite_name) test apk.',
@@ -44,29 +47,28 @@
               '<(input_shlib_path)',
               '--jars',
               '">@(input_jars_paths)"',
               '--output',
               '<(PRODUCT_DIR)/<(test_suite_name)_apk',
               '--strip-binary=<(android_strip)',
               '--app_abi',
               '<(android_app_abi)',
-              '--sdk-build=<(sdk_build)',
               '--ant-args',
               '-DPRODUCT_DIR=<(ant_build_out)',
               '--ant-args',
               '-DANDROID_SDK=<(android_sdk)',
               '--ant-args',
               '-DANDROID_SDK_ROOT=<(android_sdk_root)',
               '--ant-args',
               '-DANDROID_SDK_TOOLS=<(android_sdk_tools)',
               '--ant-args',
               '-DANDROID_SDK_VERSION=<(android_sdk_version)',
               '--ant-args',
-              '-DANDROID_TOOLCHAIN=<(android_toolchain)',
+              '-DANDROID_GDBSERVER=<(android_gdbserver)',
               '--ant-args',
               '-DCHROMIUM_SRC=<(ant_build_out)/../..',
             ],
           }],
         }],  # 'OS == "android" and gtest_target_type == "shared_library"
       ],  # conditions
     }],
   ],  # target_conditions
--- a/media/webrtc/trunk/build/common.gypi
+++ b/media/webrtc/trunk/build/common.gypi
@@ -251,16 +251,22 @@
       # See https://sites.google.com/a/chromium.org/dev/developers/testing/addresssanitizer
       'asan%': 0,
 
       # Enable building with TSAN (Clang's -fthread-sanitizer option).
       # -fthread-sanitizer only works with clang, but tsan=1 implies clang=1
       # See http://clang.llvm.org/docs/ThreadSanitizer.html
       'tsan%': 0,
 
+      # Use a modified version of Clang to intercept allocated types and sizes
+      # for allocated objects. clang_type_profiler=1 implies clang=1.
+      # See http://dev.chromium.org/developers/deep-memory-profiler/cpp-object-type-identifier
+      # TODO(dmikurube): Support mac.  See http://crbug.com/123758#c11
+      'clang_type_profiler%': 0,
+
       # Set to true to instrument the code with function call logger.
       # See src/third_party/cygprofile/cyg-profile.cc for details.
       'order_profiling%': 0,
 
       # Use the provided profiled order file to link Chrome image with it.
       # This makes Chrome faster by better using CPU cache when executing code.
       # This is known as PGO (profile guided optimization).
       # See https://sites.google.com/a/google.com/chrome-msk/dev/boot-speed-up-effort
@@ -300,22 +306,28 @@
       # Enables use of the session service, which is enabled by default.
       # Support for disabling depends on the platform.
       'enable_session_service%': 1,
 
       # Enables theme support, which is enabled by default.  Support for
       # disabling depends on the platform.
       'enable_themes%': 1,
 
+      # Uses OEM-specific wallpaper resources on Chrome OS.
+      'use_oem_wallpaper%': 0,
+
       # Enables support for background apps.
       'enable_background%': 1,
 
       # Enable the task manager by default.
       'enable_task_manager%': 1,
 
+      # Enable FTP support by default.
+      'disable_ftp_support%': 0,
+
       # XInput2 multitouch support is disabled by default (use_xi2_mt=0).
       # Setting to non-zero value enables XI2 MT. When XI2 MT is enabled,
       # the input value also defines the required XI2 minor minimum version.
       # For example, use_xi2_mt=2 means XI2.2 or above version is required.
       'use_xi2_mt%': 0,
 
       # Use of precompiled headers on Windows.
       #
@@ -331,24 +343,16 @@
       # Windows developers using VS 2008, since precompiled headers
       # provide a build speedup of 20-25%.  There are a couple of
       # small workarounds you may need to use when using VS 2008 (but
       # not 2010), see
       # http://code.google.com/p/chromium/wiki/WindowsPrecompiledHeaders
       # for details.
       'chromium_win_pch%': 0,
 
-      # iOS SDK and deployment target support.  The iOS 5.0 SDK is actually
-      # what is required, but the value is left blank so when it is set in
-      # the project files it will be the "current" iOS SDK.  Forcing 5.0
-      # even though it is "current" causes Xcode to spit out a warning for
-      # every single project file for not using the "current" SDK.
-      'ios_sdk%': '',
-      'ios_deployment_target%': '4.3',
-
       # Set this to true when building with Clang.
       # See http://code.google.com/p/chromium/wiki/Clang for details.
       'clang%': 0,
 
       # Enable plug-in installation by default.
       'enable_plugin_installation%': 1,
 
       # Enable protector service by default.
@@ -363,18 +367,18 @@
 
       # Set to "tsan", "memcheck", or "drmemory" to configure the build to work
       # with one of those tools.
       'build_for_tool%': '',
 
       # Whether tests targets should be run, archived or just have the
       # dependencies verified. All the tests targets have the '_run' suffix,
       # e.g. base_unittests_run runs the target base_unittests. The test target
-      # always calls tools/isolate/isolate.py. See the script's --help for more
-      # information and the valid --mode values. Meant to be overriden with
+      # always calls tools/swarm_client/isolate.py. See the script's --help for
+      # more information and the valid --mode values. Meant to be overriden with
       # GYP_DEFINES.
       # TODO(maruel): Converted the default from 'check' to 'noop' so work can
       # be done while the builders are being reconfigured to check out test data
       # files.
       'test_isolation_mode%': 'noop',
       # It must not be '<(PRODUCT_DIR)' alone, the '/' is necessary otherwise
       # gyp will remove duplicate flags, causing isolate.py to be confused.
       'test_isolation_outdir%': '<(PRODUCT_DIR)/isolate',
@@ -463,17 +467,24 @@
           'enable_printing%': 0,
           'enable_themes%': 0,
           'enable_webrtc%': 0,
           'proprietary_codecs%': 1,
           'remoting%': 0,
         }],
 
         ['OS=="ios"', {
+          'configuration_policy%': 0,
+          'disable_ftp_support%': 1,
           'enable_automation%': 0,
+          'enable_extensions%': 0,
+          'enable_printing%': 0,
+          'enable_themes%': 0,
+          'enable_webrtc%': 0,
+          'notifications%': 0,
           'remoting%': 0,
         }],
 
         # Use GPU accelerated cross process image transport by default
         # on linux builds with the Aura window manager
         ['use_aura==1 and OS=="linux"', {
           'ui_compositor_image_transport%': 1,
         }, {
@@ -524,22 +535,61 @@
         # http://crbug.com/105550
         #
         # On Aura, this allows per-tile painting to be used in the browser
         # compositor.
         ['OS!="mac" and OS!="android"', {
           'use_canvas_skia%': 1,
         }],
 
+        ['chromeos==1', {
+          # When building for ChromeOS we dont want Chromium to use libjpeg_turbo.
+          'use_libjpeg_turbo%': 0,
+        }],
+
         ['OS=="android"', {
           # When building as part of the Android system, use system libraries
           # where possible to reduce ROM size.
           'use_system_libjpeg%': '<(android_build_type)',
         }],
       ],
+
+      # Set this to 1 to use the Google-internal file containing
+      # official API keys for Google Chrome even in a developer build.
+      # Setting this variable explicitly to 1 will cause your build to
+      # fail if the internal file is missing.
+      #
+      # Set this to 0 to not use the internal file, even when it
+      # exists in your checkout.
+      #
+      # Leave set to 2 to have this variable implicitly set to 1 if
+      # you have src/google_apis/internal/google_chrome_api_keys.h in
+      # your checkout, and implicitly set to 0 if not.
+      #
+      # Note that official builds always behave as if this variable
+      # was explicitly set to 1, i.e. they always use official keys,
+      # and will fail to build if the internal file is missing.
+      'use_official_google_api_keys%': 2,
+
+      # Set these to bake the specified API keys and OAuth client
+      # IDs/secrets into your build.
+      #
+      # If you create a build without values baked in, you can instead
+      # set environment variables to provide the keys at runtime (see
+      # src/google_apis/google_api_keys.h for details).  Features that
+      # require server-side APIs may fail to work if no keys are
+      # provided.
+      #
+      # Note that if you are building an official build or if
+      # use_official_google_api_keys has been set to 1 (explicitly or
+      # implicitly), these values will be ignored and the official
+      # keys will be used instead.
+      'google_api_key%': '',
+      'google_default_client_id%': '',
+      'google_default_client_secret%': '',
     },
 
     # Copy conditionally-set variables out one scope.
     'branding%': '<(branding)',
     'buildtype%': '<(buildtype)',
     'target_arch%': '<(target_arch)',
     'host_arch%': '<(host_arch)',
     'library%': 'static_library',
@@ -568,58 +618,63 @@
     'inside_chromium_build%': '<(inside_chromium_build)',
     'fastbuild%': '<(fastbuild)',
     'dcheck_always_on%': '<(dcheck_always_on)',
     'python_ver%': '<(python_ver)',
     'armv7%': '<(armv7)',
     'arm_neon%': '<(arm_neon)',
     'sysroot%': '<(sysroot)',
     'system_libdir%': '<(system_libdir)',
-    'disable_sse2%': '<(disable_sse2)',
     'component%': '<(component)',
     'use_titlecase_in_grd_files%': '<(use_titlecase_in_grd_files)',
     'use_third_party_translations%': '<(use_third_party_translations)',
     'remoting%': '<(remoting)',
     'enable_one_click_signin%': '<(enable_one_click_signin)',
     'enable_webrtc%': '<(enable_webrtc)',
     'chromium_win_pch%': '<(chromium_win_pch)',
     'configuration_policy%': '<(configuration_policy)',
     'safe_browsing%': '<(safe_browsing)',
     'input_speech%': '<(input_speech)',
     'notifications%': '<(notifications)',
     'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
     'asan%': '<(asan)',
     'tsan%': '<(tsan)',
+    'clang_type_profiler%': '<(clang_type_profiler)',
     'order_profiling%': '<(order_profiling)',
     'order_text_section%': '<(order_text_section)',
     'enable_extensions%': '<(enable_extensions)',
     'enable_web_intents%': '<(enable_web_intents)',
     'enable_web_intents_tag%': '<(enable_web_intents_tag)',
-    'ios_sdk%': '<(ios_sdk)',
-    'ios_deployment_target%': '<(ios_deployment_target)',
     'enable_plugin_installation%': '<(enable_plugin_installation)',
     'enable_protector_service%': '<(enable_protector_service)',
     'enable_session_service%': '<(enable_session_service)',
     'enable_themes%': '<(enable_themes)',
+    'use_oem_wallpaper%': '<(use_oem_wallpaper)',
     'enable_background%': '<(enable_background)',
     'linux_use_gold_binary%': '<(linux_use_gold_binary)',
     'linux_use_gold_flags%': '<(linux_use_gold_flags)',
     'use_canvas_skia%': '<(use_canvas_skia)',
     'test_isolation_mode%': '<(test_isolation_mode)',
     'test_isolation_outdir%': '<(test_isolation_outdir)',
     'enable_automation%': '<(enable_automation)',
     'enable_printing%': '<(enable_printing)',
     'enable_captive_portal_detection%': '<(enable_captive_portal_detection)',
+    'disable_ftp_support%': '<(disable_ftp_support)',
     'force_rlz_use_chrome_net%': '<(force_rlz_use_chrome_net)',
     'enable_task_manager%': '<(enable_task_manager)',
     'sas_dll_path%': '<(sas_dll_path)',
     'wix_path%': '<(wix_path)',
     'android_upstream_bringup%': '<(android_upstream_bringup)',
+    'use_libjpeg_turbo%': '<(use_libjpeg_turbo)',
     'use_system_libjpeg%': '<(use_system_libjpeg)',
     'android_build_type%': '<(android_build_type)',
+    'use_official_google_api_keys%': '<(use_official_google_api_keys)',
+    'google_api_key%': '<(google_api_key)',
+    'google_default_client_id%': '<(google_default_client_id)',
+    'google_default_client_secret%': '<(google_default_client_secret)',
 
     # Use system yasm instead of bundled one.
     'use_system_yasm%': 0,
 
     # Default to enabled PIE; this is important for ASLR but we may need to be
     # able to turn it off for various reasons.
     'linux_disable_pie%': 0,
 
@@ -633,36 +688,16 @@
     # used, but prefix headers will not be precompiled.  This is useful when
     # using distcc to distribute a build to compile slaves that don't
     # share the same compiler executable as the system driving the compilation,
     # because precompiled headers rely on pointers into a specific compiler
     # executable's image.  Setting this to 0 is needed to use an experimental
     # Linux-Mac cross compiler distcc farm.
     'chromium_mac_pch%': 1,
 
-    # Mac OS X SDK and deployment target support.
-    # The SDK identifies the version of the system headers that will be used,
-    # and corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time macro.
-    # "Maximum allowed" refers to the operating system version whose APIs are
-    # available in the headers.
-    # The deployment target identifies the minimum system version that the
-    # built products are expected to function on.  It corresponds to the
-    # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.
-    # To ensure these macros are available, #include <AvailabilityMacros.h>.
-    # Additional documentation on these macros is available at
-    # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
-    # Chrome normally builds with the Mac OS X 10.6 SDK and sets the
-    # deployment target to 10.6.  Other projects, such as O3D, may override
-    # these defaults. If the SDK is installed someplace that Xcode doesn't
-    # know about, set mac_sdk_path to the path to the SDK. If set to a
-    # non-empty string, mac_sdk_path will be used in preference to mac_sdk.
-    # mac_sdk gets its default value elsewhere in this file.
-    'mac_sdk_path%': '',
-    'mac_deployment_target%': '10.6',
-
     # The default value for mac_strip in target_defaults. This cannot be
     # set there, per the comment about variable% in a target_defaults.
     'mac_strip_release%': 1,
 
     # Set to 1 to enable code coverage.  In addition to build changes
     # (e.g. extra CFLAGS), also creates a new target in the src/chrome
     # project file called "coverage".
     # Currently ignored on Windows.
@@ -863,16 +898,21 @@
     'disable_nacl%': 0,
 
     # Whether to build full debug version for Debug configuration on Android.
     # Compared to full debug version, the default Debug configuration on Android
     # has no full v8 debug, has size optimization and linker gc section, so that
     # we can build a debug version with acceptable size and performance.
     'android_full_debug%': 0,
 
+    # Sets the default version name and code for Android app, by default we
+    # do a developer build.
+    'android_app_version_name%': 'Developer Build',
+    'android_app_version_code%': 0,
+
     'sas_dll_exists': '<!(python <(DEPTH)/build/dir_exists.py <(sas_dll_path))',
     'wix_exists': '<!(python <(DEPTH)/build/dir_exists.py <(wix_path))',
 
     'windows_sdk_default_path': '<(DEPTH)/third_party/platformsdk_win8/files',
     'directx_sdk_default_path': '<(DEPTH)/third_party/directxsdk/files',
 
     'conditions': [
       ['OS=="win" and "<!(python <(DEPTH)/build/dir_exists.py <(windows_sdk_default_path))"=="True"', {
@@ -880,16 +920,25 @@
       }, {
         'windows_sdk_path%': 'C:/Program Files (x86)/Windows Kits/8.0',
       }],
       ['OS=="win" and "<!(python <(DEPTH)/build/dir_exists.py <(directx_sdk_default_path))"=="True"', {
         'directx_sdk_path%': '<(directx_sdk_default_path)',
       }, {
         'directx_sdk_path%': '$(DXSDK_DIR)',
       }],
+      # If use_official_google_api_keys is already set (to 0 or 1), we
+      # do none of the implicit checking.  If it is set to 1 and the
+      # internal keys file is missing, the build will fail at compile
+      # time.  If it is set to 0 and keys are not provided by other
+      # means, a warning will be printed at compile time.
+      ['use_official_google_api_keys==2', {
+        'use_official_google_api_keys%':
+            '<!(python <(DEPTH)/google_apis/build/check_internal.py <(DEPTH)/google_apis/internal/google_chrome_api_keys.h)',
+      }],
       ['os_posix==1 and OS!="mac" and OS!="ios"', {
         # Figure out the python architecture to decide if we build pyauto.
 	# disabled for mozilla because windows != mac and this runs a shell script
 	#        'python_arch%': '<!(<(DEPTH)/build/linux/python_arch.sh <(sysroot)/usr/<(system_libdir)/libpython<(python_ver).so.1.0)',
         'conditions': [
           # TODO(glider): set clang to 1 earlier for ASan and TSan builds so
           # that it takes effect here.
           # disabled for Mozilla since it doesn't use this, and 'msys' messes $(CXX) up
@@ -906,52 +955,79 @@
           # symbols from official builds.
           ['(branding=="Chrome" and buildtype=="Official")', {
             'linux_dump_symbols%': 1,
           }],
         ],
       }],  # os_posix==1 and OS!="mac" and OS!="ios"
       ['OS=="ios"', {
         'disable_nacl%': 1,
+        'enable_gpu%': 0,
         'icu_use_data_file_flag%': 1,
         'use_system_bzip2%': 1,
         'use_system_libxml%': 1,
         'use_system_sqlite%': 1,
 
         # The Mac SDK is set for iOS builds and passed through to Mac
         # sub-builds. This allows the Mac sub-build SDK in an iOS build to be
         # overridden from the command line the same way it is for a Mac build.
         'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py 10.6)',
-      }],
+
+        # iOS SDK and deployment target support.  The iOS 5.0 SDK is actually
+        # what is required, but the value is left blank so when it is set in
+        # the project files it will be the "current" iOS SDK.  Forcing 5.0
+        # even though it is "current" causes Xcode to spit out a warning for
+        # every single project file for not using the "current" SDK.
+        'ios_sdk%': '',
+        'ios_sdk_path%': '',
+        'ios_deployment_target%': '4.3',
+
+        'conditions': [
+          # ios_product_name is set to the name of the .app bundle as it should
+          # appear on disk.
+          ['branding=="Chrome"', {
+            'ios_product_name%': 'Chrome',
+          }, { # else: branding!="Chrome"
+            'ios_product_name%': 'Chromium',
+          }],
+          ['branding=="Chrome" and buildtype=="Official"', {
+            'ios_breakpad%': 1,
+          }, { # else: branding!="Chrome" or buildtype!="Official"
+            'ios_breakpad%': 0,
+          }],
+        ],
+      }],  # OS=="ios"
       ['OS=="android"', {
         # Location of Android NDK.
         'variables': {
           'variables': {
-            'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)',
-            # Android uses x86 instead of ia32 for their target_arch
-            # designation.
-            # TODO(wistoch): Adjust the target_arch naming scheme to avoid
-            # confusion.
-            # http://crbug.com/125329
+            'variables': {
+              'android_ndk_root%': '<!(/bin/echo -n $ANDROID_NDK_ROOT)',
+            },
+            'android_ndk_root%': '<(android_ndk_root)',
             'conditions': [
               ['target_arch == "ia32"', {
-                'target_arch': 'x86',
                 'android_app_abi%': 'x86',
+                'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-9/arch-x86',
               }],
-              ['target_arch=="arm" and armv7==0', {
-                'android_app_abi%': 'armeabi',
-              }],
-              ['target_arch=="arm" and armv7==1', {
-                'android_app_abi%': 'armeabi-v7a',
+              ['target_arch=="arm"', {
+                'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-9/arch-arm',
+                'conditions': [
+                  ['armv7==0', {
+                    'android_app_abi%': 'armeabi',
+                  }, {
+                    'android_app_abi%': 'armeabi-v7a',
+                  }],
+                ],
               }],
             ],
           },
           'android_ndk_root%': '<(android_ndk_root)',
-          'android_ndk_sysroot%': '<(android_ndk_root)/platforms/android-9/arch-<(target_arch)',
           'android_app_abi%': '<(android_app_abi)',
+          'android_ndk_sysroot%': '<(android_ndk_sysroot)',
         },
         'android_ndk_root%': '<(android_ndk_root)',
         'android_ndk_sysroot': '<(android_ndk_sysroot)',
         'android_ndk_include': '<(android_ndk_sysroot)/usr/include',
         'android_ndk_lib': '<(android_ndk_sysroot)/usr/lib',
         'android_app_abi%': '<(android_app_abi)',
 
         # Location of the "strip" binary, used by both gyp and scripts.
@@ -1023,43 +1099,76 @@
         'use_system_expat%': '<(android_build_type)',
         'use_system_icu%': '<(android_build_type)',
         'use_system_stlport%': '<(android_build_type)',
 
         # Copy it out one scope.
         'android_build_type%': '<(android_build_type)',
       }],  # OS=="android"
       ['OS=="mac"', {
+        'variables': {
+          # Mac OS X SDK and deployment target support.  The SDK identifies
+          # the version of the system headers that will be used, and
+          # corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time
+          # macro.  "Maximum allowed" refers to the operating system version
+          # whose APIs are available in the headers.  The deployment target
+          # identifies the minimum system version that the built products are
+          # expected to function on.  It corresponds to the
+          # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.  To ensure these
+          # macros are available, #include <AvailabilityMacros.h>.  Additional
+          # documentation on these macros is available at
+          # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
+          # Chrome normally builds with the Mac OS X 10.6 SDK and sets the
+          # deployment target to 10.6.  Other projects, such as O3D, may
+          # override these defaults.
+
+          # Normally, mac_sdk_min is used to find an SDK that Xcode knows
+          # about that is at least the specified version. In official builds,
+          # the SDK must match mac_sdk_min exactly. If the SDK is installed
+          # someplace that Xcode doesn't know about, set mac_sdk_path to the
+          # path to the SDK; when set to a non-empty string, SDK detection
+          # based on mac_sdk_min will be bypassed entirely.
+          'mac_sdk_min%': '10.6',
+          'mac_sdk_path%': '',
+
+          'mac_deployment_target%': '10.6',
+        },
+
+        'mac_sdk_min': '<(mac_sdk_min)',
+        'mac_sdk_path': '<(mac_sdk_path)',
+        'mac_deployment_target': '<(mac_deployment_target)',
+
         # Enable clang on mac by default!
         'clang%': 1,
+
         # Compile in Breakpad support by default so that it can be
         # tested, even if it is not enabled by default at runtime.
         'mac_breakpad_compiled_in%': 1,
         'conditions': [
           # mac_product_name is set to the name of the .app bundle as it should
           # appear on disk.  This duplicates data from
           # chrome/app/theme/chromium/BRANDING and
           # chrome/app/theme/google_chrome/BRANDING, but is necessary to get
           # these names into the build system.
           ['branding=="Chrome"', {
             'mac_product_name%': 'Google Chrome',
           }, { # else: branding!="Chrome"
             'mac_product_name%': 'Chromium',
           }],
 
           ['branding=="Chrome" and buildtype=="Official"', {
-            'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py --verify 10.6)',
+            'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py --verify <(mac_sdk_min) --sdk_path=<(mac_sdk_path))',
             # Enable uploading crash dumps.
             'mac_breakpad_uploads%': 1,
             # Enable dumping symbols at build time for use by Mac Breakpad.
             'mac_breakpad%': 1,
             # Enable Keystone auto-update support.
             'mac_keystone%': 1,
           }, { # else: branding!="Chrome" or buildtype!="Official"
-            'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py 10.6)',
+            'mac_sdk%': '<!(python <(DEPTH)/build/mac/find_sdk.py <(mac_sdk_min))',
             'mac_breakpad_uploads%': 0,
             'mac_breakpad%': 0,
             'mac_keystone%': 0,
           }],
         ],
       }],  # OS=="mac"
 
       ['OS=="win"', {
@@ -1069,24 +1178,16 @@
           }],
           ['component=="shared_library" and "<(GENERATOR)"=="ninja"', {
             # Only enabled by default for ninja because it's buggy in VS.
             # Not enabled for component=static_library because some targets
             # are too large and the toolchain fails due to the size of the
             # .obj files.
             'incremental_chrome_dll%': 1,
           }],
-          # Whether to use multiple cores to compile with visual studio. This is
-          # optional because it sometimes causes corruption on VS 2005.
-          # It is on by default on VS 2008 and off on VS 2005.
-          ['MSVS_VERSION=="2005"', {
-            'msvs_multi_core_compile%': 0,
-          },{
-            'msvs_multi_core_compile%': 1,
-          }],
           # Don't do incremental linking for large modules on 32-bit.
           ['MSVS_OS_BITS==32', {
             'msvs_large_module_debug_link_mode%': '1',  # No
           },{
             'msvs_large_module_debug_link_mode%': '2',  # Yes
           }],
           ['MSVS_VERSION=="2010e" or MSVS_VERSION=="2008e" or MSVS_VERSION=="2005e"', {
             'msvs_express%': 1,
@@ -1111,16 +1212,23 @@
 
       # Native Client glibc toolchain is enabled by default except on arm.
       ['target_arch=="arm"', {
         'disable_glibc%': 1,
       }, {
         'disable_glibc%': 0,
       }],
 
+      # Disable SSE2 when building for ARM or MIPS.
+      ['target_arch=="arm" or target_arch=="mipsel"', {
+        'disable_sse2%': 1,
+      }, {
+        'disable_sse2%': '<(disable_sse2)',
+      }],
+
       # Set the relative path from this file to the GYP file of the JPEG
       # library used by Chromium.
       ['use_system_libjpeg==1 or use_libjpeg_turbo==0', {
         # Configuration for using the system libjeg is here.
         'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp',
       }, {
         'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp',
       }],
@@ -1177,46 +1285,61 @@
         ],
       }],
       ['OS=="android"', {
         'grit_defines': ['-D', 'android'],
       }],
       ['OS=="mac"', {
         'grit_defines': ['-D', 'scale_factors=2x'],
       }],
+      ['OS == "ios"', {
+        'grit_defines': [
+          # define for iOS specific resources.
+          '-D', 'ios',
+          # iOS uses a whitelist to filter resources.
+          '-w', '<(DEPTH)/build/ios/grit_whitelist.txt'
+        ],
+      }],
       ['enable_extensions==1', {
         'grit_defines': ['-D', 'enable_extensions'],
       }],
       ['enable_printing==1', {
         'grit_defines': ['-D', 'enable_printing'],
       }],
       ['enable_themes==1', {
         'grit_defines': ['-D', 'enable_themes'],
       }],
+      ['use_oem_wallpaper==1', {
+        'grit_defines': ['-D', 'use_oem_wallpaper'],
+      }],
       ['clang_use_chrome_plugins==1 and OS!="win"', {
         'clang_chrome_plugins_flags': [
           '<!@(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)'
         ],
       }],
 
       ['enable_web_intents_tag==1', {
         'grit_defines': ['-D', 'enable_web_intents_tag'],
       }],
 
       ['asan==1', {
         'clang%': 1,
-        # Do not use Chrome plugins for Clang. The Clang version in
-        # third_party/asan may be different from the default one.
-        # TODO(glider): this isn't true anymore, need to check if we can use the
-        # plugins now.
-        'clang_use_chrome_plugins%': 0,
+      }],
+      ['asan==1 and OS=="mac"', {
+        # See http://crbug.com/145503.
+        'component': "static_library",
+      }],
+      ['tsan==1', {
+        'clang%': 1,
       }],
 
-      ['tsan==1', {
+      ['OS=="linux" and clang_type_profiler==1', {
         'clang%': 1,
+        'clang_use_chrome_plugins%': 0,
+        'make_clang_dir%': 'third_party/llvm-allocated-type/Linux_x64',
       }],
 
       # On valgrind bots, override the optimizer settings so we don't inline too
       # much and make the stacks harder to figure out.
       #
       # TODO(rnk): Kill off variables that no one else uses and just implement
       # them under a build_for_tool== condition.
       ['build_for_tool=="memcheck" or build_for_tool=="tsan"', {
@@ -1270,22 +1393,26 @@
     # contains the destination location for each of the files.  When a crx
     # is added or removed from the list, the chrome/browser/resources/
     # default_apps/external_extensions.json file must also be updated.
     'default_apps_list': [
       'browser/resources/default_apps/external_extensions.json',
       'browser/resources/default_apps/gmail.crx',
       'browser/resources/default_apps/search.crx',
       'browser/resources/default_apps/youtube.crx',
+      'browser/resources/default_apps/drive.crx',
+      'browser/resources/default_apps/docs.crx',
     ],
     'default_apps_list_linux_dest': [
       '<(PRODUCT_DIR)/default_apps/external_extensions.json',
       '<(PRODUCT_DIR)/default_apps/gmail.crx',
       '<(PRODUCT_DIR)/default_apps/search.crx',
       '<(PRODUCT_DIR)/default_apps/youtube.crx',
+      '<(PRODUCT_DIR)/default_apps/drive.crx',
+      '<(PRODUCT_DIR)/default_apps/docs.crx',
     ],
   },
   'target_defaults': {
     'variables': {
       # The condition that operates on chromium_code is in a target_conditions
       # section, and will not have access to the default fallback value of
       # chromium_code at the top of this file, or to the chromium_code
       # variable placed at the root variables scope of .gyp files, because
@@ -1357,16 +1484,28 @@
         }, {
           # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
           'mac_release_optimization%': '3', # Use -O3 unless overridden
           'mac_debug_optimization%': '0',   # Use -O0 unless overridden
         }],
       ],
     },
     'conditions': [
+      ['OS=="linux" and linux_use_tcmalloc==1 and clang_type_profiler==1', {
+        'cflags_cc!': ['-fno-rtti'],
+        'cflags_cc+': [
+          '-frtti',
+          '-gline-tables-only',
+          '-fintercept-allocation-functions',
+        ],
+        'defines': ['TYPE_PROFILING'],
+        'dependencies': [
+          '<(DEPTH)/base/allocator/allocator.gyp:type_profiler',
+        ],
+      }],
       ['OS=="win" and "<(msbuild_toolset)"!=""', {
         'msbuild_toolset': '<(msbuild_toolset)',
       }],
       ['branding=="Chrome"', {
         'defines': ['GOOGLE_CHROME_BUILD'],
       }, {  # else: branding!="Chrome"
         'defines': ['CHROMIUM_BUILD'],
       }],
@@ -1394,16 +1533,19 @@
         'defines': ['UI_COMPOSITOR_IMAGE_TRANSPORT'],
       }],
       ['use_aura==1', {
         'defines': ['USE_AURA=1'],
       }],
       ['use_ash==1', {
         'defines': ['USE_ASH=1'],
       }],
+      ['use_libjpeg_turbo==1', {
+        'defines': ['USE_LIBJPEG_TURBO=1'],
+      }],
       ['use_nss==1', {
         'defines': ['USE_NSS=1'],
       }],
       ['enable_one_click_signin==1', {
         'defines': ['ENABLE_ONE_CLICK_SIGNIN'],
       }],
       ['toolkit_uses_gtk==1 and toolkit_views==0', {
         # TODO(erg): We are progressively sealing up use of deprecated features
@@ -1478,17 +1620,17 @@
           }, { # else: OS != "win", generate less debug information.
             'variables': {
               'debug_extra_cflags': '-g1',
             },
           }],
           # Clang creates chubby debug information, which makes linking very
           # slow. For now, don't create debug information with clang.  See
           # http://crbug.com/70000
-          ['OS=="linux" and clang==1', {
+          ['(OS=="linux" or OS=="android") and clang==1', {
             'variables': {
               'debug_extra_cflags': '-g0',
             },
           }],
         ],  # conditions for fastbuild.
       }],  # fastbuild!=0
       ['dcheck_always_on!=0', {
         'defines': ['DCHECK_ALWAYS_ON=1'],
@@ -1520,21 +1662,23 @@
       }],
       ['use_skia==1', {
         'defines': [
           'USE_SKIA=1',
         ],
       }],
       ['coverage!=0', {
         'conditions': [
-          ['OS=="mac"', {
+          ['OS=="mac" or OS=="ios"', {
             'xcode_settings': {
               'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES',  # -fprofile-arcs
               'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',  # -ftest-coverage
             },
+          }],
+          ['OS=="mac"', {
             # Add -lgcov for types executable, shared_library, and
             # loadable_module; not for static_library.
             # This is a delayed conditional.
             'target_conditions': [
               ['_type!="static_library"', {
                 'xcode_settings': { 'OTHER_LDFLAGS': [ '-lgcov' ] },
               }],
             ],
@@ -1623,16 +1767,19 @@
         'defines': ['ENABLE_AUTOMATION=1'],
       }],
       ['enable_printing==1', {
         'defines': ['ENABLE_PRINTING=1'],
       }],
       ['enable_captive_portal_detection==1', {
         'defines': ['ENABLE_CAPTIVE_PORTAL_DETECTION=1'],
       }],
+      ['disable_ftp_support==1', {
+        'defines': ['DISABLE_FTP_SUPPORT=1'],
+      }],
     ],  # conditions for 'target_defaults'
     'target_conditions': [
       ['enable_wexit_time_destructors==1', {
         'conditions': [
           [ 'clang==1', {
             'cflags': [
               '-Wexit-time-destructors',
             ],
@@ -1873,17 +2020,17 @@
             # the default setting, 1 is off and 2 is on.
             'RandomizedBaseAddress': 1,
           },
           'VCResourceCompilerTool': {
             'PreprocessorDefinitions': ['_DEBUG'],
           },
         },
         'conditions': [
-          ['OS=="linux"', {
+          ['OS=="linux" or OS=="android"', {
             'target_conditions': [
               ['_toolset=="target"', {
                 'cflags': [
                   '<@(debug_extra_cflags)',
                 ],
               }],
             ],
           }],
@@ -2368,16 +2515,19 @@
               '-Wno-unnamed-type-template-args',
               # This (rightyfully) complains about 'override', which we use
               # heavily.
               '-Wno-c++11-extensions',
 
               # Warns on switches on enums that cover all enum values but
               # also contain a default: branch. Chrome is full of that.
               '-Wno-covered-switch-default',
+
+              # TODO(thakis): Remove this.
+              '-Wno-implicit-conversion-floating-point-to-bool',
             ],
             'cflags!': [
               # Clang doesn't seem to know know this flag.
               '-mfpmath=sse',
             ],
           }],
           ['clang==1 and clang_use_chrome_plugins==1', {
             'cflags': [
@@ -2441,16 +2591,19 @@
               }],
             ],
           }],
           ['order_profiling!=0 and (chromeos==1 or OS=="linux")', {
             'target_conditions' : [
               ['_toolset=="target"', {
                 'cflags': [
                   '-finstrument-functions',
+                  # Allow mmx intrinsics to inline, so that the
+                  # compiler can expand the intrinsics.
+                  '-finstrument-functions-exclude-file-list=mmintrin.h',
                 ],
               }],
             ],
           }],
           ['linux_breakpad==1', {
             'cflags': [ '-g' ],
             'defines': ['USE_LINUX_BREAKPAD'],
           }],
@@ -2524,22 +2677,23 @@
         'ldflags': [
           '-Wl,--no-keep-memory',
         ],
       },
     }],
     # Android-specific options; note that most are set above with Linux.
     ['OS=="android"', {
       'variables': {
-        'target_arch%': 'arm',  # target_arch in android terms.
+        # This is the id for the archived chrome symbols. Each build that
+        # archives symbols is assigned an id which is then added to GYP_DEFINES.
+        # This is written to the device log on crashes just prior to dropping a
+        # tombstone. Tools can determine the location of the archived symbols
+        # from the id.
+        'chrome_symbols_id%': '',
         'conditions': [
-          # Android uses x86 instead of ia32 for their target_arch designation.
-          ['target_arch=="ia32"', {
-            'target_arch%': 'x86',
-          }],
           # Use shared stlport library when system one used.
           # Figure this out early since it needs symbols from libgcc.a, so it
           # has to be before that in the set of libraries.
           ['use_system_stlport==1', {
             'android_stlport_library': 'stlport',
           }, {
             'android_stlport_library': 'stlport_static',
           }],
@@ -2668,16 +2822,59 @@
                 ],
                 'cflags': [
                   '--sysroot=<(android_ndk_sysroot)',
                 ],
                 'ldflags': [
                   '--sysroot=<(android_ndk_sysroot)',
                 ],
               }],
+              ['android_build_type==1', {
+                'include_dirs': [
+                  # OpenAL headers from the Android tree.
+                  '<(android_src)/frameworks/wilhelm/include',
+                ],
+                'cflags': [
+                  # Chromium builds its own (non-third-party) code with
+                  # -Werror to make all warnings into errors. However, Android
+                  # enables warnings that Chromium doesn't, so some of these
+                  # extra warnings trip and break things.
+                  # For now, we leave these warnings enabled but prevent them
+                  # from being treated as errors.
+                  #
+                  # Things that are part of -Wextra:
+                  '-Wno-error=extra', # Enabled by -Wextra, but no specific flag
+                  '-Wno-error=ignored-qualifiers',
+                  '-Wno-error=type-limits',
+                  # Other things unrelated to -Wextra:
+                  '-Wno-error=non-virtual-dtor',
+                  '-Wno-error=sign-promo',
+                ],
+                'cflags_cc': [
+                  # Disabling c++0x-compat should be handled in WebKit, but
+                  # this currently doesn't work because gcc_version is not set
+                  # correctly when building with the Android build system.
+                  # TODO(torne): Fix this in WebKit.
+                  '-Wno-error=c++0x-compat',
+                ],
+              }],
+              ['android_build_type==1 and chromium_code==0', {
+                'cflags': [
+                  # There is a class of warning which:
+                  #  1) Android always enables and also treats as errors
+                  #  2) Chromium ignores in third party code
+                  # For now, I am leaving these warnings enabled but preventing
+                  # them from being treated as errors here.
+                  '-Wno-error=address',
+                  '-Wno-error=format-security',
+                  '-Wno-error=non-virtual-dtor',
+                  '-Wno-error=return-type',
+                  '-Wno-error=sequence-point',
+                ],
+              }],
               ['target_arch == "arm"', {
                 'ldflags': [
                   # Enable identical code folding to reduce size.
                   '-Wl,--icf=safe',
                 ],
               }],
               # NOTE: The stlport header include paths below are specified in
               # cflags rather than include_dirs because they need to come
@@ -2756,16 +2953,17 @@
            }], # build_with_mozilla== 0
 
             ],
             'defines': [
               'ANDROID',
               '__GNU_SOURCE=1',  # Necessary for clone()
               'USE_STLPORT=1',
               '_STLP_USE_PTR_SPECIALIZATIONS=1',
+              'CHROME_SYMBOLS_ID="<(chrome_symbols_id)"',
             ],
            }],
           # Settings for building host targets using the system toolchain.
           ['_toolset=="host"', {
             'cflags!': [
               # Due to issues in Clang build system, using ASan on 32-bit
               # binaries on x86_64 host is problematic.
               # TODO(eugenis): re-enable.
@@ -2879,16 +3077,19 @@
                 '-Wno-unnamed-type-template-args',
                 # This (rightyfully) complains about 'override', which we use
                 # heavily.
                 '-Wno-c++11-extensions',
 
                 # Warns on switches on enums that cover all enum values but
                 # also contain a default: branch. Chrome is full of that.
                 '-Wno-covered-switch-default',
+
+                # TODO(thakis): Remove this.
+                '-Wno-implicit-conversion-floating-point-to-bool',
               ],
             }],
             ['clang==1 and clang_use_chrome_plugins==1', {
               'OTHER_CFLAGS': [
                 '<@(clang_chrome_plugins_flags)',
               ],
             }],
             ['clang==1 and clang_load!=""', {
@@ -2929,28 +3130,16 @@
         'target_conditions': [
           ['_type!="static_library"', {
             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
             'conditions': [
               ['asan==1', {
                 'xcode_settings': {
                   'OTHER_LDFLAGS': [
                     '-faddress-sanitizer',
-                    # The symbols below are referenced in the ASan runtime
-                    # library (compiled on OS X 10.6), but may be unavailable
-                    # on the prior OS X versions. Because Chromium is
-                    # currently targeting 10.5.0, we need to explicitly mark
-                    # these symbols as dynamic_lookup.