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

Unified Diff: mojo/public/js/bindings/core_unittests.js

Issue 646783005: Mojo JS Bindings: Mojo handles need a toString() method Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed address from output, added a unit test 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/bindings/js/handle.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/js/bindings/core_unittests.js
diff --git a/mojo/public/js/bindings/core_unittests.js b/mojo/public/js/bindings/core_unittests.js
index b115cc06362c67d3d9534b9bb3fa936d96ee02e9..72d5509836883d78c920a9c8b51306ba533874f9 100644
--- a/mojo/public/js/bindings/core_unittests.js
+++ b/mojo/public/js/bindings/core_unittests.js
@@ -15,6 +15,7 @@ define([
runWithDataPipe(testReadAndWriteDataPipe);
runWithDataPipeWithOptions(testNop);
runWithDataPipeWithOptions(testReadAndWriteDataPipe);
+ testHandleToString();
gc.collectGarbage(); // should not crash
this.result = "PASS";
@@ -115,4 +116,18 @@ define([
expect(memory[i]).toBe((i * i) & 0xFF);
}
+ function testHandleToString() {
+ var pipe = core.createDataPipe();
+ expect(pipe.consumerHandle.toString).toBeDefined();
+
+ var openHandleRE = /^\[mojo\:\:Handle \d*\]$/ // e.g. "[mojo::Handle 123]"
abarth-chromium 2014/10/24 21:17:10 \d* -> \d+
+ var openHandleString = pipe.consumerHandle.toString();
+ expect(openHandleString.match(openHandleRE)[0]).toEqual(openHandleString);
+
+ expect(core.close(pipe.producerHandle)).toBe(core.RESULT_OK);
+ expect(core.close(pipe.consumerHandle)).toBe(core.RESULT_OK);
+
+ expect(pipe.consumerHandle.toString()).toEqual("[mojo::Handle null]");
+ }
+
});
« no previous file with comments | « mojo/bindings/js/handle.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698