/core/externals/update-engine/Core/KSUpdateInfoTest.m
Objective C | 77 lines | 52 code | 11 blank | 14 comment | 0 complexity | c00532d049b2d1f4cea6f534d2e71db0 MD5 | raw file
1// Copyright 2008 Google Inc. 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15#import <SenTestingKit/SenTestingKit.h> 16#import "KSUpdateInfo.h" 17 18#import "KSExistenceChecker.h" 19#import "KSTicket.h" 20 21@interface KSUpdateInfoTest : SenTestCase 22@end 23 24 25@implementation KSUpdateInfoTest 26 27- (void)testAccessors { 28 KSUpdateInfo *update = [[[KSUpdateInfo alloc] init] autorelease]; 29 STAssertNotNil(update, nil); 30 31 STAssertNil([update productID], nil); 32 STAssertNil([update codebaseURL], nil); 33 STAssertNil([update codeSize], nil); 34 STAssertNil([update codeHash], nil); 35 STAssertNil([update moreInfoURLString], nil); 36 STAssertNil([update promptUser], nil); 37 STAssertNil([update requireReboot], nil); 38 STAssertNil([update localizationBundle], nil); 39 STAssertNil([update displayVersion], nil); 40 STAssertNil([update version], nil); 41 STAssertNil([update ticket], nil); 42 43 KSTicket *ticket = 44 [KSTicket ticketWithProductID:@"com.google.glockenspiel" 45 version:@"17" 46 existenceChecker:[KSExistenceChecker trueChecker] 47 serverURL:[[[NSURL alloc] init] autorelease]]; 48 49 // Now, make sure these return non-nil values for a real dictionary. 50 update = [NSDictionary dictionaryWithObjectsAndKeys: 51 @"foo", kServerProductID, 52 [NSURL URLWithString:@"a://a"], kServerCodebaseURL, 53 [NSNumber numberWithInt:2], kServerCodeSize, 54 @"zzz", kServerCodeHash, 55 @"a://b", kServerMoreInfoURLString, 56 [NSNumber numberWithBool:YES], kServerPromptUser, 57 [NSNumber numberWithBool:YES], kServerRequireReboot, 58 @"/Hassel/Hoff", kServerLocalizationBundle, 59 @"1.3.2 (with pudding)", kServerDisplayVersion, 60 @"1.3.2", kServerVersion, 61 ticket, kTicket, 62 nil]; 63 64 STAssertEqualObjects(@"foo", [update productID], nil); 65 STAssertEqualObjects([NSURL URLWithString:@"a://a"], [update codebaseURL], nil); 66 STAssertEqualObjects([NSNumber numberWithInt:2], [update codeSize], nil); 67 STAssertEqualObjects(@"zzz", [update codeHash], nil); 68 STAssertEqualObjects(@"a://b", [update moreInfoURLString], nil); 69 STAssertEqualObjects([NSNumber numberWithBool:YES], [update promptUser], nil); 70 STAssertEqualObjects([NSNumber numberWithBool:YES], [update requireReboot], nil); 71 STAssertEqualObjects(@"/Hassel/Hoff", [update localizationBundle], nil); 72 STAssertEqualObjects(@"1.3.2 (with pudding)", [update displayVersion], nil); 73 STAssertEqualObjects(@"1.3.2", [update version], nil); 74 STAssertEqualObjects(ticket, [update ticket], nil); 75} 76 77@end