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

Side by Side Diff: chrome/test/functional/extensions.py

Issue 2831020: A qa tool for checking that the browser stays open after installing extensions (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 10 years, 6 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:mergeinfo
OLDNEW
(Empty)
1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 """
7 This module is a simple qa tool that installs extensions and tests whether the
8 browser crashes while visiting a list of urls.
9
10 Usage: python extensions.py -v
11
12 Note: This assumes that there is a directory of extensions in called
13 'extensions' and that there is a file of newline-separated urls to visit called
14 'urls.txt' in the same directory as the script.
15 """
16
17 import glob
18 import logging
19 import os
20 import sys
21
22 import pyauto_functional # must be imported before pyauto
23 import pyauto
24
25
26 class ExtensionsTest(pyauto.PyUITest):
27 """Test of extensions."""
28 # TODO: provide a way in pyauto to pass args to a test and take these as args
29 extensions_dir_ = 'extensions' # The directory of extensions
30 urls_file_ = 'urls.txt' # The file which holds a list of urls to visit
31
32 def testExtensionCrashes(self):
33 """Add top extensions; confirm browser stays up when visiting top urls"""
34 self.assertTrue(os.path.exists(self.extensions_dir_),
35 'The dir "%s" must exist' % os.path.abspath(self.extensions_dir_))
36 self.assertTrue(os.path.exists(self.urls_file_),
37 'The file "%s" must exist' % os.path.abspath(self.urls_file_))
38
39 extensions_group_size = 1
40 num_urls_to_visit = 100
41
42 extensions = glob.glob(os.path.join(self.extensions_dir_, '*.crx'))
43 top_urls = [l.rstrip() for l in open(self.urls_file_).readlines()]
44
45 curr_extension = 0
46 num_extensions = len(extensions)
47
48 while curr_extension < num_extensions:
49 logging.debug('New group of %d extensions.' % extensions_group_size)
50 group_end = curr_extension + extensions_group_size
51 for extension in extensions[curr_extension:group_end]:
52 logging.debug('Installing extension: %s' % extension)
53 self.InstallExtension(pyauto.FilePath(extension), False)
54
55 # Navigate to the top urls and verify there is still one window
56 for url in top_urls[:num_urls_to_visit]:
57 self.NavigateToURL(url)
58 self.assertEqual(1, self.GetBrowserWindowCount(),
59 'Extensions in failing group: %s' %
60 extensions[curr_extension:group_end])
61 curr_extension = group_end
62
63
64 if __name__ == '__main__':
65 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698