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

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

Issue 628763002: Mojo JS bindings: simplify mojo.connectToService() usage - Part 1 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed template indentation Created 6 years, 2 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
« no previous file with comments | « mojo/apps/js/main.js ('k') | mojo/public/interfaces/bindings/tests/test_structs.mojom » ('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',
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(cppSide) {
23 this.cppSide_ = cppSide; 23 this.cppSide_ = cppSide;
24 cppSide.startTest(); 24 cppSide.startTest();
25 } 25 }
26 26
27 JsSideConnection.prototype = Object.create(jsToCpp.JsSideStub.prototype); 27 JsSideConnection.prototype =
28 Object.create(jsToCpp.JsSide.stubClass.prototype);
28 29
29 JsSideConnection.prototype.ping = function (arg) { 30 JsSideConnection.prototype.ping = function (arg) {
30 this.cppSide_.pingResponse(); 31 this.cppSide_.pingResponse();
31 }; 32 };
32 33
33 JsSideConnection.prototype.echo = function (numIterations, arg) { 34 JsSideConnection.prototype.echo = function (numIterations, arg) {
34 var dataPipe1; 35 var dataPipe1;
35 var dataPipe2; 36 var dataPipe2;
36 var i; 37 var i;
37 var messagePipe1; 38 var messagePipe1;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 var i; 209 var i;
209 sampleData = new Uint8Array(DATA_PIPE_PARAMS.capacityNumBytes); 210 sampleData = new Uint8Array(DATA_PIPE_PARAMS.capacityNumBytes);
210 for (i = 0; i < sampleData.length; ++i) { 211 for (i = 0; i < sampleData.length; ++i) {
211 sampleData[i] = i; 212 sampleData[i] = i;
212 } 213 }
213 sampleMessage = new Uint8Array(DATA_PIPE_PARAMS.capacityNumBytes); 214 sampleMessage = new Uint8Array(DATA_PIPE_PARAMS.capacityNumBytes);
214 for (i = 0; i < sampleMessage.length; ++i) { 215 for (i = 0; i < sampleMessage.length; ++i) {
215 sampleMessage[i] = 255 - i; 216 sampleMessage[i] = 255 - i;
216 } 217 }
217 retainedConnection = new connection.Connection(handle, JsSideConnection, 218 retainedConnection = new connection.Connection(handle, JsSideConnection,
218 jsToCpp.CppSideProxy); 219 jsToCpp.CppSide.proxyClass);
219 }; 220 };
220 }); 221 });
OLDNEW
« no previous file with comments | « mojo/apps/js/main.js ('k') | mojo/public/interfaces/bindings/tests/test_structs.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698