diff options
author | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-04 05:58:58 +0000 |
---|---|---|
committer | darin@chromium.org <darin@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-04 05:58:58 +0000 |
commit | 82f8b0f47d58226fe5dc8951637c9f614c2d6545 (patch) | |
tree | aff46e1aebb7288a8feb975890fa21bca5d2e312 /mojo/apps | |
parent | e9476cd6510e31d114e4de13e01bb54e317d2168 (diff) | |
download | chromium_src-82f8b0f47d58226fe5dc8951637c9f614c2d6545.zip chromium_src-82f8b0f47d58226fe5dc8951637c9f614c2d6545.tar.gz chromium_src-82f8b0f47d58226fe5dc8951637c9f614c2d6545.tar.bz2 |
Mojo: Generate bindings that make use of ScopedMessagePipeHandle.
R=abarth@chromium.org, davemoore@google.com, viettrungluu@chromium.org
Review URL: https://codereview.chromium.org/97713002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@238592 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/apps')
-rw-r--r-- | mojo/apps/js/bindings/codec_unittests.js | 19 | ||||
-rw-r--r-- | mojo/apps/js/bindings/connector_unittests.js | 7 |
2 files changed, 15 insertions, 11 deletions
diff --git a/mojo/apps/js/bindings/codec_unittests.js b/mojo/apps/js/bindings/codec_unittests.js index d8d8ba0..4511033 100644 --- a/mojo/apps/js/bindings/codec_unittests.js +++ b/mojo/apps/js/bindings/codec_unittests.js @@ -76,13 +76,11 @@ define([ foo.extra_bars[i].gamma = 3 * i; } foo.name = "I am a banana"; - foo.files = [ - // These are supposed to be handles, but we fake them with integers. - 23423782, 32549823, 98320423, 38502383, 92834093, - ]; + // This is supposed to be a handle, but we fake it with an integer. + foo.source = 23423782; var messageName = 31; - var payloadSize = 232; + var payloadSize = 192; var builder = new codec.MessageBuilder(messageName, payloadSize); builder.encodeStruct(sample.Foo, foo); @@ -90,20 +88,19 @@ define([ var message = builder.finish(); var expectedMemory = new Uint8Array([ - /* 0: */ 240, 0, 0, 0, 31, 0, 0, 0, - /* 8: */ 64, 0, 0, 0, 10, 0, 0, 0, + /* 0: */ 200, 0, 0, 0, 31, 0, 0, 0, + /* 8: */ 56, 0, 0, 0, 10, 0, 0, 0, /* 16: */ 0xD5, 0xB4, 0x12, 0x02, 0x93, 0x6E, 0x01, 0, /* 24: */ 5, 0, 0, 0, 0, 0, 0, 0, - /* 32: */ 40, 0, 0, 0, 0, 0, 0, 0, + /* 32: */ 32, 0, 0, 0, 0, 0, 0, 0, ]); // TODO(abarth): Test more of the message's raw memory. var actualMemory = new Uint8Array(message.memory.buffer, 0, expectedMemory.length); - expect(actualMemory).toEqual(expectedMemory); var expectedHandles = [ - 23423782, 32549823, 98320423, 38502383, 92834093, + 23423782, ]; expect(message.handles).toEqual(expectedHandles); @@ -127,7 +124,7 @@ define([ expect(foo2.extra_bars).toEqual(foo.extra_bars); expect(foo2.name).toBe(foo.name); - expect(foo2.files).toEqual(foo.files); + expect(foo2.source).toEqual(foo.source); } function testAlign() { diff --git a/mojo/apps/js/bindings/connector_unittests.js b/mojo/apps/js/bindings/connector_unittests.js index 8aa533f..650cf78 100644 --- a/mojo/apps/js/bindings/connector_unittests.js +++ b/mojo/apps/js/bindings/connector_unittests.js @@ -90,6 +90,7 @@ define([ var pipe = core.createMessagePipe(); var anotherPipe = core.createMessagePipe(); + var sourcePipe = core.createMessagePipe(); var connection0 = new connector.Connection( pipe.handle0, ServiceImpl, sample.ServiceClientProxy); @@ -100,6 +101,7 @@ define([ var foo = new sample.Foo(); foo.bar = new sample.Bar(); foo.name = "Example name"; + foo.source = sourcePipe.handle0; connection1.remote.frobinate(foo, true, anotherPipe.handle0); mockSupport.pumpOnce(core.RESULT_OK); @@ -112,6 +114,11 @@ define([ expect(mockSupport.numberOfWaitingCallbacks()).toBe(0); + // sourcePipe.handle0 was closed automatically when sent over IPC. + expect(core.close(sourcePipe.handle0)).toBe(core.RESULT_INVALID_ARGUMENT); + // sourcePipe.handle1 hasn't been closed yet. + expect(core.close(sourcePipe.handle1)).toBe(core.RESULT_OK); + // anotherPipe.handle0 was closed automatically when sent over IPC. expect(core.close(anotherPipe.handle0)).toBe(core.RESULT_INVALID_ARGUMENT); // anotherPipe.handle1 hasn't been closed yet. |