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

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

Issue 3066017: Test to verify the 'multiple downloads' infobar (Closed)
Patch Set: jrg Created 10 years, 4 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
« 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')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 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 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import logging 6 import logging
7 import os 7 import os
8 import re 8 import re
9 9
10 import pyauto_functional # Must be imported before pyauto 10 import pyauto_functional # Must be imported before pyauto
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 self.WaitForInfobarCount(1, windex=1, tab_index=0) 103 self.WaitForInfobarCount(1, windex=1, tab_index=0)
104 self._VerifyGeolocationInfobar(windex=1, tab_index=0, match_text=match_text) 104 self._VerifyGeolocationInfobar(windex=1, tab_index=0, match_text=match_text)
105 # Incognito window 105 # Incognito window
106 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) 106 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW)
107 self.NavigateToURL(url, 2, 0) 107 self.NavigateToURL(url, 2, 0)
108 self.WaitForInfobarCount(1, windex=2, tab_index=0) 108 self.WaitForInfobarCount(1, windex=2, tab_index=0)
109 self._VerifyGeolocationInfobar(windex=2, tab_index=0, match_text=match_text) 109 self._VerifyGeolocationInfobar(windex=2, tab_index=0, match_text=match_text)
110 110
111 def testMultipleDownloadsInfobar(self): 111 def testMultipleDownloadsInfobar(self):
112 """Verify the mutiple downloads infobar.""" 112 """Verify the mutiple downloads infobar."""
113 assert pyauto.PyUITest.IsEnUS()
114 file_url = self.GetFileURLForPath( 113 file_url = self.GetFileURLForPath(
115 os.path.join(self.DataDir(), 'downloads', 'download-a_zip_file.html')) 114 os.path.join(self.DataDir(), 'downloads', 'download-a_zip_file.html'))
116 match_text = 'This site is attempting to download multiple files. ' \ 115 match_text = 'This site is attempting to download multiple files. ' \
117 'Do you want to allow this?' 116 'Do you want to allow this?'
118 self.NavigateToURL('chrome://downloads') # trigger download manager 117 self.NavigateToURL('chrome://downloads') # trigger download manager
119 # Clear existing files of the same name in the downloads folder 118 # Clear existing files of the same name in the downloads folder
120 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 119 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(),
121 'a_zip_file.zip') 120 'a_zip_file.zip')
122 os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) 121 os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
123 self.DownloadAndWaitForStart(file_url) 122 self.DownloadAndWaitForStart(file_url)
124 # trigger page reload, which triggers the download infobar 123 # trigger page reload, which triggers the download infobar
125 self.GetBrowserWindow(0).GetTab(0).Reload() 124 self.GetBrowserWindow(0).GetTab(0).Reload()
126 self.WaitForInfobarCount(1) 125 self.WaitForInfobarCount(1)
127 tab_info = self._GetTabInfo(0, 0) 126 tab_info = self._GetTabInfo(0, 0)
128 infobars = tab_info['infobars'] 127 infobars = tab_info['infobars']
129 self.assertTrue(infobars, 'Expected the multiple downloads infobar') 128 self.assertTrue(infobars, 'Expected the multiple downloads infobar')
130 self.assertEqual(1, len(infobars)) 129 self.assertEqual(1, len(infobars))
131 self.assertEqual(match_text, infobars[0]['text'])
132 self.assertEqual(2, len(infobars[0]['buttons'])) 130 self.assertEqual(2, len(infobars[0]['buttons']))
133 self.assertEqual('Allow', infobars[0]['buttons'][0]) 131 if pyauto.PyUITest.IsEnUS():
134 self.assertEqual('Deny', infobars[0]['buttons'][1]) 132 self.assertEqual(match_text, infobars[0]['text'])
133 self.assertEqual('Allow', infobars[0]['buttons'][0])
134 self.assertEqual('Deny', infobars[0]['buttons'][1])
135 else:
136 logging.warn('Not matching text in infobar for non en-US')
135 # Ensure we quit only after all downloads have completed 137 # Ensure we quit only after all downloads have completed
136 self.WaitForAllDownloadsToComplete() 138 self.WaitForAllDownloadsToComplete()
137 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 139 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(),
138 'a_zip_file.zip') 140 'a_zip_file.zip')
139 os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) 141 os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
140 142
141 143
142 if __name__ == '__main__': 144 if __name__ == '__main__':
143 pyauto_functional.Main() 145 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