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

Side by Side Diff: functional/plugins_check.py

Issue 6523003: Separating plugins test for individual platforms (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/test/
Patch Set: '' Created 9 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « data/win_plugins_list.txt ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import logging 6 import logging
7 import os 7 import os
8 import sys 8 import sys
9 9
10 import pyauto_functional # Must be imported before pyauto 10 import pyauto_functional # Must be imported before pyauto
11 import pyauto 11 import pyauto
12 12
13 13
14 class PluginsCheck(pyauto.PyUITest): 14 class PluginsCheck(pyauto.PyUITest):
15 """TestCase for Plugins.""" 15 """TestCase for Plugins."""
16 16
17 def _ReadPluginsList(self): 17 def _ReadPluginsList(self, plugins_list_file):
18 """Read test plugins list from a file based on the test platform 18 """Read test plugins list from a file based on the test platform
19 19
20 File contains list of plugins like, 20 File contains list of plugins like,
21 [ 21 [
22 {u'name':'Shockwave Flash', u'enabled':True, u'version':u'10.2.154.9'} 22 {u'name':'Shockwave Flash', u'enabled':True, u'version':u'10.2.154.9'}
23 {u'name':'Chrome PDF Viewer', u'enabled':True, u'version':u''} 23 {u'name':'Chrome PDF Viewer', u'enabled':True, u'version':u''}
24 ... 24 ...
25 ] 25 ]
26 """ 26 """
27 file_path = os.path.join(self.DataDir(), 'plugins_list.txt') 27 file_path = os.path.join(self.DataDir(), plugins_list_file)
28 return self.EvalDataFrom(file_path) 28 return self.EvalDataFrom(file_path)
29 29
30 def testPluginsStates(self): 30 def testPluginsStates(self):
31 """Verify plugins' versions and states.""" 31 """Verify plugins' versions and states."""
32 if self.IsLinux(): 32 if self.IsWin():
33 plugins_list = self._ReadPluginsList('win_plugins_list.txt')
34 elif self.IsMac():
35 plugins_list = self._ReadPluginsList('mac_plugins_list.txt')
36 elif self.IsLinux():
33 # TODO(rohitbm) 37 # TODO(rohitbm)
34 # Add plugins_check support for Linux 38 # Add plugins_check support for Linux
35 logging.debug('Not performing plugins check on linux') 39 logging.debug('Not performing plugins check on linux')
36 return 40 return
41
37 browser_plugins_list = self.GetPluginsInfo().Plugins() 42 browser_plugins_list = self.GetPluginsInfo().Plugins()
38 version_sep = '.' 43 for plugin in plugins_list:
39 if self.IsWin():
40 # Windows flash plugin version uses |,| instead of |.|
41 version_sep = ','
42 for plugin in self._ReadPluginsList():
43 test_plugin = [x['name'] for x in browser_plugins_list \ 44 test_plugin = [x['name'] for x in browser_plugins_list \
44 if x['version'] == plugin['version'].replace('.', version_sep) and \ 45 if x['version'] == plugin['version'] and \
45 str(x['enabled']) == plugin['enabled'] and \ 46 str(x['enabled']) == plugin['enabled'] and \
46 x['name'] == plugin['name']] 47 x['name'] == plugin['name']]
47 plugin_info = '[ NAME : %s, VERSION: %s, ENABLED: %s]' % \ 48 plugin_info = '[ NAME : %s, VERSION: %s, ENABLED: %s]' % \
48 (plugin['name'], plugin['version'], plugin['enabled']) 49 (plugin['name'], plugin['version'], plugin['enabled'])
49 logging.debug(plugin_info) 50 logging.debug(plugin_info)
50 self.assertTrue(test_plugin, '%s - Failed to match with plugins' 51 self.assertTrue(test_plugin, '%s - Failed to match with plugins'
51 ' available in the browser plugins list' % plugin_info) 52 ' available in the browser plugins list' % plugin_info)
52 53
53 54
54 if __name__ == '__main__': 55 if __name__ == '__main__':
55 pyauto_functional.Main() 56 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « data/win_plugins_list.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698