< prev index next >

modules/web/src/test/java/test/javafx/scene/web/LoadTest.java

Print this page




 244                     webEngine.load("");
 245                     assertTrue("Load in READY State", webEngine.getLoadWorker().getState() == READY);
 246                 }
 247             });
 248 
 249             webEngine.getLoadWorker().stateProperty().addListener(((observable, oldValue, newValue) -> {
 250                 if (newValue == SUCCEEDED) {
 251                     latch.countDown();
 252                 }
 253             }));
 254 
 255             webEngine.loadContent("");
 256             assertTrue("loadContent task running", webEngine.getLoadWorker().getState() == RUNNING);
 257         });
 258         try {
 259             latch.await();
 260         } catch (InterruptedException ex) {
 261             throw new AssertionError(ex);
 262         }
 263     }



































 264 }


 244                     webEngine.load("");
 245                     assertTrue("Load in READY State", webEngine.getLoadWorker().getState() == READY);
 246                 }
 247             });
 248 
 249             webEngine.getLoadWorker().stateProperty().addListener(((observable, oldValue, newValue) -> {
 250                 if (newValue == SUCCEEDED) {
 251                     latch.countDown();
 252                 }
 253             }));
 254 
 255             webEngine.loadContent("");
 256             assertTrue("loadContent task running", webEngine.getLoadWorker().getState() == RUNNING);
 257         });
 258         try {
 259             latch.await();
 260         } catch (InterruptedException ex) {
 261             throw new AssertionError(ex);
 262         }
 263     }
 264 
 265    /**
 266      * @test
 267      * @bug 8152420
 268      * summary loading relative sub-resource from jar
 269      */
 270     @Test public void loadJarFile() throws Exception {
 271 
 272         // archive-root0.html -- src archive-r0.js, c/archive-c0.js
 273         load("jar:" + new File("build/resources/webArchiveJar.jar")
 274                 .toURI().toASCIIString() + "!/archive-root0.html");
 275         assertEquals("archive-root0.html failed to load src='archive-r0.js'",
 276                 executeScript("jsr0()").toString(), "loaded");
 277 
 278         assertEquals("archive-root0.html failed to load src='c/archive-c0.js'",
 279                 executeScript("jsc0()").toString(), "loaded");
 280 
 281         // archive-root1.html -- src ./archive-r0.js, ./c/archive-c0.js
 282         load("jar:" + new File("build/resources/webArchiveJar.jar")
 283                 .toURI().toASCIIString() + "!/archive-root1.html");
 284         assertEquals("archive-root1.html failed to load src='./archive-r0.js'",
 285                 executeScript("jsr0()").toString(), "loaded");
 286 
 287         assertEquals("archive-root1.html failed to load src='./c/archive-c0.js'",
 288                 executeScript("jsc0()").toString(), "loaded");
 289 
 290         // archive-root2.html -- src ./c/../archive-r0.js, ./c/./././archive-c0.js
 291         load("jar:" + new File("build/resources/webArchiveJar.jar")
 292                 .toURI().toASCIIString() + "!/archive-root2.html");
 293         assertEquals("archive-root2.html failed to load src='./c/../archive-r0.js'",
 294                 executeScript("jsr0()").toString(), "loaded");
 295 
 296         assertEquals("archive-root2.html failed to load src='./c/./././archive-c0.js'",
 297                 executeScript("jsc0()").toString(), "loaded");
 298     }    
 299 }
< prev index next >