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

Side by Side Diff: third_party/protobuf/objectivec/Tests/GPBCodedOuputStreamTests.m

Issue 1983203003: Update third_party/protobuf to protobuf-v3.0.0-beta-3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: owners Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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 12 matching lines...) Expand all
23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 30
31 #import "GPBTestUtilities.h" 31 #import "GPBTestUtilities.h"
32 32
33 #import "GPBCodedOutputStream.h" 33 #import "GPBCodedOutputStream_PackagePrivate.h"
34 #import "GPBCodedInputStream.h" 34 #import "GPBCodedInputStream.h"
35 #import "GPBUtilities_PackagePrivate.h" 35 #import "GPBUtilities_PackagePrivate.h"
36 #import "google/protobuf/Unittest.pbobjc.h" 36 #import "google/protobuf/Unittest.pbobjc.h"
37 37
38 @interface GPBCodedOutputStream (InternalMethods)
39 // Declared in the .m file, expose for testing.
40 - (instancetype)initWithOutputStream:(NSOutputStream *)output
41 data:(NSMutableData *)data;
42 @end
43
44 @interface GPBCodedOutputStream (Helper)
45 + (instancetype)streamWithOutputStream:(NSOutputStream *)output
46 bufferSize:(size_t)bufferSize;
47 @end
48
49 @implementation GPBCodedOutputStream (Helper)
50 + (instancetype)streamWithOutputStream:(NSOutputStream *)output
51 bufferSize:(size_t)bufferSize {
52 NSMutableData *data = [NSMutableData dataWithLength:bufferSize];
53 return [[[self alloc] initWithOutputStream:output data:data] autorelease];
54 }
55 @end
56
38 @interface CodedOutputStreamTests : GPBTestCase 57 @interface CodedOutputStreamTests : GPBTestCase
39 @end 58 @end
40 59
41 @implementation CodedOutputStreamTests 60 @implementation CodedOutputStreamTests
42 61
43 - (NSData*)bytes_with_sentinel:(int32_t)unused, ... { 62 - (NSData*)bytes_with_sentinel:(int32_t)unused, ... {
44 va_list list; 63 va_list list;
45 va_start(list, unused); 64 va_start(list, unused);
46 65
47 NSMutableData* values = [NSMutableData dataWithCapacity:0]; 66 NSMutableData* values = [NSMutableData dataWithCapacity:0];
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // Not kGPBDefaultRepeatCount because we are comparing to a golden master file 331 // Not kGPBDefaultRepeatCount because we are comparing to a golden master file
313 // that was generated with 2. 332 // that was generated with 2.
314 TestAllExtensions* extensions = [self allExtensionsSetRepeatedCount:2]; 333 TestAllExtensions* extensions = [self allExtensionsSetRepeatedCount:2];
315 rawBytes = extensions.data; 334 rawBytes = extensions.data;
316 goldenData = [self getDataFileNamed:@"golden_packed_fields_message" 335 goldenData = [self getDataFileNamed:@"golden_packed_fields_message"
317 dataToWrite:rawBytes]; 336 dataToWrite:rawBytes];
318 XCTAssertEqualObjects(rawBytes, goldenData); 337 XCTAssertEqualObjects(rawBytes, goldenData);
319 } 338 }
320 339
321 @end 340 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698