autotest: move constants to common_lib

This file gets imported from lots of server-side tests and
infrastructure so it shouldn't be hiding in client/cros. This
moves the file and fixes all imports.

BUG=chromium:485834
TEST=run many tests, make sure there are no problems importing
  constants

Change-Id: I5c2b2a0bef6ebc998e62f40162a6ec9cc4436480
Reviewed-on: https://chromium-review.googlesource.com/291302
Trybot-Ready: Eric Caruso <ejcaruso@chromium.org>
Commit-Queue: Eric Caruso <ejcaruso@chromium.org>
Tested-by: Eric Caruso <ejcaruso@chromium.org>
Reviewed-by: Chris Sosa <sosa@google.com>
diff --git a/client/cros/bluetooth/bluetooth_device_xmlrpc_server.py b/client/cros/bluetooth/bluetooth_device_xmlrpc_server.py
index c31db46..4330923 100755
--- a/client/cros/bluetooth/bluetooth_device_xmlrpc_server.py
+++ b/client/cros/bluetooth/bluetooth_device_xmlrpc_server.py
@@ -16,8 +16,8 @@
 
 import common
 from autotest_lib.client.bin import utils
+from autotest_lib.client.common_lib.cros import constants
 from autotest_lib.client.common_lib.cros.bluetooth import bluetooth_socket
-from autotest_lib.client.cros import constants
 from autotest_lib.client.cros import xmlrpc_server
 
 
diff --git a/client/cros/bluetooth/bluetooth_tester_xmlrpc_server.py b/client/cros/bluetooth/bluetooth_tester_xmlrpc_server.py
index b11479f..f3e9b4c 100755
--- a/client/cros/bluetooth/bluetooth_tester_xmlrpc_server.py
+++ b/client/cros/bluetooth/bluetooth_tester_xmlrpc_server.py
@@ -10,9 +10,9 @@
 import logging.handlers
 
 import common
+from autotest_lib.client.common_lib.cros import constants
 from autotest_lib.client.common_lib.cros.bluetooth import bluetooth_sdp_socket
 from autotest_lib.client.common_lib.cros.bluetooth import bluetooth_socket
-from autotest_lib.client.cros import constants
 from autotest_lib.client.cros import xmlrpc_server
 
 
diff --git a/client/cros/chrome_binary_test.py b/client/cros/chrome_binary_test.py
index ac81238..18866f5 100755
--- a/client/cros/chrome_binary_test.py
+++ b/client/cros/chrome_binary_test.py
@@ -6,7 +6,7 @@
 
 from autotest_lib.client.bin import test, utils
 from autotest_lib.client.common_lib import error
-from autotest_lib.client.cros import constants
+from autotest_lib.client.common_lib.cros import constants
 from autotest_lib.client.cros.graphics import graphics_utils
 
 
