devtools: drop Shell.serve_local_directory().

This is a convenience wrapper over Shell.serve_local_directories(),
causing more code duplication and burden when changing the interface
than convenience.

R=qsr@chromium.org

Review URL: https://codereview.chromium.org/1411503011 .

Cr-Mirrored-From: https://github.com/domokit/mojo
Cr-Mirrored-Commit: c53f07fda77985d212de1bceafdb5ae9bfe2fcf6
diff --git a/devtoolslib/android_shell.py b/devtoolslib/android_shell.py
index 91c26af..400195c 100644
--- a/devtoolslib/android_shell.py
+++ b/devtoolslib/android_shell.py
@@ -421,16 +421,6 @@
     logcat_watch_thread.start()
 
   @overrides(Shell)
-  def serve_local_directory(self, local_dir_path, port=0, free_host_port=False):
-    assert local_dir_path
-    mappings = [('', [local_dir_path])]
-    host_port = 0 if free_host_port else port
-    server_address = start_http_server(mappings, host_port=host_port)
-
-    return 'http://127.0.0.1:%d/' % self._forward_device_port_to_host(
-        port, server_address[1])
-
-  @overrides(Shell)
   def serve_local_directories(self, mappings, port=0, free_host_port=False):
     assert mappings
     host_port = 0 if free_host_port else port
diff --git a/devtoolslib/linux_shell.py b/devtoolslib/linux_shell.py
index 95161e7..48a2859 100644
--- a/devtoolslib/linux_shell.py
+++ b/devtoolslib/linux_shell.py
@@ -25,11 +25,6 @@
     self.command_prefix = command_prefix if command_prefix else []
 
   @overrides(Shell)
-  def serve_local_directory(self, local_dir_path, port=0, free_host_port=False):
-    mappings = [('', [local_dir_path])]
-    return 'http://%s:%d/' % http_server.start_http_server(mappings, port)
-
-  @overrides(Shell)
   def serve_local_directories(self, mappings, port=0, free_host_port=False):
     return 'http://%s:%d/' % http_server.start_http_server(mappings, port)
 
diff --git a/devtoolslib/shell.py b/devtoolslib/shell.py
index b7f39d8..7e1d395 100644
--- a/devtoolslib/shell.py
+++ b/devtoolslib/shell.py
@@ -6,27 +6,6 @@
 class Shell(object):
   """Represents an abstract Mojo shell."""
 
-  def serve_local_directory(self, local_dir_path, port=0, free_host_port=False):
-    """Serves the content of the local (host) directory, making it available to
-    the shell under the url returned by the function.
-
-    The server will run on a separate thread until the program terminates. The
-    call returns immediately.
-
-    Args:
-      local_dir_path: path to the directory to be served
-      port: port at which the server will be available to the shell. On Android
-          this can be different from the port on which the server runs on the
-          host.
-      free_host_port: spawn the server a system allocated port. This is ignored
-          on Linux, where |port| indicates the port on which the server will be
-          spawned.
-
-    Returns:
-      The url that the shell can use to access the content of |local_dir_path|.
-    """
-    raise NotImplementedError()
-
   def serve_local_directories(self, mappings, port=0, free_host_port=False):
     """Serves the content of the local (host) directories, making it available
     to the shell under the url returned by the function.
diff --git a/devtoolslib/shell_arguments.py b/devtoolslib/shell_arguments.py
index 9df58b3..65e6d3c 100644
--- a/devtoolslib/shell_arguments.py
+++ b/devtoolslib/shell_arguments.py
@@ -36,7 +36,8 @@
   if not os.path.exists(directory):
     raise ValueError('local path passed as --map-url destination '
                      'does not exist')
-  server_url = shell.serve_local_directory(directory, port, free_host_port)
+  mappings = [('', [directory])]
+  server_url = shell.serve_local_directories(mappings, port, free_host_port)
   return server_url + os.path.relpath(dest_file, directory)
 
 
@@ -46,7 +47,8 @@
   Returns:
     Url of the hosted directory.
   """
-  return shell.serve_local_directory(dest_dir, port, free_host_port)
+  mappings = [('', [dest_dir])]
+  return shell.serve_local_directories(mappings, port, free_host_port)
 
 
 def _rewrite(mapping, host_destination_functon, shell, port, free_host_port):
@@ -118,8 +120,8 @@
   Returns:
     The list of arguments to be appended to the shell argument list.
   """
-
-  origin_url = shell.serve_local_directory(local_dir, port, free_host_port)
+  mappings = [('', [local_dir])]
+  origin_url = shell.serve_local_directories(mappings, port, free_host_port)
   return ["--origin=" + origin_url]