chromium/chrome/test/data/nacl/sysconf_nprocessors_onln/sysconf_nprocessors_onln_test.html

<!--
Copyright 2013 The Chromium Authors
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
  <head>
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="-1" />
    <script type="text/javascript" src="nacltest.js"></script>
    <title>Native Client _SC_NPROCESSORS_ONLN Test</title>
  </head>

  <body id="body">
    <h1>Native Client _SC_NPROCESSORS_ONLN Test</h1>
    <script type="text/javascript">
    //<![CDATA[
var tester = new Tester($('body'));
var args = getTestArguments({'cpu_count' :
  'THIS TEST CANNOT RUN STANDALONE -- run using browser_test instead'});

function setupModule(manifest_url) {
  var embed = document.createElement("embed");
  embed.src = manifest_url;
  embed.type = "application/x-nacl";
  if (getTestArguments()["pnacl"] !== undefined) {
    embed.type = "application/x-pnacl";
  }
  document.body.appendChild(embed);
  return embed;
}

function setupTests(tester, plugin) {
  tester.addAsyncTest("TestSysconfNprocessors", function(status) {
    plugin.addEventListener("message", function handler(message_event) {
      this.removeEventListener("message", handler, false);
      status.assertEqual(message_event.data, args.cpu_count);
      status.pass();
    }, false);
    plugin.postMessage("nprocessors");
  });
}

function runTests() {
  var module = setupModule("sysconf_nprocessors_onln_test.nmf");
  setupTests(tester, module);
  tester.waitFor(module);
  tester.run();
}

runTests();
    //]]>
    </script>
  </body>
</html>