diff --git a/client/cros/constants.py b/client/cros/constants.py
deleted file mode 100644
index 0b04b8f..0000000
--- a/client/cros/constants.py
+++ /dev/null
@@ -1,189 +0,0 @@
-# Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-# The names of expected mount-points, devices, magic files, etc on chrome os.
-
-# Constants used by other constants.
-USER_DATA_DIR = '/home/chronos'
-WHITELIST_DIR = '/var/lib/whitelist'
-LOG_DIR = '/var/log'
-
-# Rest of constants.
-BROWSER = 'chrome'
-BROWSER_EXE = '/opt/google/chrome/' + BROWSER
-
-CHAPS_USER_DATABASE_PATH = '/home/chronos/user/.chaps/database'
-
-CHROME_CORE_MAGIC_FILE = '/mnt/stateful_partition/etc/collect_chrome_crashes'
-CHROME_LOG_DIR = '/var/log/chrome'
-CHROME_VERSION_COMMAND = BROWSER_EXE + ' --version'
-
-# Directory to save log files preserved during autoupdate.
-AUTOUPDATE_PRESERVE_LOG = '/mnt/stateful_partition/unencrypted/preserve/log'
-
-CLEANUP_LOGS_PAUSED_FILE = '/var/lib/cleanup_logs_paused'
-
-CLIENT_LOGIN_URL = '/accounts/ClientLogin'
-CLIENT_LOGIN_NEW_URL = '/ClientLogin'
-
-CRASH_DIR = '/var/spool/crash'
-CRASH_REPORTER_RESIDUE_DIR = '/tmp/crash_reporter'
-
-# LOGS to collect from DUTs
-LOG_CONSOLE_RAMOOPS = '/dev/pstore/console-ramoops'
-LOG_I915_ERROR_STATE = '/sys/kernel/debug/dri/0/i915_error_state'
-PRIOR_LOGS_DIR = '/mnt/stateful_partition/unencrypted/prior_logs'
-
-CREDENTIALS = {
-    '$mockowner': ['mockowner.test.account@gmail.com', 'perfsmurf'],
-    '$default': ['performance.test.account@gmail.com', 'perfsmurf'],
-    '$apps': ['performance.test.account@googleapps.com', 'perfsmurf'],
-    '$backdoor': ['chronos@gmail.com', 'chronos'],
-}
-
-SHADOW_ROOT = '/home/.shadow'
-
-CRYPTOHOME_DEV_REGEX_ANY = r'.*'
-CRYPTOHOME_DEV_REGEX_REGULAR_USER_SHADOW = r'^/home/\.shadow/.*/vault$'
-CRYPTOHOME_DEV_REGEX_REGULAR_USER_EPHEMERAL = r'^ephemeralfs/.*$'
-CRYPTOHOME_DEV_REGEX_REGULAR_USER = r'(%s|%s)' % (
-    CRYPTOHOME_DEV_REGEX_REGULAR_USER_SHADOW,
-    CRYPTOHOME_DEV_REGEX_REGULAR_USER_EPHEMERAL)
-CRYPTOHOME_DEV_REGEX_GUEST = r'^guestfs$'
-
-CRYPTOHOME_FS_REGEX_ANY = r'.*'
-CRYPTOHOME_FS_REGEX_TMPFS = r'^tmpfs$'
-
-CRYPTOHOME_MOUNT_PT = USER_DATA_DIR + '/user'
-
-CRYPTOHOMED_LOG = '/var/log/cryptohomed.log'
-
-# Directories to copy out of cryptohome, relative to CRYPTOHOME_MOUNT_PT.
-CRYPTOHOME_DIRS_TO_RECOVER = ['crash', 'log']
-
-DISABLE_BROWSER_RESTART_MAGIC_FILE = '/var/run/disable_chrome_restart'
-DEFAULT_OWNERSHIP_TIMEOUT = 300  # Ownership is an inherently random process.
-
-ENABLE_BROWSER_HANG_DETECTION_FILE = \
-    '/var/run/session_manager/enable_hang_detection'
-
-FLIMFLAM_TEST_PATH = '/usr/lib/flimflam/test/'
-
-GUEST_USER = '$guest'
-
-LOGIN_PROFILE = USER_DATA_DIR + '/Default'
-
-LOGIN_PROMPT_STATUS_COMMAND = 'bootstat_get_last login-prompt-visible'
-
-LSB_RELEASE = '/etc/lsb-release'
-
-MOCK_OWNER_CERT = 'mock_owner_cert.pem'
-MOCK_OWNER_KEY = 'mock_owner_private.key'
-MOCK_OWNER_POLICY = 'mock_owner.policy'
-
-NETWORK_MANAGER = 'flimflam'
-
-ISSUE_AUTH_TOKEN_URL = '/accounts/IssueAuthToken'
-ISSUE_AUTH_TOKEN_NEW_URL = '/IssueAuthToken'
-
-OAUTH1_GET_REQUEST_TOKEN_URL = '/accounts/o8/GetOAuthToken'
-OAUTH1_GET_REQUEST_TOKEN_NEW_URL = '/o/oauth/GetOAuthToken/'
-OAUTH1_GET_ACCESS_TOKEN_URL = '/accounts/OAuthGetAccessToken'
-OAUTH1_GET_ACCESS_TOKEN_NEW_URL = '/OAuthGetAccessToken'
-OAUTH_LOGIN_URL = '/accounts/OAuthLogin'
-OAUTH_LOGIN_NEW_URL = '/OAuthLogin'
-MERGE_SESSION_URL = '/MergeSession'
-
-OAUTH2_CLIENT_ID = '77185425430.apps.googleusercontent.com'
-OAUTH2_CLIENT_SECRET = 'OTJgUOQcT7lO7GsGZq2G4IlT'
-OAUTH2_WRAP_BRIDGE_URL = '/accounts/OAuthWrapBridge'
-OAUTH2_WRAP_BRIDGE_NEW_URL = '/OAuthWrapBridge'
-OAUTH2_GET_AUTH_CODE_URL = '/o/oauth2/programmatic_auth'
-OAUTH2_GET_TOKEN_URL = '/o/oauth2/token'
-
-OWNER_KEY_FILE = WHITELIST_DIR + '/owner.key'
-
-PORTAL_CHECK_URL = '/generate_204'
-
-SERVICE_LOGIN_URL = '/accounts/ServiceLogin'
-SERVICE_LOGIN_NEW_URL = '/ServiceLogin'
-SERVICE_LOGIN_AUTH_URL = '/ServiceLoginAuth'
-SERVICE_LOGIN_AUTH_ERROR = 'The username or password you entered is incorrect.'
-
-SESSION_MANAGER = 'session_manager'
-SIGNED_POLICY_FILE = WHITELIST_DIR + '/policy'
-SPECIAL_CASE_DOMAIN = 'gmail.com'
-USER_POLICY_DIR = '/var/run/user_policy'
-USER_POLICY_KEY_FILENAME = 'policy.pub'
-
-TOKEN_AUTH_URL = '/accounts/TokenAuth'
-TOKEN_AUTH_NEW_URL = '/TokenAuth'
-
-UI_LOG = '/var/log/ui/ui.LATEST'
-UI_RESPAWN_TIMESTAMPS_FILE = '/tmp/ui-respawn-timestamps'
-UI_TOO_CRASHY_TIMESTAMPS_FILE = '/tmp/ui-too-crashy-timestamps'
-UPDATE_ENGINE_LOG = '/var/log/update_engine.log'
-
-RESOLV_CONF_FILE = '/etc/resolv.conf'
-
-PENDING_SHUTDOWN_PATH = '/var/lib/crash_reporter/pending_clean_shutdown'
-UNCLEAN_SHUTDOWN_DETECTED_PATH = '/var/run/unclean-shutdown-detected'
-
-INTERACTIVE_XMLRPC_SERVER_PORT = 9980
-INTERACTIVE_XMLRPC_SERVER_COMMAND = (
-        'cd /usr/local/autotest/common_lib/cros; '
-        './interactive_xmlrpc_server.py')
-INTERACTIVE_XMLRPC_SERVER_CLEANUP_PATTERN = 'interactive_xmlrpc_server'
-INTERACTIVE_XMLRPC_SERVER_READY_METHOD = 'ready'
-
-SHILL_XMLRPC_SERVER_PORT = 9989
-SHILL_XMLRPC_SERVER_COMMAND = (
-        'cd /usr/local/autotest/cros/networking; '
-        './shill_xmlrpc_server.py')
-SHILL_XMLRPC_SERVER_CLEANUP_PATTERN = 'shill_xmlrpc_server'
-SHILL_XMLRPC_SERVER_READY_METHOD = 'ready'
-
-BLUETOOTH_DEVICE_XMLRPC_SERVER_PORT = 9990
-BLUETOOTH_DEVICE_XMLRPC_SERVER_COMMAND = (
-        'cd /usr/local/autotest/cros/bluetooth; '
-        './bluetooth_device_xmlrpc_server.py')
-BLUETOOTH_DEVICE_XMLRPC_SERVER_CLEANUP_PATTERN = (
-        'bluetooth_device_xmlrpc_server')
-BLUETOOTH_DEVICE_XMLRPC_SERVER_READY_METHOD = 'ready'
-
-BLUETOOTH_TESTER_XMLRPC_SERVER_PORT = 9990
-BLUETOOTH_TESTER_XMLRPC_SERVER_COMMAND = (
-        'cd /usr/local/autotest/cros/bluetooth;  '
-        './bluetooth_tester_xmlrpc_server.py')
-BLUETOOTH_TESTER_XMLRPC_SERVER_CLEANUP_PATTERN = (
-        'bluetooth_tester_xmlrpc_server')
-BLUETOOTH_TESTER_XMLRPC_SERVER_READY_METHOD = 'ready'
-
-MULTIMEDIA_XMLRPC_SERVER_PORT = 9991
-MULTIMEDIA_XMLRPC_SERVER_COMMAND = (
-        'cd /usr/local/autotest/cros/multimedia; '
-        './multimedia_xmlrpc_server.py')
-MULTIMEDIA_XMLRPC_SERVER_RESTART_COMMAND = (
-        'cd /usr/local/autotest/cros/multimedia; '
-        './multimedia_xmlrpc_server.py --restart')
-MULTIMEDIA_XMLRPC_SERVER_CLEANUP_PATTERN = 'multimedia_xmlrpc_server'
-MULTIMEDIA_XMLRPC_SERVER_READY_METHOD = 'ready'
-MULTIMEDIA_TEST_EXTENSION = (
-        '/usr/local/autotest/cros/multimedia/multimedia_test_extension')
-
-APMANAGER_XMLRPC_SERVER_PORT = 9992
-APMANAGER_XMLRPC_SERVER_COMMAND = (
-        'cd /usr/local/autotest/cros/networking; '
-        './apmanager_xmlrpc_server.py')
-APMANAGER_XMLRPC_SERVER_CLEANUP_PATTERN = 'apmanager_xmlrpc_server'
-APMANAGER_XMLRPC_SERVER_READY_METHOD = 'ready'
-
-# Bug filing
-CHROME_VERSION = 'CHROME_VERSION'
-
-# Moblab Environment Constants.
-MOBLAB_USER = 'moblab'
-
-# Variant test keyval
-VARIANT_KEY = 'variant_key'
diff --git a/client/cros/crash_test.py b/client/cros/crash_test.py
index 38c40fa..07717bd 100644
--- a/client/cros/crash_test.py
+++ b/client/cros/crash_test.py
@@ -4,9 +4,10 @@
 
 import contextlib, fcntl, logging, os, re, shutil
 
