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

Side by Side Diff: LayoutTests/http/tests/websocket/send-object-tostring-check.html

Issue 317113002: Use echo handler in send-object-tostring-check (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | LayoutTests/http/tests/websocket/send-object-tostring-check-expected.txt » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <head> 3 <head>
4 <script src="/js-test-resources/js-test.js"></script> 4 <script src="/js-test-resources/js-test.js"></script>
5 </head> 5 </head>
6 <body> 6 <body>
7 <div id="description"></div>
8 <div id="console"></div>
9 <script type="text/javascript"> 7 <script type="text/javascript">
10 description("WebSocket: Object's toString method should be called only once."); 8 description("WebSocket: Object's toString method should be called only once.");
11 9
12 window.jsTestIsAsync = true; 10 window.jsTestIsAsync = true;
13 11
14
15 var testObj = new function() { 12 var testObj = new function() {
16 this.callCounter = 0; 13 this.callCounter = 0;
17 this.toString = function() { 14 this.toString = function() {
18 this.callCounter++; 15 this.callCounter++;
16 return "Goodbye";
19 }; 17 };
20 } 18 }
21 19
22 var url = "ws://127.0.0.1:8880/"; 20 var ws = new WebSocket("ws://127.0.0.1:8880/echo");
23 var ws = new WebSocket(url);
24 var closeEvent;
25
26 21
27 ws.onopen = function() 22 ws.onopen = function()
28 { 23 {
29 ws.send(testObj); 24 ws.send(testObj);
30 }; 25 };
31 26
27 ws.onmessage = function(event)
28 {
29 shouldBeEqualToString("event.data", "Goodbye");
30 };
31
32 ws.onclose = function(event) 32 ws.onclose = function(event)
33 { 33 {
34 closeEvent = event;
35 shouldEvaluateTo("testObj.callCounter", 1); 34 shouldEvaluateTo("testObj.callCounter", 1);
35
36 window.closeEvent = event;
36 shouldBeTrue("closeEvent.wasClean"); 37 shouldBeTrue("closeEvent.wasClean");
38
37 finishJSTest(); 39 finishJSTest();
38 }; 40 };
39
40 </script> 41 </script>
41 </body> 42 </body>
42 </html> 43 </html>
OLDNEW
« no previous file with comments | « no previous file | LayoutTests/http/tests/websocket/send-object-tostring-check-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698