emails: Add detection for ChromeOS User-Agents.

This commit is contained in:
Robert Spier 2018-09-21 09:10:53 -07:00 committed by Tim Abbott
parent 75376a3fc5
commit f4c82a1153
2 changed files with 5 additions and 0 deletions

View File

@ -53,6 +53,8 @@ def get_device_os(user_agent: str) -> Optional[str]:
return "iOS"
elif "like mac os x" in user_agent:
return "iOS"
elif " cros " in user_agent:
return "ChromeOS"
else:
return None

View File

@ -153,6 +153,9 @@ class TestBrowserAndOsUserAgentStrings(ZulipTestCase):
'<WebKit Rev> (KHTML, like Gecko) Chrome/<Chrome Rev> Safari'
'/<WebKit Rev> Edge/<EdgeHTML Rev>.'
'<Windows Build>', 'Edge', 'Windows'),
('Mozilla/5.0 (X11; CrOS x86_64 10895.56.0) AppleWebKit/537.36'
'(KHTML, like Gecko) Chrome/69.0.3497.95 Safari/537.36',
'Chrome', 'ChromeOS'),
('', None, None),
]