File: mochi-single.html

package info (click to toggle)
iceweasel 38.8.0esr-1~deb7u1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 1,578,008 kB
  • sloc: cpp: 4,134,345; ansic: 1,765,754; python: 324,651; java: 233,700; asm: 138,937; xml: 98,298; sh: 82,895; makefile: 21,621; perl: 17,235; objc: 4,014; yacc: 1,968; lex: 1,179; exp: 499; pascal: 479; lisp: 228; awk: 152; ruby: 82; sed: 43; csh: 31; ada: 16; php: 1
file content (265 lines) | stat: -rw-r--r-- 8,750 bytes parent folder | download | duplicates (2)
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<!DOCTYPE HTML>
<meta http-equiv='content-type' content='text/html; charset=utf-8' />
<html>
<head>
<title>
WebGL Conformance Test Suite Single Test Wrapper
</title>
<!-- Uncomment this to use this without mochi-wrapper.html files.
<script type='application/javascript' src='/tests/SimpleTest/SimpleTest.js'></script>
<link rel='stylesheet' type='text/css' href='/tests/SimpleTest/test.css'/>
-->
<script src='../webgl-mochitest/driver-info.js'></script>
<script src='iframe-autoresize.js'></script>
</head>
<body style='margin:0'>

<div>Status: <span id='status'>Initializing</span></div>
<div>Path: <span id='path'>-</span></div>
<div>Failures: <span id='results'>-</span></div>
<hr/>
<iframe style='border:none' id='test-frame' width='100%' scrolling='no'></iframe>
<script>
'use strict';

var statusElem = document.getElementById('status');
var pathElem = document.getElementById('path');
var resultsElem = document.getElementById('results');
var frameElem = document.getElementById('test-frame');

IFrameAutoresize.Start(frameElem, true);

////////////////////////////////////////////////////////////////////////
// Forward SimpleTest functions and replace if missing.

if (!window.ok) {
  window.ok = parent.ok;
}
if (!window.todo) {
  window.todo = parent.todo;
}
if (!window.SimpleTest) {
  window.SimpleTest = parent.SimpleTest;
}

if (!window.ok) {
  window.ok = function(status, message) {
    console.log('ok(' + status + ', \'' + message + '\')');
  }
}
if (!window.todo) {
  window.todo = function(status, message) {
    console.log('todo(' + status + ', \'' + message + '\')');
  }
}
if (!window.SimpleTest) {
  window.SimpleTest = {
    finish: function(){},
    requestLongerTimeout: function(){},
    waitForExplicitFinish: function(){},
  };
}

////////////////////////////////////////////////////////////////////////
// Implement our own version of `fail-if` expected failure handling.
// `fail-if` in mochitest.ini doesn't work yet. (bug 987849)

var OS_VERSION_WIN7 = 6.1;
var OS_VERSION_OSX_10_6 = 10.6;
var OS_VERSION_OSX_10_8 = 10.8;

// ICS 4.0-4.0.2 was 14, 4.0.3+ was 15.
var OS_VERSION_ANDROID_ICS = 14;

var ALWAYS_FAIL_TEST_FILEPATH = 'always-fail.html';

