Home | History | Annotate | Download | only in utilities
      1 #!/usr/bin/env python
      2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
      3 # Use of this source code is governed by a BSD-style license that can be
      4 # found in the LICENSE file.
      5 
      6 import logging
      7 import pyauto_functional # has to be imported before pyauto
      8 import pyauto
      9 import sys
     10 
     11 VM_CHROMEDRIVER_PORT = 4444
     12 
     13 if __name__ == '__main__':
     14   """Script to prepare machine state for use as a WebDriver-controlled VM.
     15 
     16   This script is intended to be run manually over ssh on a Chromium OS virtual
     17   machine qcow2 image. Manually create a snapshot of the VM when prompted. The
     18   resulting VM image will have ChromeDriver listening on port 4444.
     19   """
     20   pyauto_suite = pyauto.PyUITestSuite(sys.argv)
     21   pyuitest = pyauto.PyUITest()
     22   pyuitest.setUp()
     23   driver = pyuitest.NewWebDriver(port=VM_CHROMEDRIVER_PORT)
     24   logging.info('WebDriver is listening on port %d.'
     25                % VM_CHROMEDRIVER_PORT)
     26   logging.info('Machine prepared for VM snapshot.')
     27   raw_input('Please snapshot the VM and hit ENTER when done to '
     28             'terminate this script.')
     29   pyuitest.tearDown()
     30   del pyuitest
     31   del pyauto_suite
     32