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

Side by Side Diff: mojo/apps/js/bindings/connection_unittests.js

Issue 214183003: Change mojo JS bindings to expose a handle object, which is Closed when garbage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rm.extra.gc Created 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // Mock out the support module to avoid depending on the message loop. 5 // Mock out the support module to avoid depending on the message loop.
6 define("mojo/bindings/js/support", function() { 6 define("mojo/bindings/js/support", function() {
7 var waitingCallbacks = []; 7 var waitingCallbacks = [];
8 8
9 function WaitCookie(id) { 9 function WaitCookie(id) {
10 this.id = id; 10 this.id = id;
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 return exports; 46 return exports;
47 }); 47 });
48 48
49 define([ 49 define([
50 "gin/test/expect", 50 "gin/test/expect",
51 "mojo/bindings/js/support", 51 "mojo/bindings/js/support",
52 "mojo/bindings/js/core", 52 "mojo/bindings/js/core",
53 "mojo/public/bindings/js/connection", 53 "mojo/public/bindings/js/connection",
54 "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom", 54 "mojo/public/interfaces/bindings/tests/sample_interfaces.mojom",
55 "mojo/public/interfaces/bindings/tests/sample_service.mojom", 55 "mojo/public/interfaces/bindings/tests/sample_service.mojom",
56 "gc",
56 ], function(expect, 57 ], function(expect,
57 mockSupport, 58 mockSupport,
58 core, 59 core,
59 connection, 60 connection,
60 sample_interfaces, 61 sample_interfaces,
61 sample_service) { 62 sample_service,
63 gc) {
62 testClientServer(); 64 testClientServer();
63 testWriteToClosedPipe(); 65 testWriteToClosedPipe();
64 testRequestResponse(); 66 testRequestResponse();
65 this.result = "PASS"; 67 this.result = "PASS";
68 gc.collectGarbage(); // should not crash
66 69
67 function testClientServer() { 70 function testClientServer() {
68 var receivedFrobinate = false; 71 var receivedFrobinate = false;
69 var receivedDidFrobinate = false; 72 var receivedDidFrobinate = false;
70 73
71 // ServiceImpl ------------------------------------------------------------- 74 // ServiceImpl -------------------------------------------------------------
72 75
73 function ServiceImpl(peer) { 76 function ServiceImpl(peer) {
74 this.peer = peer; 77 this.peer = peer;
75 } 78 }
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 231
229 connection1.remote.echoStrings("hello", "world", function(a, b) { 232 connection1.remote.echoStrings("hello", "world", function(a, b) {
230 echoedString = a + " " + b; 233 echoedString = a + " " + b;
231 }); 234 });
232 235
233 mockSupport.pumpOnce(core.RESULT_OK); 236 mockSupport.pumpOnce(core.RESULT_OK);
234 237
235 expect(echoedString).toBe("hello world"); 238 expect(echoedString).toBe("hello world");
236 } 239 }
237 }); 240 });
OLDNEW
« no previous file with comments | « gin/test/gc.cc ('k') | mojo/apps/js/mojo_runner_delegate.cc » ('j') | mojo/bindings/js/core.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698