telemetry.page.page_test
index
telemetry/page/page_test.py

# Copyright (c) 2012 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.

 
Modules
       
telemetry.page.actions.all_page_actions
telemetry.core.command_line
telemetry.page.actions.interact
logging
telemetry.page.actions.navigate
telemetry.page.actions.page_action
telemetry.page.test_expectations

 
Classes
       
exceptions.Exception(exceptions.BaseException)
Failure
telemetry.core.command_line.ArgumentHandlerMixIn(__builtin__.object)
PageTest

 
class Failure(exceptions.Exception)
    Exception that can be thrown from PageMeasurement to indicate an
undesired but designed-for problem.
 
 
Method resolution order:
Failure
exceptions.Exception
exceptions.BaseException
__builtin__.object

Data descriptors defined here:
__weakref__
list of weak references to the object (if defined)

Methods inherited from exceptions.Exception:
__init__(...)
x.__init__(...) initializes x; see help(type(x)) for signature

Data and other attributes inherited from exceptions.Exception:
__new__ = <built-in method __new__ of type object>
T.__new__(S, ...) -> a new object with type S, a subtype of T

Methods inherited from exceptions.BaseException:
__delattr__(...)
x.__delattr__('name') <==> del x.name
__getattribute__(...)
x.__getattribute__('name') <==> x.name
__getitem__(...)
x.__getitem__(y) <==> x[y]
__getslice__(...)
x.__getslice__(i, j) <==> x[i:j]
 
Use of negative indices is not supported.
__reduce__(...)
__repr__(...)
x.__repr__() <==> repr(x)
__setattr__(...)
x.__setattr__('name', value) <==> x.name = value
__setstate__(...)
__str__(...)
x.__str__() <==> str(x)
__unicode__(...)

Data descriptors inherited from exceptions.BaseException:
__dict__
args
message

 
class PageTest(telemetry.core.command_line.ArgumentHandlerMixIn)
    A class styled on unittest.TestCase for creating page-specific tests.
 
 
Method resolution order:
PageTest
telemetry.core.command_line.ArgumentHandlerMixIn
__builtin__.object

Methods defined here:
CanRunForPage(self, page)
Override to customize if the test can be ran for the given page.
CleanUpAfterPage(self, page, tab)
Called after the test run method was run, even if it failed.
CreateExpectations(self, page_set)
Override to make this test generate its own expectations instead of
any that may have been defined in the page set.
CreatePageSet(self, args, options)
Override to make this test generate its own page set instead of
allowing arbitrary page sets entered from the command-line.
CustomizeBrowserOptions(self, options)
Override to add test-specific options to the BrowserOptions object
CustomizeBrowserOptionsForPageSet(self, page_set, options)
Set options required for this page set.
 
These options will be used every time the browser is started while running
this page set. They may, however, be further modified by
CustomizeBrowserOptionsForSinglePage or by the profiler.
CustomizeBrowserOptionsForSinglePage(self, page, options)
Set options specific to the test and the given page.
 
This will be called with the current page when the browser is (re)started.
Changing options at this point only makes sense if the browser is being
restarted for each page. Note that if page has a startup_url, the browser
will always be restarted for each run.
DidNavigateToPage(self, page, tab)
Override to do operations right after the page is navigated and after
all waiting for completion has occurred.
DidRunAction(self, page, tab, action)
Override to do operations after running the action on the page.
DidRunActions(self, page, tab)
Override to do operations after running the actions on the page.
DidRunPageRepeats(self, page)
Override to do operations after each page is iterated over.
DidRunTest(self, browser, results)
Override to do operations after all page set(s) are completed.
 
This will occur before the browser is torn down.
DidStartBrowser(self, browser)
Override to customize the browser right after it has launched.
DidStartHTTPServer(self, tab)
Override to do operations after the HTTP server is started.
IsExiting(self)
RequestExit(self)
RestartBrowserBeforeEachPage(self)
Should the browser be restarted for the page?
 
This returns true if the test needs to unconditionally restart the
browser for each page. It may be called before the browser is started.
Run(self, page, tab, results)
RunNavigateSteps(self, page, tab)
Navigates the tab to the page URL attribute.
 
Runs the 'navigate_steps' page attribute as a compound action.
StopBrowserAfterPage(self, browser, page)
Should the browser be stopped after the page is run?
 
This is called after a page is run to decide whether the browser needs to
be stopped to clean up its state. If it is stopped, then it will be
restarted to run the next page.
 
A test that overrides this can look at both the page and the browser to
decide whether it needs to stop the browser.
TabForPage(self, page, browser)
Override to select a different tab for the page.  For instance, to
create a new tab for every page, return browser.tabs.New().
ValidatePageSet(self, page_set)
Override to examine the page set before the test run.  Useful for
example to validate that the pageset can be used with the test.
WillNavigateToPage(self, page, tab)
Override to do operations before the page is navigated, notably Telemetry
will already have performed the following operations on the browser before
calling this function:
* Ensure only one tab is open.
* Call WaitForDocumentReadyStateToComplete on the tab.
WillRunAction(self, page, tab, action)
Override to do operations before running the action on the page.
WillRunActions(self, page, tab)
Override to do operations before running the actions on the page.
WillRunPageRepeats(self, page)
Override to do operations before each page is iterated over.
WillRunTest(self, options)
Override to do operations before the page set(s) are navigated.
WillStartBrowser(self, browser)
Override to manipulate the browser environment before it launches.
__init__(self, test_method_name, action_name_to_run='', needs_browser_restart_after_each_page=False, discard_first_result=False, clear_cache_before_each_run=False, attempts=3, max_failures=None, max_errors=None)

Data descriptors defined here:
action_name_to_run
attempts
Maximum number of times test will be attempted.
clear_cache_before_each_run
When set to True, the browser's disk and memory cache will be cleared
before each run.
close_tabs_before_run
When set to True, all tabs are closed before running the test for the
first time.
discard_first_result
When set to True, the first run of the test is discarded.  This is
useful for cases where it's desirable to have some test resource cached so
the first run of the test can warm things up.
max_errors
Maximum number of errors allowed for the page set.
max_failures
Maximum number of failures allowed for the page set.

Class methods inherited from telemetry.core.command_line.ArgumentHandlerMixIn:
AddCommandLineArgs(cls, parser) from __builtin__.type
Override to accept custom command-line arguments.
ProcessCommandLineArgs(cls, parser, args) from __builtin__.type
Override to process command-line arguments.
 
We pass in parser so we can call parser.error().

Data descriptors inherited from telemetry.core.command_line.ArgumentHandlerMixIn:
__dict__
dictionary for instance variables (if defined)
__weakref__
list of weak references to the object (if defined)

 
Functions
       
GetCompoundActionFromPage(page, action_name, interactive=False)
GetSubactionFromData(page, subaction_data, interactive)