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

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

Issue 6823076: Fix functional tests notifications.NotificationsTest(s) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 8 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 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 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 os 6 import os
7 import urllib 7 import urllib
8 8
9 import pyauto_functional 9 import pyauto_functional
10 import pyauto 10 import pyauto
11 11
12 12
(...skipping 16 matching lines...) Expand all
29 29
30 This method will not run automatically. 30 This method will not run automatically.
31 """ 31 """
32 while True: 32 while True:
33 raw_input('Interact with the browser and hit <enter> to dump notification' 33 raw_input('Interact with the browser and hit <enter> to dump notification'
34 'state...') 34 'state...')
35 print '*' * 20 35 print '*' * 20
36 import pprint 36 import pprint
37 pp = pprint.PrettyPrinter(indent=2) 37 pp = pprint.PrettyPrinter(indent=2)
38 pp.pprint(self.GetActiveNotifications()) 38 pp.pprint(self.GetActiveNotifications())
39 pp.pprint(self._GetDefaultPermissionSetting())
39 40
40 def _SetDefaultPermissionSetting(self, setting): 41 def _SetDefaultPermissionSetting(self, setting):
41 """Sets the default setting for whether sites are allowed to create 42 """Sets the default setting for whether sites are allowed to create
42 notifications. 43 notifications.
43 """ 44 """
44 self.SetPrefs(pyauto.kDesktopNotificationDefaultContentSetting, setting) 45 self.SetPrefs(pyauto.kDefaultContentSettings, {u'notifications': setting})
45 46
46 def _GetDefaultPermissionSetting(self): 47 def _GetDefaultPermissionSetting(self):
47 """Gets the default setting for whether sites are allowed to create 48 """Gets the default setting for whether sites are allowed to create
48 notifications. 49 notifications.
49 """ 50 """
50 return self.GetPrefsInfo().Prefs( 51 return self.GetPrefsInfo().Prefs(
51 pyauto.kDesktopNotificationDefaultContentSetting) 52 pyauto.kDefaultContentSettings)[u'notifications']
52 53
53 def _GetDeniedOrigins(self): 54 def _GetDeniedOrigins(self):
54 """Gets the list of origins that are explicitly denied to create 55 """Gets the list of origins that are explicitly denied to create
55 notifications. 56 notifications.
56 """ 57 """
57 return (self.GetPrefsInfo().Prefs(pyauto.kDesktopNotificationDeniedOrigins) 58 return (self.GetPrefsInfo().Prefs(pyauto.kDesktopNotificationDeniedOrigins)
58 or []) 59 or [])
59 60
60 def _GetAllowedOrigins(self): 61 def _GetAllowedOrigins(self):
61 """Gets the list of origins that are explicitly allowed to create 62 """Gets the list of origins that are explicitly allowed to create
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 # Since this notification has the same replaceId, 'chat', it should replace 533 # Since this notification has the same replaceId, 'chat', it should replace
533 # the first notification. 534 # the first notification.
534 self._CreateHTMLNotification(self.NO_SUCH_URL, 'chat') 535 self._CreateHTMLNotification(self.NO_SUCH_URL, 'chat')
535 notifications = self.GetActiveNotifications() 536 notifications = self.GetActiveNotifications()
536 self.assertEquals(1, len(notifications)) 537 self.assertEquals(1, len(notifications))
537 self.assertEquals(self.NO_SUCH_URL, notifications[0]['content_url']) 538 self.assertEquals(self.NO_SUCH_URL, notifications[0]['content_url'])
538 539
539 540
540 if __name__ == '__main__': 541 if __name__ == '__main__':
541 pyauto_functional.Main() 542 pyauto_functional.Main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698