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

Side by Side Diff: mojo/edk/js/tests/js_to_cpp_tests.js

Issue 782693004: Update mojo sdk to rev f6c8ec07c01deebc13178d516225fd12695c3dc2 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: hack mojo_system_impl gypi for android :| Created 6 years 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 // 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/edk/js/tests/js_to_cpp_tests', [ 5 define('mojo/edk/js/tests/js_to_cpp_tests', [
6 'console', 6 'console',
7 'mojo/edk/js/tests/js_to_cpp.mojom', 7 'mojo/edk/js/tests/js_to_cpp.mojom',
8 'mojo/public/js/connection', 8 'mojo/public/js/connection',
9 'mojo/public/js/connector', 9 'mojo/public/js/connector',
10 'mojo/public/js/core', 10 'mojo/public/js/core',
11 ], function (console, jsToCpp, connection, connector, core) { 11 ], function (console, jsToCpp, connection, connector, core) {
12 var retainedConnection; 12 var retainedConnection;
13 var sampleData; 13 var sampleData;
14 var sampleMessage; 14 var sampleMessage;
15 var BAD_VALUE = 13; 15 var BAD_VALUE = 13;
16 var DATA_PIPE_PARAMS = { 16 var DATA_PIPE_PARAMS = {
17 flags: core.CREATE_DATA_PIPE_OPTIONS_FLAG_NONE, 17 flags: core.CREATE_DATA_PIPE_OPTIONS_FLAG_NONE,
18 elementNumBytes: 1, 18 elementNumBytes: 1,
19 capacityNumBytes: 64 19 capacityNumBytes: 64
20 }; 20 };
21 21
22 function JsSideConnection(cppSide) { 22 function JsSideConnection() {
23 this.cppSide_ = cppSide;
24 cppSide.startTest();
25 } 23 }
26 24
27 JsSideConnection.prototype = 25 JsSideConnection.prototype =
28 Object.create(jsToCpp.JsSide.stubClass.prototype); 26 Object.create(jsToCpp.JsSide.stubClass.prototype);
29 27
30 JsSideConnection.prototype.ping = function (arg) { 28 JsSideConnection.prototype.ping = function (arg) {
31 this.cppSide_.pingResponse(); 29 this.cppSide_.pingResponse();
32 }; 30 };
33 31
34 JsSideConnection.prototype.echo = function (numIterations, arg) { 32 JsSideConnection.prototype.echo = function (numIterations, arg) {
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 return list; 196 return list;
199 } 197 }
200 198
201 function createEchoArgsList() { 199 function createEchoArgsList() {
202 var genuineArray = Array.prototype.slice.call(arguments); 200 var genuineArray = Array.prototype.slice.call(arguments);
203 return genuineArray.reduceRight(function (previous, current) { 201 return genuineArray.reduceRight(function (previous, current) {
204 return createEchoArgsListElement(current, previous); 202 return createEchoArgsListElement(current, previous);
205 }, null); 203 }, null);
206 } 204 }
207 205
206 function createCppSideConnection(handle, stubClass, proxyClass) {
207 var c = new connection.Connection(handle, stubClass, proxyClass);
208 c.local.cppSide_ = c.remote;
209 return c;
210 }
211
208 return function(handle) { 212 return function(handle) {
209 var i; 213 var i;
210 sampleData = new Uint8Array(DATA_PIPE_PARAMS.capacityNumBytes); 214 sampleData = new Uint8Array(DATA_PIPE_PARAMS.capacityNumBytes);
211 for (i = 0; i < sampleData.length; ++i) { 215 for (i = 0; i < sampleData.length; ++i) {
212 sampleData[i] = i; 216 sampleData[i] = i;
213 } 217 }
214 sampleMessage = new Uint8Array(DATA_PIPE_PARAMS.capacityNumBytes); 218 sampleMessage = new Uint8Array(DATA_PIPE_PARAMS.capacityNumBytes);
215 for (i = 0; i < sampleMessage.length; ++i) { 219 for (i = 0; i < sampleMessage.length; ++i) {
216 sampleMessage[i] = 255 - i; 220 sampleMessage[i] = 255 - i;
217 } 221 }
218 retainedConnection = new connection.Connection(handle, JsSideConnection, 222 retainedConnection = createCppSideConnection(
219 jsToCpp.CppSide.proxyClass); 223 handle, JsSideConnection,jsToCpp.CppSide.proxyClass);
224 retainedConnection.remote.startTest();
220 }; 225 };
221 }); 226 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698