Changeset 429 for trunk/icedtea-web/tests/test-extensions-tests
- Timestamp:
- Sep 24, 2014, 9:34:21 PM (11 years ago)
- Location:
- trunk/icedtea-web/tests/test-extensions-tests/net/sourceforge/jnlp
- Files:
-
- 2 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/icedtea-web/tests/test-extensions-tests/net/sourceforge/jnlp/ResourcesTest.java
r418 r429 65 65 public void testNonExisitngBrowserWillNotDeadlock() throws Exception { 66 66 server.setCurrentBrowser(Browsers.none); 67 ServerAccess.ProcessResult pr = server.executeBrowser("not_existing_url.html");67 ProcessResult pr = server.executeBrowser("not_existing_url.html"); 68 68 Assert.assertNull(pr.process); 69 69 Assert.assertEquals(pr.stderr, ""); … … 71 71 Assert.assertTrue(pr.wasTerminated); 72 72 Assert.assertTrue(pr.returnValue < 0); 73 junit.framework.Assert.assertNotNull(pr.deadlyException);73 Assert.assertNotNull(pr.deadlyException); 74 74 } 75 75 … … 78 78 server.setCurrentBrowser(Browsers.none); 79 79 List<String> al=Arrays.asList(new String[] {"definietly_not_Existing_process"}); 80 ServerAccess.ProcessResult pr = server.executeProcess(al);80 ProcessResult pr = server.executeProcess(al); 81 81 Assert.assertNull(pr.process); 82 82 Assert.assertEquals(pr.stderr, ""); … … 84 84 Assert.assertTrue(pr.wasTerminated); 85 85 Assert.assertTrue(pr.returnValue < 0); 86 junit.framework.Assert.assertNotNull(pr.deadlyException);86 Assert.assertNotNull(pr.deadlyException); 87 87 } 88 88 … … 97 97 @TestInBrowsers(testIn=Browsers.none) 98 98 public void testNonExisitngBrowserWillNotCauseMess() throws Exception { 99 ServerAccess.ProcessResult pr = server.executeBrowser("not_existing_url.html");99 ProcessResult pr = server.executeBrowser("not_existing_url.html"); 100 100 Assert.assertNull(pr.process); 101 101 Assert.assertEquals(pr.stderr, ""); … … 103 103 Assert.assertTrue(pr.wasTerminated); 104 104 Assert.assertTrue(pr.returnValue < 0); 105 junit.framework.Assert.assertNotNull(pr.deadlyException);105 Assert.assertNotNull(pr.deadlyException); 106 106 } 107 107 … … 121 121 public void testBrowser3() throws Exception { 122 122 testBrowser(server.getCurrentBrowser()); 123 124 125 123 } 126 124 … … 216 214 expected = 2; 217 215 Assert.assertTrue("Created from " + s + "there must be " + expected + " browsers in factory. Is" + bf.getAllBrowsers().size(), bf.getAllBrowsers().size() == expected); 218 219 220 221 222 216 } 223 217 … … 275 269 @Override 276 270 public void charReaded(char ch) { 277 //ServerAccess.logOutputReprint("OO recieved char: "+ch);278 271 o1.append(ch); 279 272 } … … 281 274 @Override 282 275 public void lineReaded(String s) { 283 //ServerAccess.logOutputReprint("OO recieved line: "+s);284 276 o2.append(s).append("\n"); 285 277 } … … 289 281 @Override 290 282 public void charReaded(char ch) { 291 //ServerAccess.logOutputReprint("EE recieved char: "+ch);292 283 e1.append(ch); 293 284 } … … 295 286 @Override 296 287 public void lineReaded(String s) { 297 //ServerAccess.logOutputReprint("EE recieved line: "+s);298 288 e2.append(s).append("\n"); 299 289 } 300 290 }; 301 ServerAccess.ProcessResult pr = server.executeBrowser("not_existing_url.html",lo,le); 302 server.setCurrentBrowser(BrowserFactory.getFactory().getFirst().getID()); 303 Assert.assertNotNull(server.getCurrentBrowsers()); 304 Assert.assertNotNull(server.getCurrentBrowser()); 305 // ServerAccess.logOutputReprint("total o"); 306 // ServerAccess.logOutputReprint(pr.stdout); 307 // ServerAccess.logOutputReprint("total e"); 308 // ServerAccess.logOutputReprint(pr.stderr); 291 ProcessResult pr = server.executeBrowser("not_existing_url.html",lo,le); 292 server.setCurrentBrowser(BrowserFactory.getFactory().getFirst().getID()); 293 Assert.assertNotNull(server.getCurrentBrowsers()); 294 Assert.assertNotNull(server.getCurrentBrowser()); 309 295 Assert.assertEquals(pr.stdout, o1.toString()); 310 296 Assert.assertEquals(pr.stderr, e1.toString()); … … 312 298 Assert.assertEquals(pr.stdout.replace("\n", ""), o2.toString().replace("\n", "")); 313 299 Assert.assertEquals(pr.stderr.replace("\n", ""), e2.toString().replace("\n", "")); 314 315 300 } 316 301 … … 325 310 326 311 private void testBrowser(Browser browser) throws IOException { 327 File f1= null;312 File defaultPluginDir = null; 328 313 if (browser.getDefaultPluginExpectedLocation() != null) { 329 f1 = new File(browser.getDefaultPluginExpectedLocation()); 330 } 331 File f2 = null; 314 defaultPluginDir = new File(browser.getDefaultPluginExpectedLocation()); 315 } 316 if (defaultPluginDir != null) { 317 Assert.assertTrue("browser's plugins location should exist " + defaultPluginDir.toString() + " for " + browser.getID().toString(), defaultPluginDir.exists()); 318 } 319 320 File userPluginDir = null; 332 321 if (browser.getUserDefaultPluginExpectedLocation() != null) { 333 f2 = new File(browser.getUserDefaultPluginExpectedLocation()); 334 } 335 if (f1 != null) { 336 Assert.assertTrue("browser's plugins location should exist " + f1.toString() + " for " + browser.getID().toString(), f1.exists()); 337 } 338 if (f2 != null) { 339 Assert.assertTrue("browser's users-plugins location should exist " + f2.toString() + " for " + browser.getID().toString(), f2.exists()); 340 } 341 342 File[] ff1 = new File[0]; 343 if (f1 != null) { 344 ff1 = f1.listFiles(); 345 } 346 347 File[] ff2 = new File[0]; 348 if (f2 != null) { 349 ff2 = f2.listFiles(); 350 } 351 352 Assert.assertTrue("at least one of browser's plugins directory should contains at least one file didn't. For " + browser.getID().toString(), ff1.length + ff2.length > 0); 353 354 ff1 = new File[0]; 355 if (f1 != null) { 356 ff1 = f1.listFiles(new FileFilter() { 322 userPluginDir = new File(browser.getUserDefaultPluginExpectedLocation()); 323 } 324 // userPluginDir (~/.mozilla/plugins/) may not exist if user has not installed any Firefox plugins. 325 326 File[] defaultPlugins = new File[0]; 327 if (defaultPluginDir != null && defaultPluginDir.isDirectory()) { 328 defaultPlugins = defaultPluginDir.listFiles(); 329 } 330 331 File[] userPlugins = new File[0]; 332 if (userPluginDir != null && userPluginDir.isDirectory()) { 333 userPlugins = userPluginDir.listFiles(); 334 } 335 336 Assert.assertTrue("at least one of browser's plugins directory should contains at least one file didn't. For " + browser.getID().toString(), defaultPlugins.length + userPlugins.length > 0); 337 338 defaultPlugins = new File[0]; 339 if (defaultPluginDir != null && defaultPluginDir.isDirectory()) { 340 defaultPlugins = defaultPluginDir.listFiles(new FileFilter() { 357 341 358 342 @Override … … 363 347 } 364 348 365 ff2= new File[0];366 if ( f2 != null) {367 ff2 = f2.listFiles(new FileFilter() {349 userPlugins = new File[0]; 350 if (userPluginDir != null && userPluginDir.isDirectory()) { 351 userPlugins = userPluginDir.listFiles(new FileFilter() { 368 352 369 353 @Override … … 375 359 376 360 Assert.assertTrue("browser's plugins directories should contains exactly one " + LinuxBrowser.DEFAULT_PLUGIN_NAME + ", but didnt for " + browser.getID().toString(), 377 ff1.length + ff2.length == 1);361 defaultPlugins.length + userPlugins.length == 1); 378 362 String currentPath = server.getJavawsFile().getParentFile().getParentFile().getAbsolutePath(); 379 363 380 File[] ff;381 if ( ff1.length == 1) {382 ff = ff1;364 File[] plugins; 365 if (defaultPlugins.length == 1) { 366 plugins = defaultPlugins; 383 367 } else { 384 ff = ff2;385 } 386 String s = ServerAccess.getContentOfStream(new FileInputStream( ff[0]), "ASCII");368 plugins = userPlugins; 369 } 370 String s = ServerAccess.getContentOfStream(new FileInputStream(plugins[0]), "ASCII"); 387 371 Assert.assertTrue("browser's plugins shoud points to" + currentPath + ", but didnt", 388 372 s.contains(s)); -
trunk/icedtea-web/tests/test-extensions-tests/net/sourceforge/jnlp/ServerAccessTest.java
r418 r429 40 40 import java.io.FileInputStream; 41 41 import java.net.URL; 42 42 43 import org.junit.Assert; 43 44 import org.junit.Test;
Note:
See TracChangeset
for help on using the changeset viewer.