| Index: ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html
|
| diff --git a/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..219d9e255fb126273b828f4a110eef4be4b5211d
|
| --- /dev/null
|
| +++ b/ppapi/native_client/tests/nacl_browser/pnacl_client_translator/pnacl_bad_test.html
|
| @@ -0,0 +1,157 @@
|
| +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
| + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
| +<html>
|
| +<!--
|
| + Copyright (c) 2012 The Chromium 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>
|
| + <script type="text/javascript" src="ppapi_bad.js"></script>
|
| + <title>PNACL bad pexe/libraries Test</title>
|
| + <style type="text/css">
|
| + .naclModule { background-color: gray; margin: 2px 2px; }
|
| + </style>
|
| +</head>
|
| +<body id="body">
|
| +<script type="text/javascript">
|
| +//<![CDATA[
|
| +
|
| +function declareTests(tester) {
|
| + // 'bad_pexe' loads a manifest, then loads a pexe that is invalid.
|
| + badLoadTest(
|
| + tester,
|
| + 'bad_pexe',
|
| + 'pnacl_bad_pexe.nmf',
|
| + 'NaCl module load failed: PnaclCoordinator: compile failed.');
|
| +
|
| + // 'bad_pexe' loads a manifest, then loads a pexe that is truncated.
|
| + badLoadTest(
|
| + tester,
|
| + 'bad2_pexe',
|
| + 'pnacl_bad2_pexe.nmf',
|
| + 'NaCl module load failed: PnaclCoordinator: compile failed.');
|
| +
|
| + // 'bad_pexe_undefined' loads a manifest, then loads a pexe that compiles
|
| + // but will result in undefined symbols, causing the link to fail.
|
| + badLoadTest(
|
| + tester,
|
| + 'bad_pexe_undefined_syms',
|
| + 'pnacl_bad_pexe_undefined_syms.nmf',
|
| + 'NaCl module load failed: PnaclCoordinator: link failed.');
|
| +
|
| + // 'nonexistent_pexe loads a manifest, then tries to load a nonexistent pexe,
|
| + // given both a nexe and a portable program to choose from.
|
| + badLoadTest(
|
| + tester,
|
| + 'nonexistent_pexe',
|
| + 'pnacl_bad_doesnotexist.nmf',
|
| + 'NaCl module load failed: PnaclCoordinator: pexe load failed.');
|
| +
|
| + // 'nonexistent_pexe_only' loads a manifest, then tries to load a nonexistent
|
| + // pexe, given only a pexe to choose from.
|
| + badLoadTest(
|
| + tester,
|
| + 'nonexistent_pexe_only',
|
| + 'pnacl_bad_doesnotexist_pexe_only.nmf',
|
| + 'NaCl module load failed: PnaclCoordinator: pexe load failed.');
|
| +
|
| + tester.addAsyncTest('Test clean directory',
|
| + // All that should be left after all tests run is empty directories.
|
| + // This means we will need to update this test with a whitelist,
|
| + // if we start adding metadata files or things like that.
|
| + function(test_status) {
|
| +
|
| + var errorHandler = test_status.wrap(function() {
|
| + test_status.fail('Unexpected failure in intermediate steps');
|
| + });
|
| +
|
| + function toArray(list) {
|
| + return Array.prototype.slice.call(list || [], 0);
|
| + }
|
| +
|
| + function CheckDirectoriesRecursively(dir, doneCallback) {
|
| + var dirReader = dir.createReader();
|
| + var entries = [];
|
| +
|
| + var checkMoreEntries = test_status.wrap(function(entries) {
|
| + // Done when it's actually an empty directory.
|
| + if (entries.length == 0) {
|
| + doneCallback();
|
| + return;
|
| + }
|
| +
|
| + var expected_callbacks = entries.length;
|
| + var current_callbacks = 0;
|
| + var nextCallback = test_status.wrap(function() {
|
| + current_callbacks += 1;
|
| + if (current_callbacks == expected_callbacks) {
|
| + doneCallback();
|
| + }
|
| + });
|
| +
|
| + entries.forEach(test_status.wrap(function(entry, i) {
|
| + if (entry.isDirectory) {
|
| + CheckDirectoriesRecursively(entry, nextCallback);
|
| + } else {
|
| + test_status.fail('Found a left over file ' + entry.name);
|
| + }
|
| + }));
|
| + });
|
| +
|
| + // Call the reader.readEntries() until no more results are returned.
|
| + var readEntries = test_status.wrap(function() {
|
| + dirReader.readEntries (
|
| + test_status.wrap(function(results) {
|
| + if (!results.length) {
|
| + checkMoreEntries(entries);
|
| + } else {
|
| + entries = entries.concat(toArray(results));
|
| + readEntries();
|
| + }
|
| + }), errorHandler);
|
| + });
|
| +
|
| + readEntries(); // Start reading dirs.
|
| + }
|
| +
|
| + var onInitFs = test_status.wrap(function(fs) {
|
| + var doneCallback = test_status.wrap(function() {
|
| + test_status.pass();
|
| + });
|
| + CheckDirectoriesRecursively(fs.root, doneCallback);
|
| + });
|
| +
|
| + // Note: The file system has been prefixed as of Google Chrome 12:
|
| + window.requestFileSystem =
|
| + window.requestFileSystem || window.webkitRequestFileSystem;
|
| + window.requestFileSystem(window.TEMPORARY,
|
| + 1024*1024, onInitFs, errorHandler);
|
| + }
|
| + );
|
| +}
|
| +
|
| +
|
| +// The driver invoked when the body has finished loading.
|
| +function runTests() {
|
| + var tester = new Tester($('body'));
|
| + tester.loadErrorsAreOK();
|
| + declareTests(tester);
|
| + tester.run();
|
| +}
|
| +//]]>
|
| +</script>
|
| +
|
| +<!-- The tests will create and remove embeds from this div. -->
|
| +<div id="embeds"></div>
|
| +
|
| +<script type="text/javascript">
|
| +//<![CDATA[
|
| +runTests();
|
| +//]]>
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|