summaryrefslogtreecommitdiffstats
path: root/content/browser/debugger/manual_tests/debugger-fake-workers.html
diff options
context:
space:
mode:
authormnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-19 10:51:29 +0000
committermnissler@chromium.org <mnissler@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-12-19 10:51:29 +0000
commit53ae3ced739a432c20b70c7bee1ae5527ba786ce (patch)
treee6ee3b1b638d86a26ac466c0fbe17f67415178b2 /content/browser/debugger/manual_tests/debugger-fake-workers.html
parent92b43f98d619fcc8d03e2bb90217f44a0b4cd76e (diff)
downloadchromium_src-53ae3ced739a432c20b70c7bee1ae5527ba786ce.zip
chromium_src-53ae3ced739a432c20b70c7bee1ae5527ba786ce.tar.gz
chromium_src-53ae3ced739a432c20b70c7bee1ae5527ba786ce.tar.bz2
Revert r173891 - "DevTools: rename debugger/ to devtools/, move DevTools files into content/renderer/devtools."
DevToolsManagerTest.ForwardMessageToClient: http://build.chromium.org/p/chromium.linux/buildstatus?builder=Linux%20Tests%20x64&number=29428 http://build.chromium.org/p/chromium.linux/buildstatus?builder=Linux%20Aura&number=304 http://build.chromium.org/p/chromium.linux/buildstatus?builder=Linux%20Clang%20%28dbg%29&number=37637 http://build.chromium.org/p/chromium.chromiumos/buildstatus?builder=Linux%20ChromiumOS%20Tests%20%281%29&number=17804 http://build.chromium.org/p/chromium.memory/buildstatus?builder=Linux%20Chromium%20OS%20ASAN%20Tests%20%283%29&number=1107 BUG=None TEST=Tree becomes greener. TBR=pfeldman@chromium.org Review URL: https://codereview.chromium.org/11645015 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173893 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/debugger/manual_tests/debugger-fake-workers.html')
-rw-r--r--content/browser/debugger/manual_tests/debugger-fake-workers.html102
1 files changed, 102 insertions, 0 deletions
diff --git a/content/browser/debugger/manual_tests/debugger-fake-workers.html b/content/browser/debugger/manual_tests/debugger-fake-workers.html
new file mode 100644
index 0000000..6a7cb03
--- /dev/null
+++ b/content/browser/debugger/manual_tests/debugger-fake-workers.html
@@ -0,0 +1,102 @@
+<html>
+<body onload="onLoad()">
+<script>
+
+function log(message) {
+ var div = document.createElement('div');
+ div.innerText = message;
+ document.getElementById('console').appendChild(div);
+}
+
+function strike(id) {
+ document.getElementById(id).style.textDecoration = "line-through"
+}
+
+function onLoad() {
+ if (!Worker.prototype.postMessage) { // fake workers
+ strike('s1');
+ strike('s2');
+ log('[using fake workers]');
+ } else {
+ log('[using real workers]');
+ }
+}
+
+var primeWorker;
+var invalidWorker;
+var count;
+var timer;
+
+function startWorkers() {
+ startButton.disabled = true;
+
+ primeWorker = new Worker('resources/worker-primes.js');
+ primeWorker.onmessage = onMessage;
+ primeWorker.onerror = onError;
+ primeWorker.postMessage(2);
+ count = 3;
+
+ timer = setInterval(onTimer, 1000);
+ try {
+ invalidWorker = new Worker('non-existent-worker.js');
+ } catch(e) {
+ }
+ log('Started worker');
+}
+
+function onTimer() {
+ primeWorker.postMessage(count);
+ count+=2;
+}
+
+function onMessage(event) {
+ if (event.data[1]) {
+ log(event.data[0]);
+ if (event.data[0] === 5)
+ strike('s6');
+ }
+}
+
+function onError(event) {
+ log('Error in worker: ' + event.message);
+ strike('s8');
+}
+
+function causeError() {
+ primeWorker.postMessage('forty two');
+}
+
+function stopWorker() {
+ log('Stopping worker...');
+ if (timer) {
+ clearInterval(timer);
+ timer = 0;
+ }
+ primeWorker.terminate();
+ startButton.disabled = false;
+}
+
+</script>
+
+<h1>Tests debugging of HTML5 Workers</h1>
+
+<ol>
+
+<li id="s1">Open DevTools, Scripts Panel; Tick Debug on Workers sidebar.</li>
+<li id="s2">Reload the page.</li>
+<li id="s3"><button onclick="startWorkers()" id="startButton">Start Worker</button></li>
+<li id="s4">Observe 2 workers appear in the worker sidebar pane (including non-existent-worker.js)"</li>
+<li id="s5">Observe worker-primes.js and primes.js appear in scripts drop-down box.</li>
+<li id="s6">Assure primes are being logged to test console below.</li>
+<li id="s7">Set a breakpoint on one of worker scripts, assure it's hit.</li>
+<li id="s8">Try causing an error in worker, observe it's logged in DevTools console and in test console below.
+ <button onclick="causeError()">Cause Error</button>
+<li id="s9"><button onclick="stopWorker()">Stop Worker</button></li>
+
+</ol>
+
+<div id="console" style="font-family: courier; background-color: black; color: green; width: 80em; height: 25em; overflow: scroll">
+</div>
+
+</body>
+</html>