Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add test for timezonechange event #26555

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

FrankYFTang
Copy link

@FrankYFTang FrankYFTang commented Nov 17, 2020

Add tests to test whatwg/html#3047
WebDriver extension proposal in whatwg/html#3047
@stephenmcgruer @mathiasbynens @littledan

@stephenmcgruer
Copy link
Contributor

stephenmcgruer commented Nov 17, 2020

FYI for WPT folk: This PR is blocked on an RFC for the new testdriver extension, which is in turn blocked on whatwg/html#3047 being updated. Frank is aware of this, and we aren't expecting anything to land until we get those two sorted.

@FrankYFTang
Copy link
Author

FYI for WPT folk: This PR is blocked on an RFC for the new testdriver extension, which is in turn blocked on whatwg/html#3047 being updated. Frank is aware of this, and we aren't expecting anything to land until we get those two sorted.

Agree. I would like to get more other early feedback about the tests itself beside that issue from this PR.

@FrankYFTang
Copy link
Author

@zbraniecki - Would you be able to find someone from Mozilla to support this move too?

@annevk
Copy link
Member

annevk commented Nov 18, 2020

To be clear, Mozilla is supportive of this effort. I'll defer to @jgraham et al for the technical details though.

@stephenmcgruer
Copy link
Contributor

The RFC is now posted at web-platform-tests/rfcs#73, although it is still will not be able to land until whatwg/html#3047 at least has the webdriver text in the PR (preferably also that the PR is landed).

However we're making progress here, so I will start reviewing the WPT test infra side of this PR :)

docs/writing-tests/testdriver.md Outdated Show resolved Hide resolved
tools/wptrunner/wptrunner/executors/protocol.py Outdated Show resolved Hide resolved
tools/wptrunner/wptrunner/testdriver-extra.js Outdated Show resolved Hide resolved
tools/wptrunner/wptrunner/executors/protocol.py Outdated Show resolved Hide resolved
tools/wptrunner/wptrunner/executors/executorwebdriver.py Outdated Show resolved Hide resolved
tools/wptrunner/wptrunner/executors/executorwebdriver.py Outdated Show resolved Hide resolved
tools/wptrunner/wptrunner/executors/actions.py Outdated Show resolved Hide resolved
Copy link
Contributor

@stephenmcgruer stephenmcgruer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few small nits, but this LGTM from the WPT infrastructure perspective, thanks!

I'm marking it request changes currently just until the RFC is merged, then I will switch to Approve.

docs/writing-tests/testdriver.md Outdated Show resolved Hide resolved
docs/writing-tests/testdriver.md Outdated Show resolved Hide resolved
infrastructure/testdriver/set_timezone.html Outdated Show resolved Hide resolved
resources/testdriver.js Outdated Show resolved Hide resolved
resources/testdriver.js Outdated Show resolved Hide resolved
@FrankYFTang
Copy link
Author

Updated. Please take another look

@FrankYFTang
Copy link
Author

PTAL

chromium-wpt-export-bot pushed a commit that referenced this pull request Dec 15, 2020
This CL is NOT intended to be merge into chromium.
I just want to use the chromium tryBot to validate the code is correct.
The WPT PR is in #26555

Bug: 1144403
Change-Id: Ie3c062d1d9e59ee3f9087c7af99df7d2d29b056d
@sideshowbarker sideshowbarker removed their request for review December 15, 2020 18:05
infrastructure/testdriver/set_timezone.html Show resolved Hide resolved
resources/testdriver.js Outdated Show resolved Hide resolved
tools/wptrunner/wptrunner/testdriver-extra.js Outdated Show resolved Hide resolved
timezonechange/addeventlistener-timezonechange-fired.html Outdated Show resolved Hide resolved
@FrankYFTang
Copy link
Author

PTAL

Copy link
Contributor

@mathiasbynens mathiasbynens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % some minor suggestions

Comment on lines 14 to 15
let timeZone = "Asia/Taipei";
let timeZone2 = "Asia/Hong_Kong";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are both GMT+8 (i.e. same local time). Can we use two timezones that actually differ to make the difference more clear? Say, 'Asia/Taipei' and 'Europe/Berlin' (GMT+1), or 'Pacific/Fakaofo' (GMT+13) as you use in the other tests.

Suggested change
let timeZone = "Asia/Taipei";
let timeZone2 = "Asia/Hong_Kong";
const timeZone = "Asia/Taipei";
const timeZone2 = "Pacific/Fakaofo";

WDYT?

@@ -0,0 +1,14 @@
self.addEventListener('message', function(e) {
const message = e.data;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation should be 2 spaces

window.addEventListener('timezonechange', r);
window.test_driver.set_time_zone(newTimeZone);
}).then(e => {
assert_equals(defaultTimeZone(), newTimeZone);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: indentation

Suggested change
assert_equals(defaultTimeZone(), newTimeZone);
assert_equals(defaultTimeZone(), newTimeZone);

port.postMessage("SUCCESS:" + timezone);
};
port.postMessage("READY:" + oldtimezone); // (the html will change the timezone)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit:

Suggested change
}
};

ontimezonechange = evt => {
let timezone = (new Intl.DateTimeFormat()).resolvedOptions().timeZone;
postMessage("SUCCESS:" + timezone);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
}
};

@FrankYFTang
Copy link
Author

It is so hard to merge with the master via git command so I just did a git diff and then hand merge and hard push. Please review it again. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants