@@ -151,7 +151,7 @@ public void test_evalute_Cookies () {
151151 browser .addProgressListener (ProgressListener .completedAdapter (event -> loaded .set (true )));
152152
153153 // Using JavaScript Cookie API on local (file) URL gives DOM Exception 18
154- browser .setUrl ("http ://www.eclipse.org/swt" );
154+ browser .setUrl ("https ://www.eclipse.org/swt" );
155155 shell .open ();
156156 waitForPassCondition (loaded ::get );
157157
@@ -175,25 +175,25 @@ public void test_ClearAllSessionCookies () {
175175 browser .addProgressListener (ProgressListener .completedAdapter (event -> loaded .set (true )));
176176
177177 // Using JavaScript Cookie API on local (file) URL gives DOM Exception 18
178- browser .setUrl ("http ://www.eclipse.org/swt" );
178+ browser .setUrl ("https ://www.eclipse.org/swt" );
179179 shell .open ();
180180 waitForPassCondition (loaded ::get );
181181
182182 // Set the cookies
183- Browser .setCookie ("cookie1=value1" , "http ://www.eclipse.org/swt" );
184- Browser .setCookie ("cookie2=value2" , "http ://www.eclipse.org/swt" );
183+ Browser .setCookie ("cookie1=value1" , "https ://www.eclipse.org/swt" );
184+ Browser .setCookie ("cookie2=value2" , "https ://www.eclipse.org/swt" );
185185
186186 // Get the cookies
187- String v1 = Browser .getCookie ("cookie1" , "http ://www.eclipse.org/swt" );
188- String v2 = Browser .getCookie ("cookie2" , "http ://www.eclipse.org/swt" );
187+ String v1 = Browser .getCookie ("cookie1" , "https ://www.eclipse.org/swt" );
188+ String v2 = Browser .getCookie ("cookie2" , "https ://www.eclipse.org/swt" );
189189 assertEquals ("value1" , v1 );
190190 assertEquals ("value2" , v2 );
191191
192192 Browser .clearSessions ();
193193
194194 // Should be empty
195- String e1 = Browser .getCookie ("cookie1" , "http ://www.eclipse.org/swt" );
196- String e2 = Browser .getCookie ("cookie2" , "http ://www.eclipse.org/swt" );
195+ String e1 = Browser .getCookie ("cookie1" , "https ://www.eclipse.org/swt" );
196+ String e2 = Browser .getCookie ("cookie2" , "https ://www.eclipse.org/swt" );
197197 assertTrue (e1 == null || e1 .isEmpty ());
198198 assertTrue (e2 == null || e2 .isEmpty ());
199199}
@@ -206,18 +206,18 @@ public void test_get_set_Cookies() {
206206 browser .addProgressListener (ProgressListener .completedAdapter (event -> loaded .set (true )));
207207
208208 // Using JavaScript Cookie API on local (file) URL gives DOM Exception 18
209- browser .setUrl ("http ://www.eclipse.org/swt" );
209+ browser .setUrl ("https ://www.eclipse.org/swt" );
210210 shell .open ();
211211 waitForPassCondition (loaded ::get );
212212
213213 // Set the cookies
214- Browser .setCookie ("cookie1=value1" , "http ://www.eclipse.org/swt" );
215- Browser .setCookie ("cookie2=value2" , "http ://www.eclipse.org/swt" );
214+ Browser .setCookie ("cookie1=value1" , "https ://www.eclipse.org/swt" );
215+ Browser .setCookie ("cookie2=value2" , "https ://www.eclipse.org/swt" );
216216
217217 // Get the cookies
218- String v1 = Browser .getCookie ("cookie1" , "http ://www.eclipse.org/swt" );
218+ String v1 = Browser .getCookie ("cookie1" , "https ://www.eclipse.org/swt" );
219219 assertEquals ("value1" , v1 );
220- String v2 = Browser .getCookie ("cookie2" , "http ://www.eclipse.org/swt" );
220+ String v2 = Browser .getCookie ("cookie2" , "https ://www.eclipse.org/swt" );
221221 assertEquals ("value2" , v2 );
222222}
223223
@@ -849,7 +849,7 @@ public void test_setUrl_remote() {
849849 // This test sometimes times out if build server has a bad connection. Thus for this test we have a longer timeout.
850850 secondsToWaitTillFail = 35 ;
851851
852- String url = "http ://example.com" ; // example.com loads very quickly and conveniently has a consistent title
852+ String url = "https ://example.com" ; // example.com loads very quickly and conveniently has a consistent title
853853
854854 // Skip this test if we don't have a working Internet connection.
855855 assumeTrue ("Skipping test due to bad internet connection" , checkInternet (url ));
@@ -1455,7 +1455,7 @@ private void getText_helper(String testString, String expectedOutput) {
14551455@ Test
14561456public void test_stop () {
14571457 /* THIS TEST REQUIRES WEB ACCESS! How else can we really test the http:// part of a browser widget? */
1458- browser .setUrl ("http ://www.eclipse.org/swt" );
1458+ browser .setUrl ("https ://www.eclipse.org/swt" );
14591459 waitForMilliseconds (1000 );
14601460 browser .stop ();
14611461}
@@ -2266,6 +2266,9 @@ void waitForMilliseconds(final int milliseconds) {
22662266 * @return true if server responded with correct code (200), false otherwise.
22672267 */
22682268private static Boolean checkInternet (String url ) {
2269+ if (url !=null && url .toLowerCase ().startsWith ("http://" )) {
2270+ throw new IllegalArgumentException ("please use https instead, http do not work on mac out of the box and your test will hang there!" );
2271+ }
22692272 HttpURLConnection connection = null ;
22702273 try {
22712274 connection = (HttpURLConnection ) new URL (url ).openConnection ();
@@ -2274,7 +2277,7 @@ private static Boolean checkInternet(String url) {
22742277 if (code == 200 )
22752278 return true ;
22762279 } catch (MalformedURLException e ) {
2277- System .err .println ("Given url is malformed: " + url + "Try a fully formed url like: http ://www.example.com" );
2280+ System .err .println ("Given url is malformed: " + url + "Try a fully formed url like: https ://www.example.com" );
22782281 e .printStackTrace ();
22792282 } catch (IOException e ) {
22802283 // No connection was made.
0 commit comments