Update browser runner to inject `assert.js`

Since the Python runner was updated to include `assert.js` in all tests
unconditionally, a number of tests have been written that implicitly
rely on its presence. The browser runner does not currently provide this
file's contents to these tests, so they fail unconditionally.

Update the browser runner to inject that file's contents into every test
context.

Note: the existing approach to file retrieval (namely loading via
synchronous XHR requests) is inefficient and deprecated in some
browsers. It is honored here for the sake of consistency and to minimize
the changeset necessary to fix the browser runner.
This commit is contained in:
Mike Pennisi 2015-06-18 13:40:05 -04:00
parent 42d16da901
commit 73aa06275a
4 changed files with 10 additions and 3 deletions

View File

@ -27,6 +27,7 @@ function BrowserRunner() {
errorDetectorFileContents, errorDetectorFileContents,
simpleTestAPIContents, simpleTestAPIContents,
globalScopeContents, globalScopeContents,
assertContents,
timerContents, timerContents,
startTime, startTime,
harnessDir = "harness/"; harnessDir = "harness/";
@ -46,6 +47,11 @@ function BrowserRunner() {
success: function(data){globalScopeContents = data;}, success: function(data){globalScopeContents = data;},
url:harnessDir+"gs.js"}); url:harnessDir+"gs.js"});
$.ajax({async: false,
dataType: "text",
success: function(data){assertContents = data;},
url:harnessDir+"assert.js"});
$.ajax({async: false, $.ajax({async: false,
dataType: "text", dataType: "text",
success: function(data){timerContents = data;}, success: function(data){timerContents = data;},
@ -215,6 +221,10 @@ function BrowserRunner() {
idoc.writeln(globalScopeContents); idoc.writeln(globalScopeContents);
idoc.writeln("</script>"); idoc.writeln("</script>");
idoc.writeln("<script type='text/javascript'>");
idoc.writeln(assertContents);
idoc.writeln("</script>");
//this is mainly applicable for consoles that do not have setTimeout support //this is mainly applicable for consoles that do not have setTimeout support
//idoc.writeln("<script type='text/javascript' src='harness/timer.js' defer>" + "</script>"); //idoc.writeln("<script type='text/javascript' src='harness/timer.js' defer>" + "</script>");
if(setTimeout === undefined && isAsyncTest(code)) { if(setTimeout === undefined && isAsyncTest(code)) {

View File

@ -11,7 +11,6 @@
</script> </script>
<script type="text/javascript" src="harness/sth.js"></script> <script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script> <script type="text/javascript" src="harness/sta.js"></script>
<script type="text/javascript" src="harness/assert.js"></script>
<script type="text/javascript" src="harness/jqueryprogressbar.js"></script> <script type="text/javascript" src="harness/jqueryprogressbar.js"></script>
<script type="text/javascript" src="harness/helper.js"></script> <script type="text/javascript" src="harness/helper.js"></script>
<script type="text/javascript" src="harness/jquery.base64.js"></script> <script type="text/javascript" src="harness/jquery.base64.js"></script>

View File

@ -11,7 +11,6 @@
</script> </script>
<script type="text/javascript" src="harness/sth.js"></script> <script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script> <script type="text/javascript" src="harness/sta.js"></script>
<script type="text/javascript" src="harness/assert.js"></script>
<script type="text/javascript" src="harness/jqueryprogressbar.js"></script> <script type="text/javascript" src="harness/jqueryprogressbar.js"></script>
<script type="text/javascript" src="harness/helper.js"></script> <script type="text/javascript" src="harness/helper.js"></script>
<script type="text/javascript" src="harness/jquery.base64.js"></script> <script type="text/javascript" src="harness/jquery.base64.js"></script>

View File

@ -11,7 +11,6 @@
</script> </script>
<script type="text/javascript" src="harness/sth.js"></script> <script type="text/javascript" src="harness/sth.js"></script>
<script type="text/javascript" src="harness/sta.js"></script> <script type="text/javascript" src="harness/sta.js"></script>
<script type="text/javascript" src="harness/assert.js"></script>
<script type="text/javascript" src="harness/jqueryprogressbar.js"></script> <script type="text/javascript" src="harness/jqueryprogressbar.js"></script>
<script type="text/javascript" src="harness/helper.js"></script> <script type="text/javascript" src="harness/helper.js"></script>
<script type="text/javascript" src="harness/jquery.base64.js"></script> <script type="text/javascript" src="harness/jquery.base64.js"></script>