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

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

Issue 728043002: Revert of Update mojo sdk to rev afb4440fd5a10cba980878c326180b7ad7960480 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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/public/js/core.js ('k') | mojo/public/js/threading.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/js/core_unittests.js
diff --git a/mojo/public/js/core_unittests.js b/mojo/public/js/core_unittests.js
index eaeaa4f74aeb9ada6e199bb3408fb89fcec1d8ff..34cd4c0e6a1643428ff153d5bd091b07f183f4bc 100644
--- a/mojo/public/js/core_unittests.js
+++ b/mojo/public/js/core_unittests.js
@@ -15,6 +15,7 @@
runWithDataPipe(testReadAndWriteDataPipe);
runWithDataPipeWithOptions(testNop);
runWithDataPipeWithOptions(testReadAndWriteDataPipe);
+ testHandleToString();
gc.collectGarbage(); // should not crash
this.result = "PASS";
@@ -104,16 +105,6 @@
expect(write.result).toBe(core.RESULT_OK);
expect(write.numBytes).toBe(42);
- var peeked = core.readData(
- pipe.consumerHandle,
- core.READ_DATA_FLAG_PEEK | core.READ_DATA_FLAG_ALL_OR_NONE);
- expect(peeked.result).toBe(core.RESULT_OK);
- expect(peeked.buffer.byteLength).toBe(42);
-
- var peeked_memory = new Uint8Array(peeked.buffer);
- for (var i = 0; i < peeked_memory.length; ++i)
- expect(peeked_memory[i]).toBe((i * i) & 0xFF);
-
var read = core.readData(
pipe.consumerHandle, core.READ_DATA_FLAG_ALL_OR_NONE);
@@ -125,4 +116,18 @@
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]"
+ 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/public/js/core.js ('k') | mojo/public/js/threading.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698