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

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: Addressed comments. 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 _SetTimezoneInUI(self, timezone):
72 self.NavigateToURL('chrome://settings-frame/settings')
73 self.ExecuteJavascript("""
74 var selectElement = document.getElementById('timezone-select');
75 selectElement.value = "%s";
76 var event = document.createEvent("HTMLEvents");
77 event.initEvent("change", true, true);
78 selectElement.dispatchEvent(event);
79 domAutomationController.send("");
80 """ % timezone)
81
82 def testSetTimezoneUI(self):
83 """Test that the timezone UI changes internal settings.
84
85 Set the Timezone on the settings page. Check the internal timezone
86 afterwards. Timezones should be always editable."""
87
88 for timezone in ['America/Barbados', 'Europe/Helsinki']:
89 self._SetTimezoneInUI(timezone)
90 self.assertTrue(
91 self.WaitUntil(lambda: timezone == self.GetTimeInfo()['timezone']),
92 'Timezone not changed as expected.');
71 93
72 if __name__ == '__main__': 94 if __name__ == '__main__':
73 pyauto_functional.Main() 95 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/chromeos_device_policy.py ('k') | chrome/test/functional/policy_test_cases.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698