1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/workers/test/test_atob.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,57 @@ 1.4 +<!-- 1.5 + Any copyright is dedicated to the Public Domain. 1.6 + http://creativecommons.org/publicdomain/zero/1.0/ 1.7 +--> 1.8 +<!DOCTYPE HTML> 1.9 +<html> 1.10 +<head> 1.11 + <title>Test for DOM Worker Threads</title> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.14 +</head> 1.15 +<body> 1.16 +<p id="display"></p> 1.17 +<div id="content" style="display: none"></div> 1.18 +<pre id="test"> 1.19 +<script src="atob_worker.js" language="javascript"></script> 1.20 +<script class="testbody" type="text/javascript"> 1.21 + 1.22 + var dataIndex = 0; 1.23 + 1.24 + var worker = new Worker("atob_worker.js"); 1.25 + worker.onmessage = function(event) { 1.26 + switch (event.data.type) { 1.27 + case "done": 1.28 + is(dataIndex, data.length, "Saw all values"); 1.29 + SimpleTest.finish(); 1.30 + return; 1.31 + case "btoa": 1.32 + is(btoa(data[dataIndex]), event.data.value, 1.33 + "Good btoa value " + dataIndex); 1.34 + break; 1.35 + case "atob": 1.36 + is(atob(btoa(data[dataIndex])) + "", event.data.value, 1.37 + "Good round trip value " + dataIndex); 1.38 + dataIndex++; 1.39 + break; 1.40 + default: 1.41 + ok(false, "Worker posted a bad message: " + event.message); 1.42 + worker.terminate(); 1.43 + SimpleTest.finish(); 1.44 + } 1.45 + } 1.46 + 1.47 + worker.onerror = function(event) { 1.48 + ok(false, "Worker threw an error: " + event.message); 1.49 + worker.terminate(); 1.50 + SimpleTest.finish(); 1.51 + } 1.52 + 1.53 + worker.postMessage("go"); 1.54 + 1.55 + SimpleTest.waitForExplicitFinish(); 1.56 + 1.57 +</script> 1.58 +</pre> 1.59 +</body> 1.60 +</html>