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

Unified Diff: client/deps/realtimecomm_playground/pgutil.py

Issue 1338004: Add audioonly playground test. Move common things to dep. (Closed)
Patch Set: More improvement from codereview. Created 10 years, 9 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
« no previous file with comments | « no previous file | client/site_tests/realtimecomm_GTalkAudioPlayground/control » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: client/deps/realtimecomm_playground/pgutil.py
diff --git a/client/deps/realtimecomm_playground/pgutil.py b/client/deps/realtimecomm_playground/pgutil.py
index e3811232c030ea3261e6f6e73ae2e7358f433fb6..0d85877a08a4ec499f7f4de08dc468b8cbc64b95 100644
--- a/client/deps/realtimecomm_playground/pgutil.py
+++ b/client/deps/realtimecomm_playground/pgutil.py
@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
+import os, shutil, time
from autotest_lib.client.bin import test, utils
def get_pids(program_name):
@@ -52,3 +53,44 @@ def get_cpu_usage(duration, time):
"""
return float(time) / float(duration * get_number_of_logical_cpu())
+
+def setup_playground(src, dst, optionfile):
+ """
+ Setup playground files.
+
+ @param src path
+ @param dst path
+ @param optionfile
+ """
+ shutil.rmtree(dst, ignore_errors=True)
+ shutil.copytree(src, dst)
+ utils.run('chown chronos %s -R' % dst)
+
+ dst_path= '/home/chronos/.Google/'
+ opt_path= os.path.join(dst_path, 'Google Talk Plugin')
+ dst_opt = os.path.join(opt_path, 'options')
+ utils.run('mkdir -p \'%s\'' % opt_path)
+ utils.run('cp -f %s \'%s\'' % (optionfile, dst_opt))
+ utils.run('chown chronos \'%s\' -R' % dst_path)
+ utils.run('chmod o+r+w \'%s\'' % dst_opt)
+
+
+def cleanup_playground(playground, testdone=False):
+ """
+ Cleanup playground files.
+
+ @param playground path
+ @param testdone
+ """
+ utils.run('pkill chrome', ignore_status=True)
+ time.sleep(10)
+ utils.run('pkill GoogleTalkPlugin', ignore_status=True)
+ time.sleep(10)
+ utils.run('rm -f /tmp/tmp.log', ignore_status=True)
+ if testdone:
+ shutil.rmtree(playground)
+
+ # Delete previous browser state if any
+ shutil.rmtree('/home/chronos/.config/chromium', ignore_errors=True)
+ shutil.rmtree('/home/chronos/.config/google-chrome', ignore_errors=True)
+
« no previous file with comments | « no previous file | client/site_tests/realtimecomm_GTalkAudioPlayground/control » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698