Пример #1
0
 void validateEmbedded(int scriptIndex, HtmlScriptElement script) {
   if (!(script instanceof EmbeddedHtmlScriptElementImpl)) {
     fail(
         "Expected script "
             + scriptIndex
             + " to be embedded, but found "
             + (script != null ? script.getClass() : "null"));
   }
   EmbeddedHtmlScriptElementImpl embeddedScript = (EmbeddedHtmlScriptElementImpl) script;
   expectedLibrary.validate(scriptIndex, embeddedScript);
 }
Пример #2
0
 void validateExternal(int scriptIndex, HtmlScriptElement script) {
   if (!(script instanceof ExternalHtmlScriptElementImpl)) {
     fail(
         "Expected script "
             + scriptIndex
             + " to be external with src="
             + expectedExternalScriptName
             + " but found "
             + (script != null ? script.getClass() : "null"));
   }
   ExternalHtmlScriptElementImpl externalScript = (ExternalHtmlScriptElementImpl) script;
   Source scriptSource = externalScript.getScriptSource();
   if (expectedExternalScriptName == null) {
     assertNull("script " + scriptIndex, scriptSource);
   } else {
     assertNotNull("script " + scriptIndex, scriptSource);
     String actualExternalScriptName = scriptSource.getShortName();
     assertEquals("script " + scriptIndex, expectedExternalScriptName, actualExternalScriptName);
   }
 }