OLD | NEW |
(Empty) | |
| 1 # Copyright (c) 2010 The Chromium OS Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 import os, time |
| 6 |
| 7 from autotest_lib.client.bin import test, utils |
| 8 from autotest_lib.client.common_lib import error, site_ui |
| 9 |
| 10 class realtimecomm_GTalkPlayground(test.test): |
| 11 version = 1 |
| 12 playground = '/home/chronos/playground' |
| 13 |
| 14 # The tarball is created from GTalk Playground. |
| 15 # https://sites.google.com/a/google.com/wavelet/Home/video-playground |
| 16 def setup(self, tarball='GTalkPlayground.tar.gz'): |
| 17 if os.path.exists(self.playground): |
| 18 utils.system('rm -rf %s' % self.playground) |
| 19 tarball = utils.unmap_url(self.bindir, tarball, self.tmpdir) |
| 20 utils.extract_tarball_to_dir(tarball, self.srcdir) |
| 21 |
| 22 |
| 23 def run_cleanup(self): |
| 24 utils.run('killall chrome', ignore_status=True) |
| 25 time.sleep(1) |
| 26 utils.run('killall GoogleTalkPlugin', ignore_status=True) |
| 27 time.sleep(1) |
| 28 utils.run('rm -f /tmp/tmp.log', ignore_status=True) |
| 29 utils.run('rm -rf %s' % self.playground) |
| 30 |
| 31 |
| 32 def run_setup(self): |
| 33 utils.run('cp -r %s %s' % (self.srcdir, self.playground)) |
| 34 utils.run('chown chronos %s -R' % self.playground) |
| 35 src_opt = os.path.join(self.bindir, 'options') |
| 36 des_path= '/home/chronos/.Google/' |
| 37 opt_path= os.path.join(des_path, 'Google Talk Plugin') |
| 38 des_opt = os.path.join(opt_path, 'options') |
| 39 utils.run('mkdir -p \'%s\'' % opt_path) |
| 40 utils.run('cp -f %s \'%s\'' % (src_opt, des_opt)) |
| 41 utils.run('chown chronos \'%s\' -R' % des_path) |
| 42 utils.run('chmod o+r+w \'%s\'' % des_opt) |
| 43 |
| 44 |
| 45 def run_verification(self): |
| 46 # TODO(zhurun): Add more checking and perf data collection. |
| 47 if not os.path.exists('/tmp/tmp.log'): |
| 48 raise error.TestFail('GTalk log file not exist!') |
| 49 try: |
| 50 log = open(r'/tmp/tmp.log') |
| 51 try: |
| 52 content = log.read() |
| 53 if not "Found V4L2 capture" in content: |
| 54 raise error.TestFail('V4L2 not found!') |
| 55 if not "video state, recv=1 send=1" in content: |
| 56 raise error.TestFail('Error in Video send/recv!') |
| 57 if not "voice state, recv=1 send=1" in content: |
| 58 raise error.TestFail('Error in Audio send/recv!') |
| 59 if not "Decoded framerate" in content: |
| 60 raise error.TestFail('Error in Video upstream!') |
| 61 if not "Rendered framerate" in content: |
| 62 raise error.TestFail('Error in Video downstream!') |
| 63 finally: |
| 64 log.close() |
| 65 except IOError: |
| 66 raise error.TestFail('Error in reading GTalk log file!') |
| 67 |
| 68 |
| 69 def run_once(self): |
| 70 self.run_cleanup() |
| 71 self.run_setup() |
| 72 |
| 73 # Launch Playground |
| 74 path = os.path.join(self.playground, |
| 75 'buzz/javascript/media/examples') |
| 76 page = 'videoplayground.html' |
| 77 para = 'callType=v' |
| 78 playground_url = "%s/%s?%s" % (path, page, para) |
| 79 session = site_ui.ChromeSession(playground_url) |
| 80 time.sleep(60) |
| 81 session.close() |
| 82 |
| 83 # Verify log |
| 84 self.run_verification() |
| 85 self.run_cleanup() |
OLD | NEW |