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

Side by Side Diff: tools/chrome_remote_control/chrome_remote_control/page_test.py

Issue 10984018: [chrome_remote_control] Add pylint to PRESUMMIT and fix lint (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for landing Created 8 years, 2 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
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 import csv
5 import logging
6 import os
7 import sys
8 import traceback
9
10 class Failure(Exception): 4 class Failure(Exception):
11 """Exception that can be thrown from MultiPageBenchmark to indicate an 5 """Exception that can be thrown from MultiPageBenchmark to indicate an
12 undesired but designed-for problem.""" 6 undesired but designed-for problem."""
13 pass 7 pass
14 8
15 class PageTestResults(object): 9 class PageTestResults(object):
16 def __init__(self): 10 def __init__(self):
17 self.page_failures = [] 11 self.page_failures = []
18 12
19 def AddFailure(self, page, exception, trace): 13 def AddFailure(self, page, exception, trace):
20 self.page_failures.append({'page': page, 14 self.page_failures.append({'page': page,
21 'exception': exception, 15 'exception': exception,
22 'trace': traceback.format_exc()}) 16 'trace': trace})
23 17
24 class PageTest(object): 18 class PageTest(object):
25 """A class styled on unittest.TestCase for creating page-specific tests.""" 19 """A class styled on unittest.TestCase for creating page-specific tests."""
26 20
27 def __init__(self, test_method_name): 21 def __init__(self, test_method_name):
22 self.options = None
28 try: 23 try:
29 self._test_method = getattr(self, test_method_name) 24 self._test_method = getattr(self, test_method_name)
30 except AttributeError: 25 except AttributeError:
31 raise ValueError, 'No such method %s.%s' % ( 26 raise ValueError, 'No such method %s.%s' % (
32 self.__class_, test_method_name) 27 self.__class_, test_method_name) # pylint: disable=E1101
33 28
34 def AddOptions(self, parser): 29 def AddOptions(self, parser):
35 """Override to expose command-line options for this benchmark. 30 """Override to expose command-line options for this benchmark.
36 31
37 The provided parser is an optparse.OptionParser instance and accepts all 32 The provided parser is an optparse.OptionParser instance and accepts all
38 normal results. The parsed options are available in MeasurePage as 33 normal results. The parsed options are available in MeasurePage as
39 self.options.""" 34 self.options."""
40 pass 35 pass
41 36
42 def CustomizeBrowserOptions(self, options): 37 def CustomizeBrowserOptions(self, options):
43 """Override to add test-specific options to the BrowserOptions object""" 38 """Override to add test-specific options to the BrowserOptions object"""
44 pass 39 pass
45 40
46 def Run(self, options, page, tab, results): 41 def Run(self, options, page, tab, results):
47 self.options = options 42 self.options = options
48 try: 43 try:
49 self._test_method(page, tab, results) 44 self._test_method(page, tab, results)
50 pass
51 finally: 45 finally:
52 self.options = None 46 self.options = None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698