Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(434)

Side by Side Diff: mojo/devtools/common/devtoolslib/android_shell.py

Issue 1411503011: devtools: drop Shell.serve_local_directory(). (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | mojo/devtools/common/devtoolslib/linux_shell.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import atexit 5 import atexit
6 import hashlib 6 import hashlib
7 import json 7 import json
8 import logging 8 import logging
9 import os 9 import os
10 import os.path 10 import os.path
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after
414 host_port = self._forward_host_port_to_device(0, device_port) 414 host_port = self._forward_host_port_to_device(0, device_port)
415 print ("Dart observatory available at the host at http://127.0.0.1:%d" 415 print ("Dart observatory available at the host at http://127.0.0.1:%d"
416 % host_port) 416 % host_port)
417 417
418 logcat_watch_thread = threading.Thread( 418 logcat_watch_thread = threading.Thread(
419 target=_forward_observatories_as_needed) 419 target=_forward_observatories_as_needed)
420 logcat_watch_thread.daemon = True 420 logcat_watch_thread.daemon = True
421 logcat_watch_thread.start() 421 logcat_watch_thread.start()
422 422
423 @overrides(Shell) 423 @overrides(Shell)
424 def serve_local_directory(self, local_dir_path, port=0, free_host_port=False):
425 assert local_dir_path
426 mappings = [('', [local_dir_path])]
427 host_port = 0 if free_host_port else port
428 server_address = start_http_server(mappings, host_port=host_port)
429
430 return 'http://127.0.0.1:%d/' % self._forward_device_port_to_host(
431 port, server_address[1])
432
433 @overrides(Shell)
434 def serve_local_directories(self, mappings, port=0, free_host_port=False): 424 def serve_local_directories(self, mappings, port=0, free_host_port=False):
435 assert mappings 425 assert mappings
436 host_port = 0 if free_host_port else port 426 host_port = 0 if free_host_port else port
437 server_address = start_http_server(mappings, host_port=host_port) 427 server_address = start_http_server(mappings, host_port=host_port)
438 428
439 return 'http://127.0.0.1:%d/' % self._forward_device_port_to_host( 429 return 'http://127.0.0.1:%d/' % self._forward_device_port_to_host(
440 port, server_address[1]) 430 port, server_address[1])
441 431
442 @overrides(Shell) 432 @overrides(Shell)
443 def forward_host_port_to_shell(self, host_port): 433 def forward_host_port_to_shell(self, host_port):
(...skipping 27 matching lines...) Expand all
471 Results.output = rf.read() 461 Results.output = rf.read()
472 462
473 run_thread = threading.Thread(target=do_run) 463 run_thread = threading.Thread(target=do_run)
474 run_thread.start() 464 run_thread.start()
475 run_thread.join(timeout) 465 run_thread.join(timeout)
476 466
477 if run_thread.is_alive(): 467 if run_thread.is_alive():
478 self.stop_shell() 468 self.stop_shell()
479 return None, Results.output, True 469 return None, Results.output, True
480 return None, Results.output, False 470 return None, Results.output, False
OLDNEW
« no previous file with comments | « no previous file | mojo/devtools/common/devtoolslib/linux_shell.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698