<!DOCTYPE html>
<html>
<body>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script>
var timezone = ["Asia/Taipei", "America/Chicago"];
var i = 0;;
test(function() {
assert_true('ontimezonechange' in window);
}, "Test that timezonechange event handler API is present in window");
async_test((test) => {
window.ontimezonechange = test.step_func_done();
internals.setSystemTimeZone(timezone[i++ % timezone.length]);
}, "Test that the timezonechange event fires on window.ontimezonechange");
async_test((test) => {
window.addEventListener('timezonechange', test.step_func_done());
internals.setSystemTimeZone(timezone[i++ % timezone.length]);
}, "Test that the timezonechange event fires on window.addEventListener('timezonechange')");
async_test((test) => {
window.addEventListener('timezonechange', function(e) {
assert_false(e.cancelable);
assert_false(e.bubbles);
test.done();
});
internals.setSystemTimeZone(timezone[i++ % timezone.length]);
}, "Test properties of the fired event.");
</script>
</body>
</html>