-import common, constants, cros_logging
+import common, cros_logging
 from autotest_lib.client.bin import test, utils
 from autotest_lib.client.common_lib import error
+from autotest_lib.client.common_lib.cros import constants
 
 
 class CrashTest(test.test):
diff --git a/client/cros/cros_logging.py b/client/cros/cros_logging.py
index 3056c02..649c70e 100644
--- a/client/cros/cros_logging.py
+++ b/client/cros/cros_logging.py
@@ -7,7 +7,7 @@
 import common
 from autotest_lib.client.bin import utils
 from autotest_lib.client.common_lib import error
-from constants import CLEANUP_LOGS_PAUSED_FILE
+from autotest_lib.client.common_lib.cros.constants import CLEANUP_LOGS_PAUSED_FILE
 
 
 def strip_timestamp(msg):
diff --git a/client/cros/cros_ui.py b/client/cros/cros_ui.py
index 56decdb..6a52787 100644
--- a/client/cros/cros_ui.py
+++ b/client/cros/cros_ui.py
@@ -6,7 +6,7 @@
 
 from autotest_lib.client.bin import utils
 from autotest_lib.client.common_lib import error
-from autotest_lib.client.cros import constants
+from autotest_lib.client.common_lib.cros import constants
 
 # Log messages used to signal when we're restarting UI. Used to detect
 # crashes by cros_ui_test.UITest.
