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

Unified Diff: ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_whitelist_manager.mm

Issue 2529763002: Create FakeProviders for NativeAppMetadata and NativeAppManager (Closed)
Patch Set: FakeMetadata Changes Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_whitelist_manager.mm
diff --git a/ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_whitelist_manager.mm b/ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_whitelist_manager.mm
new file mode 100644
index 0000000000000000000000000000000000000000..ebefcdd798fdb25679831d88fe3568ed7396b934
--- /dev/null
+++ b/ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_whitelist_manager.mm
@@ -0,0 +1,53 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#import "ios/public/provider/chrome/browser/native_app_launcher/fake_native_app_whitelist_manager.h"
+
+#include "base/mac/scoped_nsobject.h"
+#include "url/gurl.h"
+
+@interface FakeNativeAppWhitelistManager () {
+ base::scoped_nsprotocol<id<NativeAppMetadata, NSObject>> _metadata;
rohitrao (ping after 24h) 2016/11/25 00:34:39 Is the NSObject necessary? The NativeAppMetadata
sdefresne 2016/11/25 08:41:58 You should use ARC for new code and not use scoped
sczs1 2016/11/26 04:10:18 Without the NSObject I wasn't able to call retain
+ base::scoped_nsobject<NSArray> _appWhitelist;
+}
+@end
+
+@implementation FakeNativeAppWhitelistManager
+
+- (instancetype)initWithMetadata:(id<NativeAppMetadata, NSObject>)metadata {
rohitrao (ping after 24h) 2016/11/25 00:34:38 Should be able to leave out the NSObject.
sczs1 2016/11/26 04:10:18 Acknowledged.
+ self = [super init];
+ if (self) {
+ _metadata.reset([metadata retain]);
+ }
+ return self;
+}
+
+- (void)setAppList:(NSArray*)appList
+ tldList:(NSArray*)tldList
+ acceptStoreIDs:(NSArray*)storeIDs {
+ _appWhitelist.reset([appList retain]);
+}
+
+- (id<NativeAppMetadata>)newNativeAppForURL:(const GURL&)url {
+ return [_metadata retain];
+}
+
+- (NSArray*)filteredAppsUsingBlock:(NativeAppFilter)condition {
+ return _appWhitelist;
+}
+
+- (NSURL*)schemeForAppId:(NSString*)appId {
+ return nil;
+}
+
+- (void)checkInstalledApps {
+ return;
rohitrao (ping after 24h) 2016/11/25 00:34:39 No need for "return;".
sczs1 2016/11/26 04:10:18 Done.
+}
+
+// Metadata property getter.
+- (id<NativeAppMetadata, NSObject>)metadata {
rohitrao (ping after 24h) 2016/11/25 00:34:38 Should be able to leave out the NSObject.
sczs1 2016/11/26 04:10:18 Acknowledged.
+ return _metadata;
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698