OLD | NEW |
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 Loading... |
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.'); | |
93 | 71 |
94 if __name__ == '__main__': | 72 if __name__ == '__main__': |
95 pyauto_functional.Main() | 73 pyauto_functional.Main() |
OLD | NEW |