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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/extensions.py
===================================================================
--- chrome/test/functional/extensions.py (revision 0)
+++ chrome/test/functional/extensions.py (revision 0)
@@ -0,0 +1,65 @@
+#!/usr/bin/python
+# Copyright (c) 2010 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+This module is a simple qa tool that installs extensions and tests whether the
+browser crashes while visiting a list of urls.
+
+Usage: python extensions.py -v
+
+Note: This assumes that there is a directory of extensions in called
+'extensions' and that there is a file of newline-separated urls to visit called
+'urls.txt' in the same directory as the script.
+"""
+
+import glob
+import logging
+import os
+import sys
+
+import pyauto_functional # must be imported before pyauto
+import pyauto
+
+
+class ExtensionsTest(pyauto.PyUITest):
+ """Test of extensions."""
+ # TODO: provide a way in pyauto to pass args to a test and take these as args
+ extensions_dir_ = 'extensions' # The directory of extensions
+ urls_file_ = 'urls.txt' # The file which holds a list of urls to visit
+
+ def testExtensionCrashes(self):
+ """Add top extensions; confirm browser stays up when visiting top urls"""
+ self.assertTrue(os.path.exists(self.extensions_dir_),
+ 'The dir "%s" must exist' % os.path.abspath(self.extensions_dir_))
+ self.assertTrue(os.path.exists(self.urls_file_),
+ 'The file "%s" must exist' % os.path.abspath(self.urls_file_))
+
+ extensions_group_size = 1
+ num_urls_to_visit = 100
+
+ extensions = glob.glob(os.path.join(self.extensions_dir_, '*.crx'))
+ top_urls = [l.rstrip() for l in open(self.urls_file_).readlines()]
+
+ curr_extension = 0
+ num_extensions = len(extensions)
+
+ while curr_extension < num_extensions:
+ logging.debug('New group of %d extensions.' % extensions_group_size)
+ group_end = curr_extension + extensions_group_size
+ for extension in extensions[curr_extension:group_end]:
+ logging.debug('Installing extension: %s' % extension)
+ self.InstallExtension(pyauto.FilePath(extension), False)
+
+ # Navigate to the top urls and verify there is still one window
+ for url in top_urls[:num_urls_to_visit]:
+ self.NavigateToURL(url)
+ self.assertEqual(1, self.GetBrowserWindowCount(),
+ 'Extensions in failing group: %s' %
+ extensions[curr_extension:group_end])
+ curr_extension = group_end
+
+
+if __name__ == '__main__':
+ pyauto_functional.Main()
Property changes on: chrome/test/functional/extensions.py
___________________________________________________________________
Added: svn:mergeinfo
« 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