OLD | NEW |
1 // Protocol Buffers - Google's data interchange format | 1 // Protocol Buffers - Google's data interchange format |
2 // Copyright 2008 Google Inc. All rights reserved. | 2 // Copyright 2008 Google Inc. All rights reserved. |
3 // https://developers.google.com/protocol-buffers/ | 3 // https://developers.google.com/protocol-buffers/ |
4 // | 4 // |
5 // Redistribution and use in source and binary forms, with or without | 5 // Redistribution and use in source and binary forms, with or without |
6 // modification, are permitted provided that the following conditions are | 6 // modification, are permitted provided that the following conditions are |
7 // met: | 7 // met: |
8 // | 8 // |
9 // * Redistributions of source code must retain the above copyright | 9 // * Redistributions of source code must retain the above copyright |
10 // notice, this list of conditions and the following disclaimer. | 10 // notice, this list of conditions and the following disclaimer. |
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
489 assertTrue(bytesCompare(msg.getRepeatedBytesList_asU8()[0], BYTES)); | 489 assertTrue(bytesCompare(msg.getRepeatedBytesList_asU8()[0], BYTES)); |
490 assertTrue(bytesCompare(msg.getRepeatedBytesList_asU8()[1], BYTES)); | 490 assertTrue(bytesCompare(msg.getRepeatedBytesList_asU8()[1], BYTES)); |
491 } | 491 } |
492 | 492 |
493 msg.setRepeatedBytesList([BYTES, BYTES]); | 493 msg.setRepeatedBytesList([BYTES, BYTES]); |
494 assertGetters(); | 494 assertGetters(); |
495 | 495 |
496 msg.setRepeatedBytesList([BYTES_B64, BYTES_B64]); | 496 msg.setRepeatedBytesList([BYTES_B64, BYTES_B64]); |
497 assertGetters(); | 497 assertGetters(); |
498 | 498 |
499 msg.setRepeatedBytesList(null); | 499 msg.setRepeatedBytesList([]); |
500 assertEquals(0, msg.getRepeatedBytesList().length); | 500 assertEquals(0, msg.getRepeatedBytesList().length); |
501 assertEquals(0, msg.getRepeatedBytesList_asB64().length); | 501 assertEquals(0, msg.getRepeatedBytesList_asB64().length); |
502 assertEquals(0, msg.getRepeatedBytesList_asU8().length); | 502 assertEquals(0, msg.getRepeatedBytesList_asU8().length); |
503 }); | 503 }); |
504 | 504 |
505 /** | 505 /** |
506 * Helper: fill all extension values. | 506 * Helper: fill all extension values. |
507 * @param {proto.jspb.test.TestExtendable} msg | 507 * @param {proto.jspb.test.TestExtendable} msg |
508 */ | 508 */ |
509 function fillExtensions(msg) { | 509 function fillExtensions(msg) { |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 * Tests extension serialization and deserialization. | 619 * Tests extension serialization and deserialization. |
620 */ | 620 */ |
621 it('testExtensions', function() { | 621 it('testExtensions', function() { |
622 var msg = new proto.jspb.test.TestExtendable(); | 622 var msg = new proto.jspb.test.TestExtendable(); |
623 fillExtensions(msg); | 623 fillExtensions(msg); |
624 var encoded = msg.serializeBinary(); | 624 var encoded = msg.serializeBinary(); |
625 var decoded = proto.jspb.test.TestExtendable.deserializeBinary(encoded); | 625 var decoded = proto.jspb.test.TestExtendable.deserializeBinary(encoded); |
626 checkExtensions(decoded); | 626 checkExtensions(decoded); |
627 }); | 627 }); |
628 }); | 628 }); |
OLD | NEW |