Commit 5a862993 authored by justincohen's avatar justincohen Committed by Commit bot

Correct iOS build for latest Xcode beta.

- NSObject's NS_DESIGNATED_INITIALIZER -init method requires
   an -init NS_UNAVAILABLE implementation.
- Correct nonnull API usage.
- Cast to NSInteger for comparisons with NSNotFound.
- Account for dylib -> tbd change in latest Xcode.

BUG=498581, 498825, 498841

Review URL: https://codereview.chromium.org/1171203004

Cr-Commit-Position: refs/heads/master@{#333756}
parent 39825ed5
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#import "base/ios/crb_protocol_observers.h" #import "base/ios/crb_protocol_observers.h"
#include "base/ios/weak_nsobject.h" #include "base/ios/weak_nsobject.h"
#include "base/logging.h"
#include "base/mac/scoped_nsautorelease_pool.h" #include "base/mac/scoped_nsautorelease_pool.h"
#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_nsobject.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -36,10 +37,9 @@ ...@@ -36,10 +37,9 @@
@end @end
@interface TestMutateObserver : TestCompleteObserver @interface TestMutateObserver : TestCompleteObserver
- (instancetype)initWithObserver:(CRBProtocolObservers*)observer - (instancetype)initWithObserver:(CRBProtocolObservers*)observer
NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
@end @end
namespace { namespace {
...@@ -266,6 +266,11 @@ TEST_F(CRBProtocolObserversTest, NestedMutateObservers) { ...@@ -266,6 +266,11 @@ TEST_F(CRBProtocolObserversTest, NestedMutateObservers) {
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (void)mutateByAddingObserver:(id<TestObserver>)observer { - (void)mutateByAddingObserver:(id<TestObserver>)observer {
[_observers addObserver:observer]; [_observers addObserver:observer];
} }
......
...@@ -18,11 +18,12 @@ class InfoBarDelegate; ...@@ -18,11 +18,12 @@ class InfoBarDelegate;
@interface InfoBarController : NSObject @interface InfoBarController : NSObject
@property(nonatomic, readonly) InfoBarViewDelegate* delegate; @property(nonatomic, readonly) InfoBarViewDelegate* delegate;
// Designated initializer. // Designated initializer.
- (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate - (instancetype)initWithDelegate:(InfoBarViewDelegate*)delegate
NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
// Creates a view and lays out all the infobar elements in it. Will not add // Creates a view and lays out all the infobar elements in it. Will not add
// it as a subview yet. This method must be overriden in subclasses. // it as a subview yet. This method must be overriden in subclasses.
- (base::scoped_nsobject<UIView<InfoBarViewProtocol>>) - (base::scoped_nsobject<UIView<InfoBarViewProtocol>>)
......
...@@ -25,6 +25,11 @@ ...@@ -25,6 +25,11 @@
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (void)dealloc { - (void)dealloc {
[_infoBarView removeFromSuperview]; [_infoBarView removeFromSuperview];
[super dealloc]; [super dealloc];
......
...@@ -301,7 +301,7 @@ NSTimeInterval kPickerAnimationDurationInSeconds = 0.2; ...@@ -301,7 +301,7 @@ NSTimeInterval kPickerAnimationDurationInSeconds = 0.2;
target:self target:self
action:@selector(dismissLanguageSelectionView)]); action:@selector(dismissLanguageSelectionView)]);
base::scoped_nsobject<UINavigationItem> item( base::scoped_nsobject<UINavigationItem> item(
[[UINavigationItem alloc] initWithTitle:nil]); [[UINavigationItem alloc] initWithTitle:@""]);
[item setRightBarButtonItem:doneButton]; [item setRightBarButtonItem:doneButton];
[item setLeftBarButtonItem:cancelButton]; [item setLeftBarButtonItem:cancelButton];
[item setHidesBackButton:YES]; [item setHidesBackButton:YES];
......
...@@ -10,12 +10,12 @@ ...@@ -10,12 +10,12 @@
// Generic command that can be passed to |chromeExecuteCommand|. // Generic command that can be passed to |chromeExecuteCommand|.
@interface GenericChromeCommand : NSObject @interface GenericChromeCommand : NSObject
// Mark inherited initializer as unavailable to prevent calling it by mistake.
- (instancetype)init NS_UNAVAILABLE;
// Initializes the GenericChromeCommand with given |tag|. // Initializes the GenericChromeCommand with given |tag|.
- (instancetype)initWithTag:(NSInteger)tag NS_DESIGNATED_INITIALIZER; - (instancetype)initWithTag:(NSInteger)tag NS_DESIGNATED_INITIALIZER;
// Mark inherited initializer as unavailable to prevent calling it by mistake.
- (instancetype)init NS_UNAVAILABLE;
// Convenience method to execute this command on the main window. // Convenience method to execute this command on the main window.
- (void)executeOnMainWindow; - (void)executeOnMainWindow;
......
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (void)executeOnMainWindow { - (void)executeOnMainWindow {
UIWindow* mainWindow = [[UIApplication sharedApplication] keyWindow]; UIWindow* mainWindow = [[UIApplication sharedApplication] keyWindow];
DCHECK(mainWindow); DCHECK(mainWindow);
......
...@@ -113,11 +113,6 @@ class ConfigFetcher : public net::URLFetcherDelegate { ...@@ -113,11 +113,6 @@ class ConfigFetcher : public net::URLFetcherDelegate {
} }
// Overrides default designated initializer. // Overrides default designated initializer.
- (instancetype)init {
NOTREACHED();
return nil;
}
- (instancetype)initWithAppId:(NSString*)appId - (instancetype)initWithAppId:(NSString*)appId
version:(NSString*)appVersion version:(NSString*)appVersion
plist:(NSString*)plistName { plist:(NSString*)plistName {
...@@ -157,6 +152,11 @@ class ConfigFetcher : public net::URLFetcherDelegate { ...@@ -157,6 +152,11 @@ class ConfigFetcher : public net::URLFetcherDelegate {
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (void)dealloc { - (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self]; [[NSNotificationCenter defaultCenter] removeObserver:self];
#if !defined(NDEBUG) #if !defined(NDEBUG)
......
...@@ -33,6 +33,8 @@ ...@@ -33,6 +33,8 @@
createNewTab:(BOOL)createNewTab createNewTab:(BOOL)createNewTab
NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
@end @end
#endif // IOS_CHROME_BROWSER_XCALLBACK_PARAMETERS_H_ #endif // IOS_CHROME_BROWSER_XCALLBACK_PARAMETERS_H_
...@@ -4,6 +4,7 @@ ...@@ -4,6 +4,7 @@
#import "ios/chrome/browser/xcallback_parameters.h" #import "ios/chrome/browser/xcallback_parameters.h"
#include "base/logging.h"
#include "base/mac/scoped_nsobject.h" #include "base/mac/scoped_nsobject.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
...@@ -41,6 +42,11 @@ NSString* const kCreateNewTabKey = @"createNewTab"; ...@@ -41,6 +42,11 @@ NSString* const kCreateNewTabKey = @"createNewTab";
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (NSString*)description { - (NSString*)description {
return [NSString stringWithFormat:@"SourceApp: %@ (%@)\nSuccessURL: %s\n", return [NSString stringWithFormat:@"SourceApp: %@ (%@)\nSuccessURL: %s\n",
_sourceAppName.get(), _sourceAppId.get(), _sourceAppName.get(), _sourceAppId.get(),
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include "crypto/nss_util.h" #include "crypto/nss_util.h"
#include "ios/net/cookies/cookie_store_ios.h" #include "ios/net/cookies/cookie_store_ios.h"
#include "ios/net/crn_http_protocol_handler.h" #include "ios/net/crn_http_protocol_handler.h"
#include "ios/net/empty_nsurlcache.h"
#include "ios/net/request_tracker.h" #include "ios/net/request_tracker.h"
#include "ios/web/public/user_agent.h" #include "ios/web/public/user_agent.h"
#include "net/base/net_errors.h" #include "net/base/net_errors.h"
...@@ -300,7 +301,7 @@ net::URLRequestContextGetter* CrNetEnvironment::GetMainContextGetter() { ...@@ -300,7 +301,7 @@ net::URLRequestContextGetter* CrNetEnvironment::GetMainContextGetter() {
void CrNetEnvironment::SetHTTPProtocolHandlerRegistered(bool registered) { void CrNetEnvironment::SetHTTPProtocolHandlerRegistered(bool registered) {
if (registered) { if (registered) {
// Disable the default cache. // Disable the default cache.
[NSURLCache setSharedURLCache:nil]; [NSURLCache setSharedURLCache:[EmptyNSURLCache emptyNSURLCache]];
// Register the chrome http protocol handler to replace the default one. // Register the chrome http protocol handler to replace the default one.
BOOL success = [NSURLProtocol registerClass:[CRNHTTPProtocolHandler class]]; BOOL success = [NSURLProtocol registerClass:[CRNHTTPProtocolHandler class]];
DCHECK(success); DCHECK(success);
......
// Copyright 2015 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.
#ifndef IOS_NET_EMPTY_NSURLCACHE_H_
#define IOS_NET_EMPTY_NSURLCACHE_H_
#import <Foundation/Foundation.h>
// Dummy NSURLCache implementation that does not cache anything.
@interface EmptyNSURLCache : NSURLCache
+ (instancetype)emptyNSURLCache;
@end
#endif // IOS_NET_EMPTY_NSURLCACHE_H_
// Copyright 2015 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/net/empty_nsurlcache.h"
@implementation EmptyNSURLCache
+ (instancetype)emptyNSURLCache {
return [[[EmptyNSURLCache alloc] init] autorelease];
}
- (NSCachedURLResponse*)cachedResponseForRequest:(NSURLRequest*)request {
return nil;
}
@end
...@@ -42,6 +42,8 @@ ...@@ -42,6 +42,8 @@
'crn_http_protocol_handler_proxy_with_client_thread.mm', 'crn_http_protocol_handler_proxy_with_client_thread.mm',
'crn_http_url_response.h', 'crn_http_url_response.h',
'crn_http_url_response.mm', 'crn_http_url_response.mm',
'empty_nsurlcache.h',
'empty_nsurlcache.mm',
'http_protocol_logging.h', 'http_protocol_logging.h',
'http_protocol_logging.mm', 'http_protocol_logging.mm',
'http_response_headers_util.h', 'http_response_headers_util.h',
......
...@@ -34,7 +34,11 @@ class GlobalNetworkClientFactories { ...@@ -34,7 +34,11 @@ class GlobalNetworkClientFactories {
// Adds a factory. // Adds a factory.
void AddFactory(CRNForwardingNetworkClientFactory* factory) { void AddFactory(CRNForwardingNetworkClientFactory* factory) {
DCHECK(thread_checker_.CalledOnValidThread()); DCHECK(thread_checker_.CalledOnValidThread());
DCHECK_EQ(NSNotFound, [factories_ indexOfObject:factory]); // TODO(justincohen): Cast indexOfObject to work around Xcode beta bugs.
// Revisit in future betas where hopefully these types match again.
// crbug.com/498825
DCHECK_EQ(NSNotFound,
static_cast<NSInteger>([factories_ indexOfObject:factory]));
DCHECK(!IsSelectorOverriden(factory, @selector(clientHandlingRequest:))); DCHECK(!IsSelectorOverriden(factory, @selector(clientHandlingRequest:)));
DCHECK(!IsSelectorOverriden(factory, DCHECK(!IsSelectorOverriden(factory,
@selector(clientHandlingResponse:request:))); @selector(clientHandlingResponse:request:)));
......
...@@ -43,6 +43,7 @@ ...@@ -43,6 +43,7 @@
- (instancetype)initWithDelegate:(id<UpdatableResourceDelegate>)delegate - (instancetype)initWithDelegate:(id<UpdatableResourceDelegate>)delegate
plist:(NSString*)resource_identifier plist:(NSString*)resource_identifier
NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
@end @end
@implementation TestUpdatableResource { @implementation TestUpdatableResource {
...@@ -62,6 +63,11 @@ ...@@ -62,6 +63,11 @@
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (id<UpdatableResourceDescriptorBridge>)descriptor { - (id<UpdatableResourceDescriptorBridge>)descriptor {
return _descriptor.get(); return _descriptor.get();
} }
......
...@@ -19,6 +19,8 @@ class BrowserState; ...@@ -19,6 +19,8 @@ class BrowserState;
- (instancetype)initWithBrowserState:(web::BrowserState*)browserState - (instancetype)initWithBrowserState:(web::BrowserState*)browserState
NS_DESIGNATED_INITIALIZER; NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
@end @end
#endif // IOS_WEB_BROWSING_DATA_MANAGERS_CRW_COOKIE_BROWSING_DATA_MANAGER_H_ #endif // IOS_WEB_BROWSING_DATA_MANAGERS_CRW_COOKIE_BROWSING_DATA_MANAGER_H_
...@@ -20,6 +20,11 @@ ...@@ -20,6 +20,11 @@
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
#pragma mark CRWBrowsingDataManager implementation #pragma mark CRWBrowsingDataManager implementation
// TODO(shreyasv): During implementation of the following methods evaluate if // TODO(shreyasv): During implementation of the following methods evaluate if
// the entire BrowserState is required. Looks like only |state_path| may be // the entire BrowserState is required. Looks like only |state_path| may be
......
...@@ -45,6 +45,7 @@ NSString* const kStashOperationName = @"CRWBrowsingDataStore.STASH"; ...@@ -45,6 +45,7 @@ NSString* const kStashOperationName = @"CRWBrowsingDataStore.STASH";
// run. All remove operations need to be run on the same queue hence it is // run. All remove operations need to be run on the same queue hence it is
// shared with all CRWBrowsingDataStores. // shared with all CRWBrowsingDataStores.
+ (NSOperationQueue*)operationQueueForRemoveOperations; + (NSOperationQueue*)operationQueueForRemoveOperations;
- (instancetype)init NS_UNAVAILABLE;
// The array of all browsing data managers. Must be accessed from the main // The array of all browsing data managers. Must be accessed from the main
// thread. // thread.
...@@ -176,6 +177,11 @@ NSString* const kStashOperationName = @"CRWBrowsingDataStore.STASH"; ...@@ -176,6 +177,11 @@ NSString* const kStashOperationName = @"CRWBrowsingDataStore.STASH";
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (NSString*)description { - (NSString*)description {
NSString* format = @"<%@: %p; hasPendingOperations = { %@ }>"; NSString* format = @"<%@: %p; hasPendingOperations = { %@ }>";
NSString* hasPendingOperationsString = NSString* hasPendingOperationsString =
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
// Designated init. |browsingDataStore| cannot be null. // Designated init. |browsingDataStore| cannot be null.
- (instancetype)initWithBrowsingDataStore: - (instancetype)initWithBrowsingDataStore:
(CRWBrowsingDataStore*)browsingDataStore NS_DESIGNATED_INITIALIZER; (CRWBrowsingDataStore*)browsingDataStore NS_DESIGNATED_INITIALIZER;
- (instancetype)init NS_UNAVAILABLE;
// The number of times that the mode of the underlying CRWBrowsingDataStore // The number of times that the mode of the underlying CRWBrowsingDataStore
// changed. // changed.
@property(nonatomic, assign) NSUInteger modeChangeCount; @property(nonatomic, assign) NSUInteger modeChangeCount;
...@@ -48,6 +49,11 @@ ...@@ -48,6 +49,11 @@
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (void)observeValueForKeyPath:(NSString*)keyPath - (void)observeValueForKeyPath:(NSString*)keyPath
ofObject:(id)object ofObject:(id)object
change:(NSDictionary*)change change:(NSDictionary*)change
......
...@@ -17,11 +17,6 @@ ...@@ -17,11 +17,6 @@
@implementation CRWRedirectNetworkClient @implementation CRWRedirectNetworkClient
- (instancetype)init {
NOTREACHED();
return nil;
}
- (instancetype)initWithDelegate: - (instancetype)initWithDelegate:
(base::WeakNSProtocol<id<CRWRedirectClientDelegate>>)delegate { (base::WeakNSProtocol<id<CRWRedirectClientDelegate>>)delegate {
self = [super init]; self = [super init];
...@@ -35,6 +30,11 @@ ...@@ -35,6 +30,11 @@
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (void)wasRedirectedToRequest:(NSURLRequest*)request - (void)wasRedirectedToRequest:(NSURLRequest*)request
nativeRequest:(net::URLRequest*)nativeRequest nativeRequest:(net::URLRequest*)nativeRequest
redirectResponse:(NSURLResponse*)redirectResponse { redirectResponse:(NSURLResponse*)redirectResponse {
......
...@@ -21,11 +21,6 @@ ...@@ -21,11 +21,6 @@
@implementation CRWRedirectNetworkClientFactory @implementation CRWRedirectNetworkClientFactory
- (instancetype)init {
NOTREACHED();
return nil;
}
- (instancetype)initWithDelegate:(id<CRWRedirectClientDelegate>)delegate { - (instancetype)initWithDelegate:(id<CRWRedirectClientDelegate>)delegate {
self = [super init]; self = [super init];
if (self) { if (self) {
...@@ -36,6 +31,11 @@ ...@@ -36,6 +31,11 @@
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
#pragma mark - CRNForwardingNetworkClientFactory #pragma mark - CRNForwardingNetworkClientFactory
- (Class)clientClass { - (Class)clientClass {
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "ios/net/cookies/cookie_store_ios.h" #include "ios/net/cookies/cookie_store_ios.h"
#import "ios/net/crn_http_protocol_handler.h" #import "ios/net/crn_http_protocol_handler.h"
#import "ios/net/empty_nsurlcache.h"
#import "ios/web/navigation/crw_session_controller.h" #import "ios/web/navigation/crw_session_controller.h"
#include "ios/web/navigation/web_load_params.h" #include "ios/web/navigation/web_load_params.h"
#import "ios/web/net/crw_url_verifying_protocol_handler.h" #import "ios/web/net/crw_url_verifying_protocol_handler.h"
...@@ -130,7 +131,7 @@ bool UseWKWebView() { ...@@ -130,7 +131,7 @@ bool UseWKWebView() {
- (void)setUpNetworkStack { - (void)setUpNetworkStack {
// Disable the default cache. // Disable the default cache.
[NSURLCache setSharedURLCache:nil]; [NSURLCache setSharedURLCache:[EmptyNSURLCache emptyNSURLCache]];
_httpProtocolDelegate.reset(new web::WebHTTPProtocolHandlerDelegate( _httpProtocolDelegate.reset(new web::WebHTTPProtocolHandlerDelegate(
_browserState->GetRequestContext())); _browserState->GetRequestContext()));
......
...@@ -15,11 +15,6 @@ ...@@ -15,11 +15,6 @@
@synthesize pageLoaded = _pageLoaded; @synthesize pageLoaded = _pageLoaded;
- (instancetype)init {
NOTREACHED();
return nil;
}
- (instancetype)initWithCommandPrefix:(NSString*)commandPrefix { - (instancetype)initWithCommandPrefix:(NSString*)commandPrefix {
DCHECK(commandPrefix); DCHECK(commandPrefix);
self = [super init]; self = [super init];
...@@ -29,6 +24,11 @@ ...@@ -29,6 +24,11 @@
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (void)pageLoaded:(CRWWebController*)webController { - (void)pageLoaded:(CRWWebController*)webController {
_pageLoaded = YES; _pageLoaded = YES;
} }
......
...@@ -29,11 +29,6 @@ const char kObserverAssociatedObjectKey = 'h'; ...@@ -29,11 +29,6 @@ const char kObserverAssociatedObjectKey = 'h';
linked_ptr<NSUInteger> _counter; linked_ptr<NSUInteger> _counter;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (instancetype)initWithSharedCounter:(const linked_ptr<NSUInteger>&)counter - (instancetype)initWithSharedCounter:(const linked_ptr<NSUInteger>&)counter
objectToBeObserved:(id)object { objectToBeObserved:(id)object {
self = [super init]; self = [super init];
...@@ -48,6 +43,11 @@ const char kObserverAssociatedObjectKey = 'h'; ...@@ -48,6 +43,11 @@ const char kObserverAssociatedObjectKey = 'h';
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (void)dealloc { - (void)dealloc {
DCHECK(_counter.get()); DCHECK(_counter.get());
(*_counter)--; (*_counter)--;
......
...@@ -43,7 +43,12 @@ TEST_F(CRWJSEarlyScriptManagerTest, Content) { ...@@ -43,7 +43,12 @@ TEST_F(CRWJSEarlyScriptManagerTest, Content) {
// |earlyScript| is a substring of |injectionContent|. The latter wraps the // |earlyScript| is a substring of |injectionContent|. The latter wraps the
// former with "if (typeof __gCrWeb !== 'object')" check to avoid multiple // former with "if (typeof __gCrWeb !== 'object')" check to avoid multiple
// injections. // injections.
EXPECT_NE(NSNotFound, [injectionContent rangeOfString:earlyScript].location); // TODO(justincohen): Cast indexOfObject to work around Xcode beta bugs.
// Revisit in future betas where hopefully these types match again.
// crbug.com/498825
EXPECT_NE(NSNotFound,
static_cast<NSInteger>(
[injectionContent rangeOfString:earlyScript].location));
} }
} // namespace } // namespace
......
...@@ -72,7 +72,7 @@ ...@@ -72,7 +72,7 @@
[_webView loadData:data [_webView loadData:data
MIMEType:@"application/pdf" MIMEType:@"application/pdf"
textEncodingName:@"utf-8" textEncodingName:@"utf-8"
baseURL:nil]; baseURL:[NSURL URLWithString:@""]];
} }
- (void)evaluateJavaScript:(NSString*)script - (void)evaluateJavaScript:(NSString*)script
......
...@@ -97,11 +97,6 @@ ...@@ -97,11 +97,6 @@
@implementation CRWWebControllerContainerView @implementation CRWWebControllerContainerView
- (instancetype)init {
NOTREACHED();
return nil;
}
- (instancetype)initWithFrame:(CGRect)frame { - (instancetype)initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame]; self = [super initWithFrame:frame];
if (self) { if (self) {
...@@ -112,6 +107,11 @@ ...@@ -112,6 +107,11 @@
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
#pragma mark Accessors #pragma mark Accessors
- (void)setToolbarContainerView:(CRWToolbarContainerView*)toolbarContainerView { - (void)setToolbarContainerView:(CRWToolbarContainerView*)toolbarContainerView {
......
...@@ -839,7 +839,8 @@ TEST_F(CRWWKWebViewWebControllerTest, SSLError) { ...@@ -839,7 +839,8 @@ TEST_F(CRWWKWebViewWebControllerTest, SSLError) {
[NSError errorWithDomain:NSURLErrorDomain [NSError errorWithDomain:NSURLErrorDomain
code:NSURLErrorServerCertificateHasUnknownRoot code:NSURLErrorServerCertificateHasUnknownRoot
userInfo:nil]; userInfo:nil];
[static_cast<id<WKNavigationDelegate>>(webController_.get()) webView:nil WKWebView* webView = static_cast<WKWebView*>([webController_ webView]);
[static_cast<id<WKNavigationDelegate>>(webController_.get()) webView:webView
didFailProvisionalNavigation:nil didFailProvisionalNavigation:nil
withError:error]; withError:error];
......
...@@ -45,11 +45,6 @@ BOOL IsWebViewTerminationError(NSError* error) { ...@@ -45,11 +45,6 @@ BOOL IsWebViewTerminationError(NSError* error) {
base::mac::ScopedBlock<ProceduralBlock> _crashHandler; base::mac::ScopedBlock<ProceduralBlock> _crashHandler;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (instancetype)initWithWebView:(WKWebView*)webView - (instancetype)initWithWebView:(WKWebView*)webView
crashHandler:(ProceduralBlock)handler { crashHandler:(ProceduralBlock)handler {
DCHECK(webView); DCHECK(webView);
...@@ -71,6 +66,11 @@ BOOL IsWebViewTerminationError(NSError* error) { ...@@ -71,6 +66,11 @@ BOOL IsWebViewTerminationError(NSError* error) {
return self; return self;
} }
- (instancetype)init {
NOTREACHED();
return nil;
}
- (void)dealloc { - (void)dealloc {
[_webView removeObserver:self forKeyPath:kCrashIndicatorKeyPath]; [_webView removeObserver:self forKeyPath:kCrashIndicatorKeyPath];
[super dealloc]; [super dealloc];
......
...@@ -68,6 +68,9 @@ TEST_F(WKWebViewConfigurationProviderTest, ConfigurationOwnerhip) { ...@@ -68,6 +68,9 @@ TEST_F(WKWebViewConfigurationProviderTest, ConfigurationOwnerhip) {
other_provider.GetWebViewConfiguration().processPool); other_provider.GetWebViewConfiguration().processPool);
} }
#if 0
// TODO(shreyasv) Disabled for usage of nil on latest Xcode beta.
// crbug.com/498841
// Tests that internal configuration object can not be changed by clients. // Tests that internal configuration object can not be changed by clients.
TEST_F(WKWebViewConfigurationProviderTest, ConfigurationProtection) { TEST_F(WKWebViewConfigurationProviderTest, ConfigurationProtection) {
CR_TEST_REQUIRES_WK_WEB_VIEW(); CR_TEST_REQUIRES_WK_WEB_VIEW();
...@@ -93,6 +96,7 @@ TEST_F(WKWebViewConfigurationProviderTest, ConfigurationProtection) { ...@@ -93,6 +96,7 @@ TEST_F(WKWebViewConfigurationProviderTest, ConfigurationProtection) {
EXPECT_EQ(userContentController.get(), EXPECT_EQ(userContentController.get(),
provider.GetWebViewConfiguration().userContentController); provider.GetWebViewConfiguration().userContentController);
} }
#endif
// Tests that |HasWebViewConfiguration| returns false by default. // Tests that |HasWebViewConfiguration| returns false by default.
TEST_F(WKWebViewConfigurationProviderTest, NoConfigurationByDefault) { TEST_F(WKWebViewConfigurationProviderTest, NoConfigurationByDefault) {
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
// (crbug.com/385030). // (crbug.com/385030).
#if defined(IOSSIM_USE_XCODE_6) #if defined(IOSSIM_USE_XCODE_6)
@protocol SimBridge; @protocol SimBridge;
@class DVTSimulatorApplication;
@class SimDeviceSet; @class SimDeviceSet;
@class SimDeviceType; @class SimDeviceType;
@class SimRuntime; @class SimRuntime;
......
...@@ -171,9 +171,24 @@ ...@@ -171,9 +171,24 @@
'src/Source/NSString-CDExtensions.m', 'src/Source/NSString-CDExtensions.m',
'src/Source/cd_objc2.h', 'src/Source/cd_objc2.h',
], ],
'variables': {
'developer_dir': '<!(xcode-select -print-path)',
'xcode_version': '<!(xcodebuild -version | awk \'/Xcode/ {print $2}\')',
},
'conditions': [
['xcode_version>="7.0"', {
'variables': {
'dynamic_library_extension': 'tbd',
},
}, { # else: xcode_version<"7.0"
'variables': {
'dynamic_library_extension': 'dylib',
},
}]
],
'libraries': [ 'libraries': [
'$(SDKROOT)/System/Library/Frameworks/Foundation.framework', '$(SDKROOT)/System/Library/Frameworks/Foundation.framework',
'$(SDKROOT)/usr/lib/libcrypto.dylib', '$(SDKROOT)/usr/lib/libcrypto.<(dynamic_library_extension)',
], ],
'include_dirs': [ 'include_dirs': [
'src/Source', 'src/Source',
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment