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

Unified Diff: testing/chromoting/browser_tests_launcher.py

Issue 862133002: Update from https://crrev.com/312398 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 months 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 side-by-side diff with in-line comments
Download patch
Index: testing/chromoting/browser_tests_launcher.py
diff --git a/testing/chromoting/browser_tests_launcher.py b/testing/chromoting/browser_tests_launcher.py
index be66955d0c6fec49ef3fc2b89b11d02f66f42022..0cb903b946b989b33e523659808b3335a2e010c3 100644
--- a/testing/chromoting/browser_tests_launcher.py
+++ b/testing/chromoting/browser_tests_launcher.py
@@ -80,20 +80,14 @@ def TestCleanUp(user_profile_dir):
shutil.rmtree(user_profile_dir)
-def InitialiseTestMachineForLinux(cfg_file, manifest_file, user_profile_dir):
+def InitialiseTestMachineForLinux(cfg_file):
"""Sets up a Linux machine for connect-to-host browser-tests.
- Copy over me2me host-config and manifest files to expected locations.
+ Copy over me2me host-config to expected locations.
By default, the Linux me2me host expects the host-config file to be under
$HOME/.config/chrome-remote-desktop
Its name is expected to have a hash that is specific to a machine.
- When a user launches the remoting web-app, the native-message host process is
- started. For this to work, the manifest file for me2me host is expected to be
- in a specific folder under the user-profile dir.
-
- This function performs both the above tasks.
-
TODO(anandc):
Once we have Linux machines in the swarming lab already installed with the
me2me host, this function should also perform the step of starting the host.
@@ -102,8 +96,6 @@ def InitialiseTestMachineForLinux(cfg_file, manifest_file, user_profile_dir):
Args:
cfg_file: location of test account's host-config file.
- manifest_file: location of me2me host manifest file.
- user_profile_dir: user-profile-dir to be used by the connect-to-host tests.
"""
# First get home directory on current machine.
@@ -121,21 +113,39 @@ def InitialiseTestMachineForLinux(cfg_file, manifest_file, user_profile_dir):
config_file_src,
os.path.join(default_config_file_location, default_config_file_name))
- # Next, create a user-profile dir, and place the me2me manifest.json file in
- # the expected location for native-messating-host to work properly.
+ # Finally, start chromoting host.
+ RunCommandInSubProcess(CHROMOTING_HOST_PATH + ' --start')
+
+
+def SetupUserProfileDir(me2me_manifest_file, it2me_manifest_file,
+ user_profile_dir):
+ """Sets up the Google Chrome user profile directory
+
+ Delete the previous user profile directory if exists and create a new one.
+ This invalidates any state changes by the previous test so each test can start
+ with the same environment.
+
+ When a user launches the remoting web-app, the native messaging host process
+ is started. For this to work, this function places the me2me and it2me native
+ messaging host manifest files in a specific folder under the user-profile dir.
+
+ Args:
+ me2me_manifest_file: location of me2me native messaging host manifest file.
+ it2me_manifest_file: location of it2me native messaging host manifest file.
+ user_profile_dir: Chrome user-profile-directory.
+ """
native_messaging_folder = os.path.join(user_profile_dir, NATIVE_MESSAGING_DIR)
if os.path.exists(user_profile_dir):
shutil.rmtree(user_profile_dir)
os.makedirs(native_messaging_folder)
- manifest_file_src = os.path.join(os.getcwd(), manifest_file)
- manifest_file_dest = (
- os.path.join(native_messaging_folder, os.path.basename(manifest_file)))
- shutil.copyfile(manifest_file_src, manifest_file_dest)
-
- # Finally, start chromoting host.
- RunCommandInSubProcess(CHROMOTING_HOST_PATH + ' --start')
+ manifest_files = [me2me_manifest_file, it2me_manifest_file]
+ for manifest_file in manifest_files:
+ manifest_file_src = os.path.join(os.getcwd(), manifest_file)
+ manifest_file_dest = (
+ os.path.join(native_messaging_folder, os.path.basename(manifest_file)))
+ shutil.copyfile(manifest_file_src, manifest_file_dest)
def main():
@@ -146,19 +156,24 @@ def main():
help='path to folder having product and test binaries.')
parser.add_argument('-c', '--cfg_file',
help='path to test host config file.')
- parser.add_argument('-m', '--manifest_file',
+ parser.add_argument('--me2me_manifest_file',
help='path to me2me host manifest file.')
+ parser.add_argument('--it2me_manifest_file',
+ help='path to it2me host manifest file.')
parser.add_argument(
'-u', '--user_profile_dir',
help='path to user-profile-dir, used by connect-to-host tests.')
args = parser.parse_args()
- InitialiseTestMachineForLinux(args.cfg_file, args.manifest_file,
- args.user_profile_dir)
+ InitialiseTestMachineForLinux(args.cfg_file)
with open(args.commands_file) as f:
for line in f:
+ # Reset the user profile directory to start each test with a clean slate.
+ SetupUserProfileDir(args.me2me_manifest_file, args.it2me_manifest_file,
+ args.user_profile_dir)
+
# Replace the PROD_DIR value in the command-line with
# the passed in value.
line = line.replace(PROD_DIR_ID, args.prod_dir)

Powered by Google App Engine
This is Rietveld 408576698