summaryrefslogtreecommitdiffstats
path: root/chrome/test
diff options
context:
space:
mode:
authornirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-17 01:08:32 +0000
committernirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-17 01:08:32 +0000
commita8d51e57a9c90a133c9cab6e6924a66846d6f284 (patch)
treedcda9f032aa2ee45523a78f93a6e0a13fb90877b /chrome/test
parent522278595e313199b9efccc0d84fe7d612834d92 (diff)
downloadchromium_src-a8d51e57a9c90a133c9cab6e6924a66846d6f284.zip
chromium_src-a8d51e57a9c90a133c9cab6e6924a66846d6f284.tar.gz
chromium_src-a8d51e57a9c90a133c9cab6e6924a66846d6f284.tar.bz2
Add fitToWidth and fitToHeight actions to the pdf runner test.
BUG= TEST= Review URL: http://codereview.chromium.org/5105001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66354 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test')
-rw-r--r--chrome/test/functional/pdf.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/test/functional/pdf.py b/chrome/test/functional/pdf.py
index fa3a133..8bc7ee63 100644
--- a/chrome/test/functional/pdf.py
+++ b/chrome/test/functional/pdf.py
@@ -16,6 +16,21 @@ class PDFTest(pyauto.PyUITest):
This test runs only on Google Chrome build, not on Chromium.
"""
+ def _PerformPDFAction(self, action, tab_index=0, windex=0):
+ """Perform an action on a PDF tab.
+
+ Args:
+ action: one of "fitToHeight", "fitToWidth", "ZoomIn", "ZoomOut"
+ tab_index: tab index Defaults to 0
+ windex: window index. Defaults to 0
+ """
+ assert action in ('fitToHeight', 'fitToWidth', 'ZoomIn', 'ZoomOut')
+ js = 'document.getElementsByName("plugin")[0].%s()' % action
+ # Add an empty string so that there's something to return back
+ # (or else it hangs)
+ return self.GetDOMValue('%s + ""' % js, 0, tab_index)
+
+
def testPDFRunner(self):
"""Navigate to pdf files and verify that browser doesn't crash"""
# bail out if not a branded build
@@ -27,6 +42,10 @@ class PDFTest(pyauto.PyUITest):
for pdf_file in pdf_files:
url = self.GetFileURLForPath(os.path.join(pdf_files_path, pdf_file))
self.AppendTab(pyauto.GURL(url))
+ for tab_index in range(1, len(pdf_files) + 1):
+ self.ActivateTab(tab_index)
+ self._PerformPDFAction('fitToHeight', tab_index=tab_index)
+ self._PerformPDFAction('fitToWidth', tab_index=tab_index)
# Assert that there is at least 1 browser window.
self.assertTrue(self.GetBrowserWindowCount(),
'Browser crashed, no window is open')