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

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

Issue 10827050: Added a timezone policy and pyauto tests for it. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: 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
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 sys 7 import sys
8 8
9 import pyauto_functional # Must be imported before pyauto 9 import pyauto_functional # Must be imported before pyauto
10 import pyauto 10 import pyauto
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 """) 61 """)
62 return ret == 'false' 62 return ret == 'false'
63 63
64 def testTimezoneIsEditable(self): 64 def testTimezoneIsEditable(self):
65 """Test that the timezone is always editable.""" 65 """Test that the timezone is always editable."""
66 # This test only makes sense if we are not running as the owner. 66 # This test only makes sense if we are not running as the owner.
67 self.assertFalse(self.GetLoginInfo()['is_owner']) 67 self.assertFalse(self.GetLoginInfo()['is_owner'])
68 editable = self._IsTimezoneEditable() 68 editable = self._IsTimezoneEditable()
69 self.assertTrue(editable, msg='Timezone is not editable when not owner.') 69 self.assertTrue(editable, msg='Timezone is not editable when not owner.')
70 70
71 def testSetTimezoneUI(self):
72 """Test that the timezone UI changes internal settings.
73
74 Set the Timezone on the settings page. Check the internal timezone
75 afterwards. Timezones should be always editable."""
76
77 #self.Login(user_index=1, expect_success=True)
Joao da Silva 2012/07/27 13:40:57 Remove?
pneubeck (no reviews) 2012/07/31 22:21:05 Done.
78 for timezone in ['America/Barbados', 'Europe/Helsinki']:
79 self._SetTimezoneInUI(timezone)
80 self.assertTrue(
81 self.WaitUntil(lambda: timezone == self.GetTimeInfo()['timezone']),
Joao da Silva 2012/07/27 13:40:57 Nit: indent
pneubeck (no reviews) 2012/07/31 22:21:05 ah. My emacs mode is not configured correctly :-)
pneubeck (no reviews) 2012/07/31 22:21:05 Done.
82 'Timezone not changed as expected.');
83
84 def _SetTimezoneInUI(self, timezone):
85 self.NavigateToURL('chrome://settings-frame/settings')
86 self.ExecuteJavascript("""
87 var selectElement = document.getElementById('timezone-select');
88 selectElement.value = "%s";
89 var event = document.createEvent("HTMLEvents");
90 event.initEvent("change", true, true);
91 selectElement.dispatchEvent(event);
92 domAutomationController.send("");
93 """ % timezone)
71 94
72 if __name__ == '__main__': 95 if __name__ == '__main__':
73 pyauto_functional.Main() 96 pyauto_functional.Main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698