diff options
author | Artur Signell <artur@vaadin.com> | 2016-02-03 10:59:46 +0200 |
---|---|---|
committer | Artur Signell <artur@vaadin.com> | 2016-05-22 10:24:02 +0300 |
commit | 25e824aea4c0cf65dbea784446ec2b7a521b7a08 (patch) | |
tree | 3aa8d790498140b7aec70919f7f092a7e2bd75e4 /client/src/test | |
parent | 9b048703e112eb213e4c604428603bde92bd40ae (diff) | |
download | vaadin-framework-25e824aea4c0cf65dbea784446ec2b7a521b7a08.tar.gz vaadin-framework-25e824aea4c0cf65dbea784446ec2b7a521b7a08.zip |
Correctly detect PhantomJS 2.1
Change-Id: I9b1df949b831b84aa05bf611b0128eb2414bbbae
Diffstat (limited to 'client/src/test')
-rw-r--r-- | client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java b/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java index 5522b8e2bc..41e675cb3a 100644 --- a/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java +++ b/client/src/test/java/com/vaadin/client/VBrowserDetailsUserAgentParserTest.java @@ -61,6 +61,8 @@ public class VBrowserDetailsUserAgentParserTest { private static final String EDGE_WINDOWS_10 = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/42.0.2311.135 Safari/537.36 Edge/12.10240"; + private static final String PHANTOMJS_211_MAC = "Mozilla/5.0 (Macintosh; Intel Mac OS X) AppleWebKit/538.1 (KHTML, like Gecko) PhantomJS/2.1.1 Safari/538.1"; + @Test public void testSafari3() { VBrowserDetails bd = new VBrowserDetails(SAFARI3_WINDOWS); @@ -471,6 +473,16 @@ public class VBrowserDetailsUserAgentParserTest { assertWindows(bd, false); } + @Test + public void testPhantomJs211() { + VBrowserDetails bd = new VBrowserDetails(PHANTOMJS_211_MAC); + assertPhantomJS(bd); + assertWebKit(bd); + assertBrowserMajorVersion(bd, 2); + assertBrowserMinorVersion(bd, 1); + assertMacOSX(bd); + } + /* * Helper methods below */ @@ -525,6 +537,17 @@ public class VBrowserDetailsUserAgentParserTest { assertFalse(browserDetails.isTrident()); } + private void assertPhantomJS(VBrowserDetails browserDetails) { + // Browser + assertFalse(browserDetails.isFirefox()); + assertFalse(browserDetails.isChrome()); + assertFalse(browserDetails.isIE()); + assertFalse(browserDetails.isOpera()); + assertFalse(browserDetails.isSafari()); + assertFalse(browserDetails.isEdge()); + assertTrue(browserDetails.isPhantomJS()); + } + private void assertFirefox(VBrowserDetails browserDetails) { // Browser assertTrue(browserDetails.isFirefox()); @@ -533,6 +556,7 @@ public class VBrowserDetailsUserAgentParserTest { assertFalse(browserDetails.isOpera()); assertFalse(browserDetails.isSafari()); assertFalse(browserDetails.isEdge()); + assertFalse(browserDetails.isPhantomJS()); } private void assertChrome(VBrowserDetails browserDetails) { @@ -543,6 +567,7 @@ public class VBrowserDetailsUserAgentParserTest { assertFalse(browserDetails.isOpera()); assertFalse(browserDetails.isSafari()); assertFalse(browserDetails.isEdge()); + assertFalse(browserDetails.isPhantomJS()); } private void assertIE(VBrowserDetails browserDetails) { @@ -553,6 +578,7 @@ public class VBrowserDetailsUserAgentParserTest { assertFalse(browserDetails.isOpera()); assertFalse(browserDetails.isSafari()); assertFalse(browserDetails.isEdge()); + assertFalse(browserDetails.isPhantomJS()); } private void assertOpera(VBrowserDetails browserDetails) { @@ -563,6 +589,7 @@ public class VBrowserDetailsUserAgentParserTest { assertTrue(browserDetails.isOpera()); assertFalse(browserDetails.isSafari()); assertFalse(browserDetails.isEdge()); + assertFalse(browserDetails.isPhantomJS()); } private void assertSafari(VBrowserDetails browserDetails) { @@ -573,6 +600,7 @@ public class VBrowserDetailsUserAgentParserTest { assertFalse(browserDetails.isOpera()); assertTrue(browserDetails.isSafari()); assertFalse(browserDetails.isEdge()); + assertFalse(browserDetails.isPhantomJS()); } private void assertEdge(VBrowserDetails browserDetails) { @@ -583,6 +611,7 @@ public class VBrowserDetailsUserAgentParserTest { assertFalse(browserDetails.isOpera()); assertFalse(browserDetails.isSafari()); assertTrue(browserDetails.isEdge()); + assertFalse(browserDetails.isPhantomJS()); } private void assertMacOSX(VBrowserDetails browserDetails) { |