diff --git a/client/cros/cryptohome.py b/client/cros/cryptohome.py
index a0c6734..8a6b567 100644
--- a/client/cros/cryptohome.py
+++ b/client/cros/cryptohome.py
@@ -5,9 +5,10 @@
 import dbus, gobject, logging, os, random, re, shutil, string
 from dbus.mainloop.glib import DBusGMainLoop
 
-import common, constants
+import common
 from autotest_lib.client.bin import utils
 from autotest_lib.client.common_lib import error
+from autotest_lib.client.common_lib.cros import constants
 from autotest_lib.client.cros.cros_disks import DBusClient
 
 CRYPTOHOME_CMD = '/usr/sbin/cryptohome'
diff --git a/client/cros/dns_server.py b/client/cros/dns_server.py
index 57571cb..ece6be5 100644
--- a/client/cros/dns_server.py
+++ b/client/cros/dns_server.py
@@ -2,10 +2,11 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-import common, constants, logging, os, socket, stat, sys, threading, time
+import common, logging, os, socket, stat, sys, threading, time
 
 from autotest_lib.client.bin import utils
 from autotest_lib.client.common_lib import error
+from autotest_lib.client.common_lib.cros import constants
 
 class LocalDns(object):
     """A wrapper around miniFakeDns that runs the server in a separate thread
diff --git a/client/cros/flimflam_test_path.py b/client/cros/flimflam_test_path.py
index a81b9aa..e076927 100644
--- a/client/cros/flimflam_test_path.py
+++ b/client/cros/flimflam_test_path.py
@@ -4,7 +4,7 @@
 
 import os, sys
 
-import constants
+from autotest_lib.client.common_lib.cros import constants
 
 sys.path.append(os.environ.get("SYSROOT", "/usr/local/") +
                 constants.FLIMFLAM_TEST_PATH)
diff --git a/client/cros/login.py b/client/cros/login.py
index 9637c5d..057dea4 100644
--- a/client/cros/login.py
+++ b/client/cros/login.py
@@ -4,9 +4,10 @@
 
 import logging, os
 
-import constants, cros_logging, cros_ui, cryptohome
+import cros_logging, cros_ui, cryptohome
 from autotest_lib.client.bin import utils
 from autotest_lib.client.common_lib import error
+from autotest_lib.client.common_lib.cros import constants
 
 
 class CrashError(error.TestError):
diff --git a/client/cros/multimedia/display_facade_native.py b/client/cros/multimedia/display_facade_native.py
index 74bd99a..9866d53 100644
--- a/client/cros/multimedia/display_facade_native.py
+++ b/client/cros/multimedia/display_facade_native.py
@@ -12,8 +12,10 @@
 import time
 from autotest_lib.client.bin import utils
 from autotest_lib.client.common_lib import error
-from autotest_lib.client.common_lib.cros import chrome, retry
-from autotest_lib.client.cros import constants, sys_power
+from autotest_lib.client.common_lib.cros import chrome
+from autotest_lib.client.common_lib.cros import constants
+from autotest_lib.client.common_lib.cros import retry
+from autotest_lib.client.cros import sys_power
 from autotest_lib.client.cros.graphics import graphics_utils
 from autotest_lib.client.cros.multimedia import image_generator
 
diff --git a/client/cros/multimedia/multimedia_xmlrpc_server.py b/client/cros/multimedia/multimedia_xmlrpc_server.py
index 70ef626..25bde07 100755
--- a/client/cros/multimedia/multimedia_xmlrpc_server.py
+++ b/client/cros/multimedia/multimedia_xmlrpc_server.py
@@ -12,8 +12,9 @@
 import traceback
 import common   # pylint: disable=unused-import
 from autotest_lib.client.bin import utils
-from autotest_lib.client.common_lib.cros import chrome, xmlrpc_server
-from autotest_lib.client.cros import constants
+from autotest_lib.client.common_lib.cros import chrome
+from autotest_lib.client.common_lib.cros import constants
+from autotest_lib.client.common_lib.cros import xmlrpc_server
 from autotest_lib.client.cros.multimedia import audio_facade_native
 from autotest_lib.client.cros.multimedia import display_facade_native
 
diff --git a/client/cros/networking/apmanager_xmlrpc_server.py b/client/cros/networking/apmanager_xmlrpc_server.py
index 4e5dfb7..c49adb1 100755
--- a/client/cros/networking/apmanager_xmlrpc_server.py
+++ b/client/cros/networking/apmanager_xmlrpc_server.py
@@ -9,7 +9,7 @@
 
 import common
 from autotest_lib.client.common_lib import error
-from autotest_lib.client.cros import constants
+from autotest_lib.client.common_lib.cros import constants
 from autotest_lib.client.cros import xmlrpc_server
 from autotest_lib.client.cros.networking import apmanager_proxy
 
diff --git a/client/cros/networking/shill_xmlrpc_server.py b/client/cros/networking/shill_xmlrpc_server.py
index 415b38b..b64fe05 100755
--- a/client/cros/networking/shill_xmlrpc_server.py
+++ b/client/cros/networking/shill_xmlrpc_server.py
@@ -11,9 +11,9 @@
 
 import common
 from autotest_lib.client.common_lib import utils
+from autotest_lib.client.common_lib.cros import constants
 from autotest_lib.client.common_lib.cros.network import xmlrpc_datatypes
 from autotest_lib.client.cros import xmlrpc_server
-from autotest_lib.client.cros import constants
 from autotest_lib.client.cros import cros_ui
 from autotest_lib.client.cros import sys_power
 from autotest_lib.client.cros import tpm_store
diff --git a/client/cros/ownership.py b/client/cros/ownership.py
index cc4c41a..6a6f0cf 100644
--- a/client/cros/ownership.py
+++ b/client/cros/ownership.py
@@ -4,9 +4,10 @@
 
 import logging, os, shutil, tempfile
 
-import common, constants, cryptohome
+import common, cryptohome
 from autotest_lib.client.bin import utils
 from autotest_lib.client.common_lib import autotemp, error
+from autotest_lib.client.common_lib.cros import constants
 from autotest_lib.client.cros import cros_ui