Commit e5362568 authored by Frank Tang's avatar Frank Tang Committed by Chromium LUCI CQ

Change to time_zone, timeZone and set_time_zone

Sync w/ https://github.com/whatwg/html/pull/3047

Bug: 1144403
Change-Id: I67694714ee5799e2e731b4d0534a7c182871fc23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2574533Reviewed-by: default avatarShengfa Lin <shengfa@google.com>
Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Commit-Queue: Frank Tang <ftang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#836007}
parent 06a01108
...@@ -665,8 +665,8 @@ class ChromeDriver(object): ...@@ -665,8 +665,8 @@ class ChromeDriver(object):
def GenerateTestReport(self, message): def GenerateTestReport(self, message):
self.ExecuteCommand(Command.GENERATE_TEST_REPORT, {'message': message}) self.ExecuteCommand(Command.GENERATE_TEST_REPORT, {'message': message})
def SetTimezone(self, timezone): def SetTimeZone(self, timeZone):
return self.ExecuteCommand(Command.SET_TIMEZONE, {'timezone': timezone}) return self.ExecuteCommand(Command.SET_TIME_ZONE, {'time_zone': timeZone})
def AddVirtualAuthenticator(self, protocol=None, transport=None, def AddVirtualAuthenticator(self, protocol=None, transport=None,
hasResidentKey=None, hasUserVerification=None, hasResidentKey=None, hasUserVerification=None,
......
...@@ -182,7 +182,7 @@ class Command(object): ...@@ -182,7 +182,7 @@ class Command(object):
_Method.POST, '/session/:sessionId/chromium/send_command_and_get_result') _Method.POST, '/session/:sessionId/chromium/send_command_and_get_result')
GENERATE_TEST_REPORT = ( GENERATE_TEST_REPORT = (
_Method.POST, '/session/:sessionId/reporting/generate_test_report') _Method.POST, '/session/:sessionId/reporting/generate_test_report')
SET_TIMEZONE = (_Method.POST, '/session/:sessionId/timezone') SET_TIME_ZONE = (_Method.POST, '/session/:sessionId/time_zone')
ADD_VIRTUAL_AUTHENTICATOR = ( ADD_VIRTUAL_AUTHENTICATOR = (
_Method.POST, '/session/:sessionId/webauthn/authenticator') _Method.POST, '/session/:sessionId/webauthn/authenticator')
REMOVE_VIRTUAL_AUTHENTICATOR = ( REMOVE_VIRTUAL_AUTHENTICATOR = (
......
...@@ -884,10 +884,10 @@ HttpHandler::HttpHandler( ...@@ -884,10 +884,10 @@ HttpHandler::HttpHandler(
WrapToCommand("QuitAll", base::BindRepeating(&ExecuteQuit, true)), WrapToCommand("QuitAll", base::BindRepeating(&ExecuteQuit, true)),
&session_thread_map_)), &session_thread_map_)),
// Set Timezone command // Set Time Zone command
CommandMapping(kPost, "session/:sessionId/timezone", CommandMapping(kPost, "session/:sessionId/time_zone",
WrapToCommand("SetTimezone", WrapToCommand("SetTimeZone",
base::BindRepeating(&ExecuteSetTimezone))), base::BindRepeating(&ExecuteSetTimeZone))),
// //
// ChromeDriver specific extension commands. // ChromeDriver specific extension commands.
......
...@@ -1275,7 +1275,7 @@ Status ExecuteGenerateTestReport(Session* session, ...@@ -1275,7 +1275,7 @@ Status ExecuteGenerateTestReport(Session* session,
return Status(kOk); return Status(kOk);
} }
Status ExecuteSetTimezone(Session* session, Status ExecuteSetTimeZone(Session* session,
const base::DictionaryValue& params, const base::DictionaryValue& params,
std::unique_ptr<base::Value>* value) { std::unique_ptr<base::Value>* value) {
WebView* web_view = nullptr; WebView* web_view = nullptr;
...@@ -1283,12 +1283,12 @@ Status ExecuteSetTimezone(Session* session, ...@@ -1283,12 +1283,12 @@ Status ExecuteSetTimezone(Session* session,
if (status.IsError()) if (status.IsError())
return status; return status;
std::string timezone; std::string time_zone;
if (!params.GetString("timezone", &timezone)) if (!params.GetString("time_zone", &time_zone))
return Status(kInvalidArgument, "missing parameter 'timezone'"); return Status(kInvalidArgument, "missing parameter 'time_zone'");
base::DictionaryValue body; base::DictionaryValue body;
body.SetString("timezoneId", timezone); body.SetString("timezoneId", time_zone);
web_view->SendCommandAndGetResult("Emulation.setTimezoneOverride", body, web_view->SendCommandAndGetResult("Emulation.setTimezoneOverride", body,
value); value);
......
...@@ -167,7 +167,7 @@ Status ExecuteGenerateTestReport(Session* session, ...@@ -167,7 +167,7 @@ Status ExecuteGenerateTestReport(Session* session,
const base::DictionaryValue& params, const base::DictionaryValue& params,
std::unique_ptr<base::Value>* value); std::unique_ptr<base::Value>* value);
Status ExecuteSetTimezone(Session* session, Status ExecuteSetTimeZone(Session* session,
const base::DictionaryValue& params, const base::DictionaryValue& params,
std::unique_ptr<base::Value>* value); std::unique_ptr<base::Value>* value);
......
...@@ -2694,7 +2694,7 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer): ...@@ -2694,7 +2694,7 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer):
self.assertEquals('test', report['type']); self.assertEquals('test', report['type']);
self.assertEquals('test report message', report['body']['message']); self.assertEquals('test report message', report['body']['message']);
def testSetTimezone(self): def testSetTimeZone(self):
defaultTimeZoneScript = ''' defaultTimeZoneScript = '''
return (new Intl.DateTimeFormat()).resolvedOptions().timeZone; return (new Intl.DateTimeFormat()).resolvedOptions().timeZone;
'''; ''';
...@@ -2705,7 +2705,7 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer): ...@@ -2705,7 +2705,7 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer):
self._driver.Load(self.GetHttpUrlForFile('/chromedriver/empty.html')) self._driver.Load(self.GetHttpUrlForFile('/chromedriver/empty.html'))
# Test to switch to Taipei # Test to switch to Taipei
self._driver.SetTimezone('Asia/Taipei'); self._driver.SetTimeZone('Asia/Taipei');
timeZone = self._driver.ExecuteScript(defaultTimeZoneScript) timeZone = self._driver.ExecuteScript(defaultTimeZoneScript)
self.assertEquals('Asia/Taipei', timeZone); self.assertEquals('Asia/Taipei', timeZone);
localHour = self._driver.ExecuteScript(localHourScript) localHour = self._driver.ExecuteScript(localHourScript)
...@@ -2713,7 +2713,7 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer): ...@@ -2713,7 +2713,7 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer):
self.assertEquals(8, localHour); self.assertEquals(8, localHour);
# Test to switch to Tokyo # Test to switch to Tokyo
self._driver.SetTimezone('Asia/Tokyo'); self._driver.SetTimeZone('Asia/Tokyo');
timeZone = self._driver.ExecuteScript(defaultTimeZoneScript) timeZone = self._driver.ExecuteScript(defaultTimeZoneScript)
self.assertEquals('Asia/Tokyo', timeZone); self.assertEquals('Asia/Tokyo', timeZone);
localHour = self._driver.ExecuteScript(localHourScript) localHour = self._driver.ExecuteScript(localHourScript)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment