diff options
4 files changed, 24 insertions, 4 deletions
diff --git a/mojo/bindings/js/codec_unittests.js b/mojo/bindings/js/codec_unittests.js index a504054..27cfb5c 100644 --- a/mojo/bindings/js/codec_unittests.js +++ b/mojo/bindings/js/codec_unittests.js @@ -84,7 +84,7 @@ define([ foo.source = 23423782; var messageName = 31; - var payloadSize = 224; + var payloadSize = 240; var builder = new codec.MessageBuilder(messageName, payloadSize); builder.encodeStruct(sample.Foo, foo); @@ -94,10 +94,10 @@ define([ var expectedMemory = new Uint8Array([ /* 0: */ 16, 0, 0, 0, 2, 0, 0, 0, /* 8: */ 31, 0, 0, 0, 0, 0, 0, 0, - /* 16: */ 72, 0, 0, 0, 12, 0, 0, 0, + /* 16: */ 80, 0, 0, 0, 13, 0, 0, 0, /* 24: */ 0xD5, 0xB4, 0x12, 0x02, 0x93, 0x6E, 0x01, 0, /* 32: */ 5, 0, 0, 0, 0, 0, 0, 0, - /* 40: */ 48, 0, 0, 0, 0, 0, 0, 0, + /* 40: */ 56, 0, 0, 0, 0, 0, 0, 0, ]); // TODO(abarth): Test more of the message's raw memory. var actualMemory = new Uint8Array(message.memory.buffer, diff --git a/mojo/public/cpp/bindings/tests/sample_service_unittest.cc b/mojo/public/cpp/bindings/tests/sample_service_unittest.cc index 75d0d9b..05eca44 100644 --- a/mojo/public/cpp/bindings/tests/sample_service_unittest.cc +++ b/mojo/public/cpp/bindings/tests/sample_service_unittest.cc @@ -75,6 +75,15 @@ Foo MakeFoo() { output_streams[i] = producer.Pass(); } + mojo::Array<mojo::Array<bool> >::Builder array_of_array_of_bools(2); + for (size_t i = 0; i < 2; ++i) { + mojo::Array<bool>::Builder array_of_bools(2); + for (size_t j = 0; j < 2; ++j) { + array_of_bools[j] = j; + } + array_of_array_of_bools[i] = array_of_bools.Finish(); + } + mojo::ScopedMessagePipeHandle pipe0, pipe1; mojo::CreateMessagePipe(&pipe0, &pipe1); @@ -91,6 +100,7 @@ Foo MakeFoo() { foo.set_source(pipe1.Pass()); foo.set_input_streams(input_streams.Finish()); foo.set_output_streams(output_streams.Finish()); + foo.set_array_of_array_of_bools(array_of_array_of_bools.Finish()); return foo.Finish(); } @@ -138,6 +148,14 @@ void CheckFoo(const Foo& foo) { EXPECT_FALSE(foo.output_streams().is_null()); EXPECT_EQ(2u, foo.output_streams().size()); + + EXPECT_EQ(2u, foo.array_of_array_of_bools().size()); + for (size_t i = 0; i < foo.array_of_array_of_bools().size(); ++i) { + EXPECT_EQ(2u, foo.array_of_array_of_bools()[i].size()); + for (size_t j = 0; j < foo.array_of_array_of_bools()[i].size(); ++j) { + EXPECT_EQ(bool(j), foo.array_of_array_of_bools()[i][j]); + } + } } void PrintSpacer(int depth) { @@ -222,6 +240,7 @@ void Print(int depth, const char* name, const Foo& foo) { Print(depth, "source", foo.source().get()); Print(depth, "input_streams", foo.input_streams()); Print(depth, "output_streams", foo.output_streams()); + Print(depth, "array_of_array_of_bools", foo.array_of_array_of_bools()); --depth; } } diff --git a/mojo/public/interfaces/bindings/tests/sample_service.mojom b/mojo/public/interfaces/bindings/tests/sample_service.mojom index 9786537..04893a4 100644 --- a/mojo/public/interfaces/bindings/tests/sample_service.mojom +++ b/mojo/public/interfaces/bindings/tests/sample_service.mojom @@ -34,6 +34,7 @@ struct Foo { handle<message_pipe> source @9; handle<data_pipe_consumer>[] input_streams @10; handle<data_pipe_producer>[] output_streams @11; + bool[][] array_of_array_of_bools @12; }; struct DefaultsTestInner { diff --git a/mojo/public/tools/bindings/pylib/mojom/parse/parser.py b/mojo/public/tools/bindings/pylib/mojom/parse/parser.py index 6f0a23a..33af7d9 100755 --- a/mojo/public/tools/bindings/pylib/mojom/parse/parser.py +++ b/mojo/public/tools/bindings/pylib/mojom/parse/parser.py @@ -215,7 +215,7 @@ class Parser(object): p[0] = p[1] def p_array(self, p): - """array : basictypename LBRACKET RBRACKET""" + """array : typename LBRACKET RBRACKET""" p[0] = p[1] + "[]" def p_ordinal(self, p): |