function GetExpectedTestFailSet() {
  var failSet = {};

  failSet[ALWAYS_FAIL_TEST_FILEPATH] = true;

  switch (DriverInfo.getOS()) {
    case DriverInfo.OS.WINDOWS:
      if (DriverInfo.getOSVersion() >= OS_VERSION_WIN7) {
        // Win7 and Win8 slaves.
        failSet['conformance/textures/tex-image-and-sub-image-2d-with-video.html'] = true;
        failSet['conformance/textures/texture-npot-video.html'] = true;
      }
      break;

    case DriverInfo.OS.MAC:
      if (DriverInfo.getOSVersion() == OS_VERSION_OSX_10_8) {
        failSet['conformance/glsl/functions/glsl-function-smoothstep-gentype.html'] = true;
        failSet['conformance/glsl/variables/gl-pointcoord.html'] = true;
        failSet['conformance/limits/gl-max-texture-dimensions.html'] = true;
        failSet['conformance/textures/texture-size.html'] = true;
      } else if (DriverInfo.getOSVersion() == OS_VERSION_OSX_10_6) {
        failSet['conformance/glsl/misc/glsl-function-nodes.html'] = true;
      }
      break;

    case DriverInfo.OS.LINUX:
      failSet['conformance/glsl/functions/glsl-function-sin.html'] = true;
      failSet['conformance/misc/type-conversion-test.html'] = true;
      break;

    case DriverInfo.OS.ANDROID:
      if (DriverInfo.getOSVersion() >= OS_VERSION_ANDROID_ICS) {
        // Android 4.0 slaves.
        failSet['conformance/extensions/oes-vertex-array-object.html'] = true;
        failSet['conformance/glsl/functions/glsl-function-abs.html'] = true;
        failSet['conformance/glsl/functions/glsl-function-faceforward.html'] = true;
        failSet['conformance/glsl/functions/glsl-function-sign.html'] = true;
        failSet['conformance/glsl/functions/glsl-function-smoothstep-float.html'] = true;
        failSet['conformance/glsl/functions/glsl-function-step-float.html'] = true;
        failSet['conformance/glsl/functions/glsl-function-step-gentype.html'] = true;
        failSet['conformance/limits/gl-max-texture-dimensions.html'] = true;
        failSet['conformance/limits/gl-min-textures.html'] = true;
        failSet['conformance/rendering/draw-elements-out-of-bounds.html'] = true;
        failSet['conformance/state/gl-get-calls.html'] = true;
        failSet['conformance/textures/tex-image-with-format-and-type.html'] = true;
        failSet['conformance/textures/tex-sub-image-2d.html'] = true;
        failSet['conformance/textures/texture-mips.html'] = true;
        failSet['conformance/textures/texture-size-cube-maps.html'] = true;
      } else {
        // Android 2.3 slaves.
        failSet['conformance/extensions/oes-texture-float.html'] = true;
        failSet['conformance/glsl/functions/glsl-function-sin.html'] = true;
        failSet['conformance/misc/object-deletion-behaviour.html'] = true;
        failSet['conformance/programs/program-test.html'] = true;
        failSet['conformance/textures/tex-image-and-sub-image-2d-with-video.html'] = true;
        failSet['conformance/textures/texture-mips.html'] = true;
        failSet['conformance/textures/texture-npot.html'] = true;
      }
      break;

    case DriverInfo.OS.B2G:
      failSet['conformance/context/context-attributes-alpha-depth-stencil-antialias.html'] = true;
      failSet['conformance/glsl/functions/glsl-function-sin.html'] = true;
      failSet['conformance/glsl/reserved/_webgl_function.vert.html'] = true;
      failSet['conformance/glsl/reserved/webgl_function.vert.html'] = true;
      failSet['conformance/misc/error-reporting.html'] = true;
      failSet['conformance/misc/object-deletion-behaviour.html'] = true;
      failSet['conformance/programs/get-active-test.html'] = true;
      failSet['conformance/textures/tex-input-validation.html'] = true;
      failSet['conformance/textures/texture-mips.html'] = true;
      failSet['conformance/textures/texture-npot.html'] = true;
      failSet['conformance/textures/texture-size-cube-maps.html'] = true;
      failSet['conformance/textures/texture-size.html'] = true;
      break;
  }

  return failSet;
}

////////////////////////////////////////////////////////////////////////
// Test running and harness.

var gTestPath = null;
var gExpectFailures;
var gIsComplete;

function RunTest(testPath) {
  console.log('testPath: ' + testPath);

  if (testPath == ALWAYS_FAIL_TEST_FILEPATH) {
    // Make it easier to respond to new test failures.
    console.log('OS: ' + DriverInfo.getOS());
    console.log('OS version: ' + DriverInfo.getOSVersion());
    console.log('Driver: ' + DriverInfo.getDriver());
  }

  gTestPath = testPath;
  pathElem.innerHTML = gTestPath;

  gExpectFailures = (gTestPath in GetExpectedTestFailSet());

  // Load the iframe.
  statusElem.innerHTML = 'Loading';

  gIsComplete = false;
  frameElem.onload = function() {
    if (!gIsComplete)
      statusElem.innerHTML = 'Running';
  };
  frameElem.src = gTestPath;
}

var gFailureCount = 0;
var gResultCount = 0;
window.webglTestHarness = {
  reportResults: function(success, message) {
    if (gExpectFailures) {
      if (success) {
        ok(success, message);
      } else {
        todo(success, message);
      }
    } else {
      ok(success, message);
    }

    gResultCount++;
    if (!success) {
      gFailureCount++;
    }

    var color = gFailureCount ? 'red' : 'green';

    resultsElem.innerHTML = [
      '<font color=\'' + color + '\'>',
      '' + gFailureCount + '/' + gResultCount,
      '</font>',
    ].join('\n');
  },

  notifyFinished: function(testPath) {
    OnTestComplete();
  },
};

function OnTestComplete() {
  statusElem.innerHTML = 'Complete';
  gIsComplete = true;

  var hadFailures = gFailureCount != 0;

  if (gExpectFailures) {
    todo(!hadFailures, 'Expected failures: ' + gTestPath);
  } else {
    ok(!hadFailures, 'Expected no failures: ' + gTestPath);
  }
  SimpleTest.finish();
}

////////////////////////////////////////////////////////////////////////
// Begin execution

SimpleTest.waitForExplicitFinish();

var isAndroid2_3 = (DriverInfo.getOS() == DriverInfo.OS.ANDROID &&
                    DriverInfo.getOSVersion() < OS_VERSION_ANDROID_ICS);
if (isAndroid2_3) {
  var timeoutLengthMultiplier = 2.0;
  SimpleTest.requestLongerTimeout(timeoutLengthMultiplier);
}

do {
  var arg = location.search.substr(1);
  if (arg == 'dump') {
    statusElem.innerHTML = 'Dumping';

    ok(true, 'OS:' + DriverInfo.getOS());
    ok(true, 'OS version:' + DriverInfo.getOSVersion());
    ok(true, 'Driver:' + DriverInfo.getDriver());

    statusElem.innerHTML = 'Complete';
    break;
  }

  RunTest(arg);
} while (false);

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