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

Unified Diff: ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator+testing.mm

Issue 2588713002: Upstream Chrome on iOS source code [4/11]. (Closed)
Patch Set: Created 4 years 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/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator+testing.mm
diff --git a/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator+testing.mm b/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator+testing.mm
new file mode 100644
index 0000000000000000000000000000000000000000..1847f81f8529d6ba864c48344c2240c4791e1f55
--- /dev/null
+++ b/ios/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator+testing.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/chrome/browser/ui/contextual_search/touch_to_search_permissions_mediator+testing.h"
+
+namespace ios {
+class ChromeBrowserState;
+}
+
+static BOOL isTouchToSearchAvailable = YES;
+
+@implementation MockTouchToSearchPermissionsMediator
+@synthesize canSendPageURLs;
+@synthesize canPreloadSearchResults;
+@synthesize areContextualSearchQueriesSupported;
+@synthesize isVoiceOverEnabled;
+@synthesize canExtractTapContextForAllURLs;
+
+// Synthesize preference state getter/setter to bypass superclass
+// implementation.
+@synthesize preferenceState;
+
++ (void)setIsTouchToSearchAvailableOnDevice:(BOOL)available {
+ isTouchToSearchAvailable = available;
+}
+
++ (BOOL)isTouchToSearchAvailableOnDevice {
+ return isTouchToSearchAvailable;
+}
+
+- (instancetype)initWithBrowserState:(ios::ChromeBrowserState*)browserState {
+ if ((self = [super initWithBrowserState:browserState])) {
+ // Default values mimic everything being allowed.
+ self.preferenceState = TouchToSearch::ENABLED;
+ self.canSendPageURLs = YES;
+ self.canPreloadSearchResults = YES;
+ self.areContextualSearchQueriesSupported = YES;
+ self.isVoiceOverEnabled = NO;
+ self.canExtractTapContextForAllURLs = YES;
+ }
+ return self;
+}
+
+- (void)setUpBrowserState:(ios::ChromeBrowserState*)browserState {
+ // no-op, overriding superclass method.
+}
+
+- (BOOL)canExtractTapContextForURL:(const GURL&)url {
+ return canExtractTapContextForAllURLs;
+}
+
+@end

Powered by Google App Engine
This is Rietveld 408576698