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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/websocket/send-arraybufferview.html

Issue 2812833003: Revert of [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: Created 3 years, 8 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
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> 7 <div id="description"></div>
8 <div id="console"></div> 8 <div id="console"></div>
9 <script type="text/javascript"> 9 <script type="text/javascript">
10 description("WebSocket: Send ArrayBufferViews."); 10 description("WebSocket: Send ArrayBufferViews.");
(...skipping 22 matching lines...) Expand all
33 function createArrayBufferViewContainingAllDistinctBytes() 33 function createArrayBufferViewContainingAllDistinctBytes()
34 { 34 {
35 // Return a slice of ArrayBuffer. 35 // Return a slice of ArrayBuffer.
36 var buffer = new ArrayBuffer(1000); 36 var buffer = new ArrayBuffer(1000);
37 var array = new Uint8Array(buffer, 123, 256); 37 var array = new Uint8Array(buffer, 123, 256);
38 for (var i = 0; i < 256; ++i) 38 for (var i = 0; i < 256; ++i)
39 array[i] = i; 39 array[i] = i;
40 return array; 40 return array;
41 } 41 }
42 42
43 function createSharedArrayBufferView()
44 {
45 return new Uint8Array(new SharedArrayBuffer(16));
46 }
47
48 var url = "ws://127.0.0.1:8880/check-binary-messages"; 43 var url = "ws://127.0.0.1:8880/check-binary-messages";
49 var ws = new WebSocket(url); 44 var ws = new WebSocket(url);
50 var closeEvent; 45 var closeEvent;
51 46
52 ws.onopen = function() 47 ws.onopen = function()
53 { 48 {
54 ws.send(createArrayBufferViewContainingHelloWorld()); 49 ws.send(createArrayBufferViewContainingHelloWorld());
55 ws.send(createEmptyArrayBufferView()); 50 ws.send(createEmptyArrayBufferView());
56 ws.send(createArrayBufferViewContainingAllDistinctBytes()); 51 ws.send(createArrayBufferViewContainingAllDistinctBytes());
57
58 if (window.SharedArrayBuffer) {
59 shouldThrow("ws.send(createSharedArrayBufferView())");
60 }
61 }; 52 };
62 53
63 ws.onmessage = function(event) 54 ws.onmessage = function(event)
64 { 55 {
65 var message = event.data; 56 var message = event.data;
66 if (startsWith(message, "PASS")) 57 if (startsWith(message, "PASS"))
67 testPassed(message); 58 testPassed(message);
68 else 59 else
69 testFailed(message); 60 testFailed(message);
70 }; 61 };
71 62
72 ws.onclose = function(event) 63 ws.onclose = function(event)
73 { 64 {
74 closeEvent = event; 65 closeEvent = event;
75 shouldBeTrue("closeEvent.wasClean"); 66 shouldBeTrue("closeEvent.wasClean");
76 finishJSTest(); 67 finishJSTest();
77 }; 68 };
78 69
79 </script> 70 </script>
80 </body> 71 </body>
81 </html> 72 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698