| Index: ppapi/native_client/tests/ppapi_browser/stress_many_nexes/stress_many_nexes.html
|
| ===================================================================
|
| --- ppapi/native_client/tests/ppapi_browser/stress_many_nexes/stress_many_nexes.html (revision 0)
|
| +++ ppapi/native_client/tests/ppapi_browser/stress_many_nexes/stress_many_nexes.html (revision 0)
|
| @@ -0,0 +1,87 @@
|
| +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
| + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
| +<html>
|
| + <!--
|
| + Copyright (c) 2011 The Native Client Authors. All rights reserved.
|
| + Use of this source code is governed by a BSD-style license that can be
|
| + found in the LICENSE file.
|
| + -->
|
| + <head>
|
| + <META HTTP-EQUIV="Pragma" CONTENT="no-cache" />
|
| + <META HTTP-EQUIV="Expires" CONTENT="-1" />
|
| + <script type="text/javascript" src="nacltest.js"> </script>
|
| + <title>Browser Stress Test</title>
|
| + <style type="text/css">
|
| + .naclModule { background-color: gray; margin: 2px 2px; }
|
| + .naclPassed { background-color: green; margin: 2px 2px; }
|
| + .naclFailed { background-color: red; margin: 2px 2px; }
|
| + </style>
|
| + </head>
|
| + <body id="body">
|
| +<script type="text/javascript">
|
| +//<![CDATA[
|
| +
|
| +function createEmbed(id) {
|
| + return createNaClEmbed({
|
| + id: id,
|
| + src: 'ppapi_ppb_core.nmf',
|
| + width: 100,
|
| + height: 20
|
| + });
|
| +}
|
| +
|
| +
|
| +function checkEmbed(test, embed) {
|
| + embed.className = 'naclFailed';
|
| + test.assertEqual(embed.readyState, 4);
|
| + test.assertEqual(embed.lastError, '');
|
| + embed.className = 'naclPassed';
|
| + test.pass();
|
| +}
|
| +
|
| +
|
| +function addParallelTest(tester, i) {
|
| + var name = 'nacl_' + i;
|
| + var embed = createEmbed(name);
|
| + tester.waitFor(embed);
|
| + tester.addAsyncTest(name, function(test) {
|
| + checkEmbed(test, embed);
|
| + });
|
| + document.body.appendChild(embed);
|
| +}
|
| +
|
| +
|
| +function addSerialTest(tester, i) {
|
| + var name = 'nacl_' + i;
|
| + tester.addAsyncTest(name, function(test){
|
| + var embed = createEmbed(name);
|
| + test.expectEvent(embed, 'loadend', function() {
|
| + checkEmbed(test, embed);
|
| + });
|
| + document.body.appendChild(embed);
|
| + });
|
| +}
|
| +
|
| +
|
| +function initTests(tester) {
|
| + var args = getTestArguments({'count': '100', 'parallel': '0'});
|
| + for (var i = 0; i < args.count; i++) {
|
| + if (parseInt(args.parallel)) {
|
| + // Faster, lets the browser determine load order and interleaving.
|
| + addParallelTest(tester, i);
|
| + } else {
|
| + // Slower, forces sequential load order.
|
| + addSerialTest(tester, i);
|
| + }
|
| + }
|
| +}
|
| +
|
| +
|
| +var tester = new Tester($('body'));
|
| +initTests(tester);
|
| +tester.run();
|
| +
|
| + //]]>
|
| + </script>
|
| + </body>
|
| +</html>
|
|
|