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

Side by Side Diff: mojo/apps/js/test/js_to_cpp_unittest.js

Issue 411553003: Validate incoming JS Message Headers: test message parser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed WebUIMojoTest.EndToEndPing 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/content_resources.grd ('k') | mojo/apps/js/test/run_apps_js_tests.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 define('mojo/apps/js/test/js_to_cpp_unittest', [ 5 define('mojo/apps/js/test/js_to_cpp_unittest', [
6 'console', 6 'console',
7 'mojo/apps/js/test/js_to_cpp.mojom', 7 'mojo/apps/js/test/js_to_cpp.mojom',
8 'mojo/public/js/bindings/connection', 8 'mojo/public/js/bindings/connection',
9 'mojo/public/js/bindings/connector', 9 'mojo/public/js/bindings/connector',
10 'mojo/public/js/bindings/core', 10 'mojo/public/js/bindings/core',
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 var proto = connector.Connector.prototype; 91 var proto = connector.Connector.prototype;
92 var stopSignalled = false; 92 var stopSignalled = false;
93 93
94 proto.realAccept = proto.accept; 94 proto.realAccept = proto.accept;
95 proto.accept = function (message) { 95 proto.accept = function (message) {
96 var offset = iteration / 8; 96 var offset = iteration / 8;
97 var mask; 97 var mask;
98 var value; 98 var value;
99 if (offset < message.buffer.arrayBuffer.byteLength) { 99 if (offset < message.buffer.arrayBuffer.byteLength) {
100 mask = 1 << (iteration % 8); 100 mask = 1 << (iteration % 8);
101 value = message.buffer.dataView.getUint8(offset) ^ mask; 101 value = message.buffer.getUint8(offset) ^ mask;
102 message.buffer.dataView.setUint8(offset, value); 102 message.buffer.setUint8(offset, value);
103 return this.realAccept(message); 103 return this.realAccept(message);
104 } 104 }
105 stopSignalled = true; 105 stopSignalled = true;
106 return false; 106 return false;
107 }; 107 };
108 108
109 while (!stopSignalled) { 109 while (!stopSignalled) {
110 dataPipe = core.createDataPipe(DATA_PIPE_PARAMS); 110 dataPipe = core.createDataPipe(DATA_PIPE_PARAMS);
111 messagePipe = core.createMessagePipe(); 111 messagePipe = core.createMessagePipe();
112 writeDataPipe(dataPipe, sampleData); 112 writeDataPipe(dataPipe, sampleData);
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 sampleData[i] = i; 211 sampleData[i] = i;
212 } 212 }
213 sampleMessage = new Uint8Array(DATA_PIPE_PARAMS.capacityNumBytes); 213 sampleMessage = new Uint8Array(DATA_PIPE_PARAMS.capacityNumBytes);
214 for (i = 0; i < sampleMessage.length; ++i) { 214 for (i = 0; i < sampleMessage.length; ++i) {
215 sampleMessage[i] = 255 - i; 215 sampleMessage[i] = 255 - i;
216 } 216 }
217 retainedConnection = new connection.Connection(handle, JsSideConnection, 217 retainedConnection = new connection.Connection(handle, JsSideConnection,
218 jsToCpp.CppSideProxy); 218 jsToCpp.CppSideProxy);
219 }; 219 };
220 }); 220 });
OLDNEW
« no previous file with comments | « content/content_resources.grd ('k') | mojo/apps/js/test/run_apps_js_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698