Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1118)

Unified Diff: mojo/spy/test/spy_repl_test.html

Issue 354043003: Add support for logging information about mojo messages retrieved by the mojo debugger (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Presubmit warnings Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/spy/spy.cc ('k') | mojo/spy/websocket_server.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/spy/test/spy_repl_test.html
diff --git a/mojo/spy/test/spy_repl_test.html b/mojo/spy/test/spy_repl_test.html
index df2c179290139de5e9be24890d3e85f52475a4e4..55e91e89b993f0e374e899b7aa098bf2c28ceb6e 100644
--- a/mojo/spy/test/spy_repl_test.html
+++ b/mojo/spy/test/spy_repl_test.html
@@ -1,96 +1,96 @@
-<!DOCTYPE html>
-
-<html lang="en">
-<head>
- <meta charset="utf-8" />
- <title>Spy WS test</title>
- <style>
- hr {color:sienna;}
- body {
- background-color:#b0c4de;
- font:normal 16px/20px "Helvetica Neue", Helvetica, sans-serif;
- }
- #command {
- width:70%;
- }
- #status {
- background-color:#0094ff;
- width:50%;
- padding:4px;
- }
- </style>
-</head>
-<body>
-<header><h1>mojo spy</h1></header>
- <form>
- <input type="text" id="command" placeholder="enter spy command + enter" />
- </form>
- <p id="status">status: no connection</p>
- <p id="log">...</p>
- <script>
- function openConnection() {
- if (conn.readyState === undefined || conn.readyState > 1) {
- conn = new WebSocket('ws://127.0.0.1:42424');
- conn.onopen = function () {
- state.innerHTML = 'connected @port 42424';
- };
- conn.onmessage = function (event) {
- var message = event.data;
- log.innerHTML = message;
- };
- conn.onclose = function (event) {
- state.innerHTML = 'connection closed';
- };
- conn.onerror = function (event) {
- state.innerHTML = 'got error';
- };
- }
- }
-
- var addEvent = (function () {
- if (document.addEventListener) {
- return function (el, type, fn) {
- if (el && el.nodeName || el === window) {
- el.addEventListener(type, fn, false);
- } else if (el && el.length) {
- for (var i = 0; i < el.length; i++) {
- addEvent(el[i], type, fn);
- }
- }
- };
- } else {
- return function (el, type, fn) {
- if (el && el.nodeName || el === window) {
- el.attachEvent('on' + type, function () { return fn.call(el, window.event); });
- } else if (el && el.length) {
- for (var i = 0; i < el.length; i++) {
- addEvent(el[i], type, fn);
- }
- }
- };
- }
- })();
-
- var log = document.getElementById('log');
- var cmd = document.getElementById('command');
- var form = cmd.form;
- var conn = {};
- var state = document.getElementById('status');
-
- if (window.WebSocket === undefined) {
- state.innerHTML = 'websockets not supported';
- } else {
- addEvent(form, 'submit', function (event) {
- event.preventDefault();
- if (conn.readyState === 1) {
- conn.send(JSON.stringify(cmd.value));
- log.innerHTML = 'data sent';
- cmd.value = '';
- }
- });
-
- openConnection();
- }
- </script>
-</body>
-</html>
+<!DOCTYPE html>
+
+<html lang="en">
+<head>
+ <meta charset="utf-8" />
+ <title>Spy WS test</title>
+ <style>
+ hr {color:sienna;}
+ body {
+ background-color:#b0c4de;
+ font:normal 16px/20px "Helvetica Neue", Helvetica, sans-serif;
+ }
+ #command {
+ width:70%;
+ }
+ #status {
+ background-color:#0094ff;
+ width:50%;
+ padding:4px;
+ }
+ </style>
+</head>
+<body>
+<header><h1>mojo spy</h1></header>
+ <form>
+ <input type="text" id="command" placeholder="enter spy command + enter" />
+ </form>
+ <p id="status">status: no connection</p>
+ <p id="log">...</p>
+ <script>
+ function openConnection() {
+ if (conn.readyState === undefined || conn.readyState > 1) {
+ conn = new WebSocket('ws://127.0.0.1:42424');
+ conn.onopen = function () {
+ state.innerHTML = 'connected @port 42424';
+ };
+ conn.onmessage = function (event) {
+ var message = event.data;
+ log.innerHTML += "<br/>" + message;
+ };
+ conn.onclose = function (event) {
+ state.innerHTML = 'connection closed';
+ };
+ conn.onerror = function (event) {
+ state.innerHTML = 'got error';
+ };
+ }
+ }
+
+ var addEvent = (function () {
+ if (document.addEventListener) {
+ return function (el, type, fn) {
+ if (el && el.nodeName || el === window) {
+ el.addEventListener(type, fn, false);
+ } else if (el && el.length) {
+ for (var i = 0; i < el.length; i++) {
+ addEvent(el[i], type, fn);
+ }
+ }
+ };
+ } else {
+ return function (el, type, fn) {
+ if (el && el.nodeName || el === window) {
+ el.attachEvent('on' + type, function () { return fn.call(el, window.event); });
+ } else if (el && el.length) {
+ for (var i = 0; i < el.length; i++) {
+ addEvent(el[i], type, fn);
+ }
+ }
+ };
+ }
+ })();
+
+ var log = document.getElementById('log');
+ var cmd = document.getElementById('command');
+ var form = cmd.form;
+ var conn = {};
+ var state = document.getElementById('status');
+
+ if (window.WebSocket === undefined) {
+ state.innerHTML = 'websockets not supported';
+ } else {
+ addEvent(form, 'submit', function (event) {
+ event.preventDefault();
+ if (conn.readyState === 1) {
+ conn.send(JSON.stringify(cmd.value));
+ log.innerHTML = 'data sent';
+ cmd.value = '';
+ }
+ });
+
+ openConnection();
+ }
+ </script>
+</body>
+</html>
« no previous file with comments | « mojo/spy/spy.cc ('k') | mojo/spy/websocket_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698