File: test_runner.html

package info (click to toggle)
chromium 138.0.7204.183-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 6,071,908 kB
  • sloc: cpp: 34,937,088; ansic: 7,176,967; javascript: 4,110,704; python: 1,419,953; asm: 946,768; xml: 739,971; pascal: 187,324; sh: 89,623; perl: 88,663; objc: 79,944; sql: 50,304; cs: 41,786; fortran: 24,137; makefile: 21,806; php: 13,980; tcl: 13,166; yacc: 8,925; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (92 lines) | stat: -rw-r--r-- 2,422 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
<!DOCTYPE html>
<!--
Copyright 2012 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<html>
<head>
<title>
  NativeClient browser test runner
</title>
<script type="text/javascript" src="nacltest.js"></script>
<script type="text/javascript" src="nmf_test_list.js"></script>
</head>
<body>

<div id="scratch_space"></div>

<div id="load_warning">
Javascript has failed to load.
</div>

<script type="text/javascript">

function addTest(tester, url) {
  tester.addAsyncTest(url, function(status) {
    var embed = document.createElement('embed');
    embed.width = 0;
    embed.height = 0;
    embed.src = url;
    embed.type = 'application/x-nacl';
    embed.name = 'foo';

    // Webkit Bug Workaround
    // THIS SHOULD BE REMOVED WHEN Webkit IS FIXED
    // http://code.google.com/p/nativeclient/issues/detail?id=2428
    // http://code.google.com/p/chromium/issues/detail?id=103588
    ForcePluginLoadOnTimeout(embed, tester, 15000);

    var div = document.createElement('div');
    div.appendChild(embed);

    var cleanup = function() {
      document.getElementById('scratch_space').removeChild(div);
    };

    // Set up an event listener for success messages.
    div.addEventListener('message', status.wrap(function(message_event) {
      status.assertEqual(message_event.data, 'passed');
      cleanup();
      status.pass();
    }), true);

    // Wait for the load event, which indicates successful loading.
    div.addEventListener('load', status.wrap(function(e) {
      status.log('Loaded ' + embed.src);
      // Start tests in the module.
      embed.postMessage('run_tests');
    }), true);

    var onError = status.wrap(function(e) {
      cleanup();
      status.fail(embed.lastError);
    });

    div.addEventListener('error', onError, true);
    div.addEventListener('crash', onError, true);

    // Insert div into the DOM.  This starts the load of the nacl plugin, etc.
    document.getElementById('scratch_space').appendChild(div);
  });
}

// Remove the "failed to load" message.
document.getElementById('load_warning').innerHTML = '';

var tester = new Tester();
for (var i = 0; i < G_NMF_TEST_LIST.length; i++) {
  addTest(tester, G_NMF_TEST_LIST[i]);
}

var args = getTestArguments({'parallel': '0'});

if (parseInt(args['parallel'])) {
  tester.runParallel();
} else {
  tester.run();
}

</script>
</body>
</html>