OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #import "ios/public/test/test_updatable_resource_provider.h" | 5 #import "ios/public/test/test_updatable_resource_provider.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/mac/scoped_nsobject.h" | 8 #include "base/mac/scoped_nsobject.h" |
9 | 9 |
10 #pragma mark - TestUpdatabeResourceDescriptor | 10 #pragma mark - TestUpdatabeResourceDescriptor |
(...skipping 22 matching lines...) Expand all Loading... |
33 return nil; | 33 return nil; |
34 } | 34 } |
35 @end | 35 @end |
36 | 36 |
37 #pragma mark - TestUpdatableResource | 37 #pragma mark - TestUpdatableResource |
38 | 38 |
39 // Dummy UpdatableResourceDescriptorBridge implementation that simply loads data | 39 // Dummy UpdatableResourceDescriptorBridge implementation that simply loads data |
40 // from the specified plist file. | 40 // from the specified plist file. |
41 @interface TestUpdatableResource : NSObject<UpdatableResourceBridge> | 41 @interface TestUpdatableResource : NSObject<UpdatableResourceBridge> |
42 @property(nonatomic, readonly) id<UpdatableResourceDescriptorBridge> descriptor; | 42 @property(nonatomic, readonly) id<UpdatableResourceDescriptorBridge> descriptor; |
| 43 - (instancetype)init NS_UNAVAILABLE; |
43 - (instancetype)initWithDelegate:(id<UpdatableResourceDelegate>)delegate | 44 - (instancetype)initWithDelegate:(id<UpdatableResourceDelegate>)delegate |
44 plist:(NSString*)resource_identifier | 45 plist:(NSString*)resource_identifier |
45 NS_DESIGNATED_INITIALIZER; | 46 NS_DESIGNATED_INITIALIZER; |
46 @end | 47 @end |
47 | 48 |
48 @implementation TestUpdatableResource { | 49 @implementation TestUpdatableResource { |
49 base::scoped_nsprotocol<id<UpdatableResourceDelegate>> _delegate; | 50 base::scoped_nsprotocol<id<UpdatableResourceDelegate>> _delegate; |
50 base::scoped_nsprotocol<id<UpdatableResourceDescriptorBridge>> _descriptor; | 51 base::scoped_nsprotocol<id<UpdatableResourceDescriptorBridge>> _descriptor; |
51 } | 52 } |
52 | 53 |
| 54 - (instancetype)init { |
| 55 NOTREACHED(); |
| 56 return nil; |
| 57 } |
| 58 |
53 - (instancetype)initWithDelegate:(id<UpdatableResourceDelegate>)delegate | 59 - (instancetype)initWithDelegate:(id<UpdatableResourceDelegate>)delegate |
54 plist:(NSString*)resourceIdentifier { | 60 plist:(NSString*)resourceIdentifier { |
55 if (self = [super init]) { | 61 if (self = [super init]) { |
56 _delegate.reset([delegate retain]); | 62 _delegate.reset([delegate retain]); |
57 _descriptor.reset([[TestUpdatabeResourceDescriptor alloc] init]); | 63 _descriptor.reset([[TestUpdatabeResourceDescriptor alloc] init]); |
58 DCHECK([resourceIdentifier hasSuffix:@".plist"]) | 64 DCHECK([resourceIdentifier hasSuffix:@".plist"]) |
59 << "TestUpdatableResource supports only the plist format"; | 65 << "TestUpdatableResource supports only the plist format"; |
60 [_descriptor setBundleResourcePath:resourceIdentifier]; | 66 [_descriptor setBundleResourcePath:resourceIdentifier]; |
61 } | 67 } |
62 return self; | 68 return self; |
(...skipping 30 matching lines...) Expand all Loading... |
93 NSString* resource_identifier, | 99 NSString* resource_identifier, |
94 id<UpdatableResourceDelegate> delegate) { | 100 id<UpdatableResourceDelegate> delegate) { |
95 NSString* path = | 101 NSString* path = |
96 [NSString stringWithFormat:@"%@/gm-config/ANY/%@", | 102 [NSString stringWithFormat:@"%@/gm-config/ANY/%@", |
97 [[NSBundle mainBundle] resourcePath], | 103 [[NSBundle mainBundle] resourcePath], |
98 resource_identifier]; | 104 resource_identifier]; |
99 return [[TestUpdatableResource alloc] initWithDelegate:delegate plist:path]; | 105 return [[TestUpdatableResource alloc] initWithDelegate:delegate plist:path]; |
100 } | 106 } |
101 | 107 |
102 } // namespace ios | 108 } // namespace ios |
OLD | NEW |