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

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

Issue 10830193: Remove SWIGged use of BrowserProxy and TabProxy from PyAuto tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Used named arguments and deleted unused test files, as suggested by Nirnimesh. Created 8 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/functional/popups.py ('k') | chrome/test/functional/shortcuts.py » ('j') | 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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 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 shutil 8 import shutil
9 9
10 import pyauto_functional # Must be imported before pyauto 10 import pyauto_functional # Must be imported before pyauto
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 self.ActivateTab(1) 51 self.ActivateTab(1)
52 self.assertEqual(url2, self.GetActiveTabURL().spec()) 52 self.assertEqual(url2, self.GetActiveTabURL().spec())
53 53
54 def testNavigationStateOnSessionRestore(self): 54 def testNavigationStateOnSessionRestore(self):
55 """Verify navigation state is preserved on session restore.""" 55 """Verify navigation state is preserved on session restore."""
56 urls = ('http://www.google.com/', 56 urls = ('http://www.google.com/',
57 'http://news.google.com/', 57 'http://news.google.com/',
58 'http://dev.chromium.org/',) 58 'http://dev.chromium.org/',)
59 for url in urls: 59 for url in urls:
60 self.NavigateToURL(url) 60 self.NavigateToURL(url)
61 tab = self.GetBrowserWindow(0).GetTab(0) 61 self.TabGoBack()
62 tab.GoBack()
63 self.assertEqual(self.GetActiveTabURL().spec(), urls[-2]) 62 self.assertEqual(self.GetActiveTabURL().spec(), urls[-2])
64 self.SetPrefs(pyauto.kRestoreOnStartup, 1) # set pref to restore session 63 self.SetPrefs(pyauto.kRestoreOnStartup, 1) # set pref to restore session
65 self.RestartBrowser(clear_profile=False) 64 self.RestartBrowser(clear_profile=False)
66 # Verify that navigation state (forward/back state) is restored. 65 # Verify that navigation state (forward/back state) is restored.
67 tab = self.GetBrowserWindow(0).GetTab(0) 66 self.TabGoBack()
68 tab.GoBack()
69 self.assertEqual(self.GetActiveTabURL().spec(), urls[0]) 67 self.assertEqual(self.GetActiveTabURL().spec(), urls[0])
70 for i in (-2, -1): 68 for i in (-2, -1):
71 tab.GoForward() 69 tab.GoForward()
72 self.assertEqual(self.GetActiveTabURL().spec(), urls[i]) 70 self.assertEqual(self.GetActiveTabURL().spec(), urls[i])
73 71
74 def testSessionRestoreURLs(self): 72 def testSessionRestoreURLs(self):
75 """Verify restore URLs preference.""" 73 """Verify restore URLs preference."""
76 url1 = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title1.html')) 74 url1 = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title1.html'))
77 url2 = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title2.html')) 75 url2 = self.GetFileURLForPath(os.path.join(self.DataDir(), 'title2.html'))
78 # Set pref to restore given URLs on startup 76 # Set pref to restore given URLs on startup
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 self.DataDir(), 'geolocation', 'geolocation_on_load.html')) 157 self.DataDir(), 'geolocation', 'geolocation_on_load.html'))
160 self.assertEqual(3, # default state 158 self.assertEqual(3, # default state
161 self.GetPrefsInfo().Prefs(pyauto.kGeolocationDefaultContentSetting)) 159 self.GetPrefsInfo().Prefs(pyauto.kGeolocationDefaultContentSetting))
162 self.NavigateToURL(url) 160 self.NavigateToURL(url)
163 self.assertTrue(self.WaitForInfobarCount(1)) 161 self.assertTrue(self.WaitForInfobarCount(1))
164 self.assertTrue(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars']) 162 self.assertTrue(self.GetBrowserInfo()['windows'][0]['tabs'][0]['infobars'])
165 # Disable geolocation 163 # Disable geolocation
166 self.SetPrefs(pyauto.kGeolocationDefaultContentSetting, 2) 164 self.SetPrefs(pyauto.kGeolocationDefaultContentSetting, 2)
167 self.assertEqual(2, 165 self.assertEqual(2,
168 self.GetPrefsInfo().Prefs(pyauto.kGeolocationDefaultContentSetting)) 166 self.GetPrefsInfo().Prefs(pyauto.kGeolocationDefaultContentSetting))
169 self.GetBrowserWindow(0).GetTab(0).Reload() 167 self.ReloadTab()
170 # Fails on Win7/Vista Chromium bots. crbug.com/89000 168 # Fails on Win7/Vista Chromium bots. crbug.com/89000
171 if (self.IsWin7() or self.IsWinVista()) and branding == 'Chromium': 169 if (self.IsWin7() or self.IsWinVista()) and branding == 'Chromium':
172 return 170 return
173 behavior = self._driver.execute_async_script( 171 behavior = self._driver.execute_async_script(
174 'triggerGeoWithCallback(arguments[arguments.length - 1]);') 172 'triggerGeoWithCallback(arguments[arguments.length - 1]);')
175 self.assertEqual( 173 self.assertEqual(
176 behavior, Behaviors.BLOCK, 174 behavior, Behaviors.BLOCK,
177 msg='Behavior is "%s" when it should be BLOCKED.' % behavior) 175 msg='Behavior is "%s" when it should be BLOCKED.' % behavior)
178 176
179 def testUnderTheHoodPref(self): 177 def testUnderTheHoodPref(self):
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 self.assertTrue( 341 self.assertTrue(
344 self._driver.execute_script( 342 self._driver.execute_script(
345 'return doesQueryConformsToProtocol("%s", "%s")' 343 'return doesQueryConformsToProtocol("%s", "%s")'
346 % (asked_handler_dict['query_key'], 344 % (asked_handler_dict['query_key'],
347 asked_handler_dict['query_value'])), 345 asked_handler_dict['query_value'])),
348 msg='Protocol did not register correctly.') 346 msg='Protocol did not register correctly.')
349 347
350 348
351 if __name__ == '__main__': 349 if __name__ == '__main__':
352 pyauto_functional.Main() 350 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/popups.py ('k') | chrome/test/functional/shortcuts.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698