Download a prebuilt apprtc from google storage instead of building it.

This should work around node.js issues.

To update prebuilt_apprtc.zip:

1. Clone https://github.com/webrtc/apprtc
2. Follow instructions up to grunt build
3. zip -r prebuilt_apprtc.zip apprtc/
4. cp prebuilt_apprtc.zip /.../webrtc.DEPS/prebuilt_apprtc.zip
4. upload_to_google_storage.py prebuilt_apprtc.zip \
       --bucket=chromium-webrtc-resources
   from the webrtc.DEPS dir.

BUG=569494
R=kjellander@chromium.org

Review URL: https://codereview.chromium.org/1565173002 .
diff --git a/DEPS b/DEPS
index c53c21e..5465298 100644
--- a/DEPS
+++ b/DEPS
@@ -7,8 +7,6 @@
 }
 
 deps = {
-  'apprtc':
-    Var('git_url') + '/external/webrtc/apprtc@3168981efed7629fabee731a5ee74d3716b50652',
   'webrtc.DEPS/third_party/manifestdestiny':
     Var('git_url') + '/chromium/deps/manifestdestiny.git@46ae53ac463e23bfefec374a81806355ea598ac4',
   'webrtc.DEPS/third_party/mozdownload':
@@ -29,7 +27,7 @@
   {
     "pattern": ".",
     "action" : ["python",
-                "webrtc.DEPS/download_appengine_and_mercurial.py",
+                "webrtc.DEPS/download_apprtc_appengine_and_mercurial.py",
                 "webrtc.DEPS"],
   },
   {
@@ -39,12 +37,6 @@
                 "webrtc.DEPS"],
   },
   {
-    "pattern": ".",
-    "action" : ["python",
-                "webrtc.DEPS/download_node.py",
-                "webrtc.DEPS"],
-  },
-  {
     # "Build" AppRTC, i.e. move it to the out/ dir where the browser test
     # can find it. This is only done on runhooks.
     "pattern": ".",
@@ -64,12 +56,6 @@
                 "webrtc.DEPS/build_apprtc_collider.py"],
   },
   {
-    # Build the AppRTC App Engine Application.
-    "pattern": ".",
-    "action" : ["python",
-                "webrtc.DEPS/build_apprtc_appengine_app.py"],
-  },
-  {
     # Download media files and tools used by the webrtc quality browser tests,
     # chrome/browser/media/chrome_webrtc_audio_quality_browsertest.cc and
     # chrome/browser/media/chrome_webrtc_video_quality_browsertest.cc.
diff --git a/build_apprtc_appengine_app.py b/build_apprtc_appengine_app.py
deleted file mode 100755
index 32f9853..0000000
--- a/build_apprtc_appengine_app.py
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/python
-# Copyright 2015 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.
-
-"""Invokes grunt build on AppRTC.
-
-The AppRTC javascript code must be closure-compiled. This script uses
-the node toolchain we downloaded earlier.
-"""
-
-import fileinput
-import os
-import shutil
-import subprocess
-import sys
-
-import utils
-
-
-# Phantomjs generates very deep paths in the node_modules structure and
-# Windows can't deal with that, so just hack that out.
-def _WorkaroundPhantomJsOnWin(samples_path):
-  if utils.GetPlatform() is 'win':
-    package_json = os.path.join(samples_path, 'package.json')
-    if not os.path.exists(package_json):
-      raise Exception('Expected %s to exist.' % os.path.abspath(package_json))
-
-    for line in fileinput.input(package_json, inplace=True):
-      if not 'phantomjs' in line:
-        sys.stdout.write(line)
-
-
-def _WorkAroundMacNpmCorruptedDataOnInstall(command):
-  print 'Wiping .npm folder and trying again...'
-  npm_storage = os.path.expanduser('~/.npm')
-  assert npm_storage.endswith('.npm')
-  utils.RemoveDirectory(npm_storage)
-  utils.RunSubprocessWithRetry(command)
-
-
-def main():
-  node_path = os.path.abspath('node')
-  if not os.path.exists(node_path):
-    return 'Expected node at %s.' % node_path
-  apprtc_path = os.path.join('src', 'out', 'apprtc')
-  if not os.path.exists(apprtc_path):
-    return 'Expected apprtc at %s.' % os.path.abspath(apprtc_path)
-
-  _WorkaroundPhantomJsOnWin(apprtc_path)
-  os.chdir(apprtc_path)
-
-  if utils.GetPlatform() is 'win':
-    npm_bin = os.path.join(node_path, 'npm.cmd')
-    node_bin = os.path.join(node_path, 'node.exe')
-  else:
-    npm_bin = os.path.join(node_path, 'bin', 'npm')
-    node_bin = os.path.join(node_path, 'bin', 'node')
-
-  command = [npm_bin, 'install']
-  try:
-    utils.RunSubprocessWithRetry(command)
-  except subprocess.CalledProcessError:
-    if utils.GetPlatform() is not 'mac':
-      raise
-    _WorkAroundMacNpmCorruptedDataOnInstall(command)
-
-  local_grunt_bin = os.path.join('node_modules', 'grunt-cli', 'bin', 'grunt')
-
-  if not os.path.exists(local_grunt_bin):
-    return ('Missing grunt-cli in the apprtc checkout; did '
-            'npm install fail?')
-
-  utils.RunSubprocessWithRetry([node_bin, local_grunt_bin, 'build'])
-
-
-if __name__ == '__main__':
-  sys.exit(main())
diff --git a/download_appengine_and_mercurial.py b/download_apprtc_appengine_and_mercurial.py
similarity index 87%
rename from download_appengine_and_mercurial.py
rename to download_apprtc_appengine_and_mercurial.py
index e2b3139..853923e 100755
--- a/download_appengine_and_mercurial.py
+++ b/download_apprtc_appengine_and_mercurial.py
@@ -44,6 +44,9 @@
   mercurial_tar_path = os.path.join(webrtc_deps_path, 'mercurial-src.tar.gz')
   old_mercurial_sha1 = utils.ComputeSHA1(mercurial_tar_path)
 
+  apprtc_zip_path = os.path.join(webrtc_deps_path, 'prebuilt_apprtc.zip')
+  old_apprtc_sha1 = utils.ComputeSHA1(mercurial_tar_path)
+
   _DownloadResources(webrtc_deps_path)
 
   if old_appengine_sha1 != utils.ComputeSHA1(appengine_zip_path):
@@ -55,5 +58,9 @@
     utils.UnpackToWorkingDir(mercurial_tar_path)
     _StripVersionNumberFromMercurialFolder()
 
+  if old_apprtc_sha1 != utils.ComputeSHA1(apprtc_zip_path):
+    utils.DeleteDirNextToGclient('apprtc')
+    utils.UnpackToWorkingDir(apprtc_zip_path)
+
 if __name__ == '__main__':
   sys.exit(main(sys.argv))
diff --git a/node/linux/node.tar.gz.sha1 b/node/linux/node.tar.gz.sha1
deleted file mode 100644
index 5706dea..0000000
--- a/node/linux/node.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-3a202a749492e48542d2c28220e43ef6dae084bc
\ No newline at end of file
diff --git a/node/mac/node.tar.gz.sha1 b/node/mac/node.tar.gz.sha1
deleted file mode 100644
index ed7bec7..0000000
--- a/node/mac/node.tar.gz.sha1
+++ /dev/null
@@ -1 +0,0 @@
-98f61cb09685ed45f2db6e0fc5ccbdd273204091
\ No newline at end of file
diff --git a/node/win/README b/node/win/README
deleted file mode 100644
index 640dab1..0000000
--- a/node/win/README
+++ /dev/null
@@ -1,9 +0,0 @@
-This zip file requires some manual work. First, download node.exe
-from http://nodejs.org/download/, then download the npm stuff from
-http://nodejs.org/dist/npm/. Unzip both in the same dir and do this:
-
-mkdir node
-mv node.exe node
-mv npm.cmd node
-mv node_modules node
-zip -r node.zip node
diff --git a/node/win/node.zip.sha1 b/node/win/node.zip.sha1
deleted file mode 100644
index f5bf9e4..0000000
--- a/node/win/node.zip.sha1
+++ /dev/null
@@ -1 +0,0 @@
-a0f8d1cf0ef8375f1a760a3c33d6a9f69b045103
\ No newline at end of file
diff --git a/prebuilt_apprtc.zip.sha1 b/prebuilt_apprtc.zip.sha1
new file mode 100644
index 0000000..055d743
--- /dev/null
+++ b/prebuilt_apprtc.zip.sha1
@@ -0,0 +1 @@
+bde0926197fe5ac9c104a102ba07c75a19c72c6d
\ No newline at end of file