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

Side by Side Diff: mojo/bindings/js/core_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 define([ 5 define([
6 "gin/test/expect", 6 "gin/test/expect",
7 "mojo/bindings/js/core", 7 "mojo/bindings/js/core",
8 ], function(expect, core) { 8 "gc",
9 ], function(expect, core, gc) {
9 runWithMessagePipe(testNop); 10 runWithMessagePipe(testNop);
10 runWithMessagePipe(testReadAndWriteMessage); 11 runWithMessagePipe(testReadAndWriteMessage);
11 runWithDataPipe(testNop); 12 runWithDataPipe(testNop);
12 runWithDataPipe(testReadAndWriteDataPipe); 13 runWithDataPipe(testReadAndWriteDataPipe);
14 gc.collectGarbage(); // should not crash
13 this.result = "PASS"; 15 this.result = "PASS";
14 16
15 function runWithMessagePipe(test) { 17 function runWithMessagePipe(test) {
16 var pipe = core.createMessagePipe(); 18 var pipe = core.createMessagePipe();
17 19
18 test(pipe); 20 test(pipe);
19 21
20 expect(core.close(pipe.handle0)).toBe(core.RESULT_OK); 22 expect(core.close(pipe.handle0)).toBe(core.RESULT_OK);
21 expect(core.close(pipe.handle1)).toBe(core.RESULT_OK); 23 expect(core.close(pipe.handle1)).toBe(core.RESULT_OK);
22 } 24 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 82
81 expect(read.result).toBe(core.RESULT_OK); 83 expect(read.result).toBe(core.RESULT_OK);
82 expect(read.buffer.byteLength).toBe(42); 84 expect(read.buffer.byteLength).toBe(42);
83 85
84 var memory = new Uint8Array(read.buffer); 86 var memory = new Uint8Array(read.buffer);
85 for (var i = 0; i < memory.length; ++i) 87 for (var i = 0; i < memory.length; ++i)
86 expect(memory[i]).toBe((i * i) & 0xFF); 88 expect(memory[i]).toBe((i * i) & 0xFF);
87 } 89 }
88 90
89 }); 91 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698