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/web/public/test/fakes/test_web_view_content_view.h" | 5 #import "ios/web/public/test/fakes/test_web_view_content_view.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #import "base/mac/scoped_nsobject.h" | 8 |
| 9 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 10 #error "This file requires ARC support." |
| 11 #endif |
9 | 12 |
10 @interface TestWebViewContentView () { | 13 @interface TestWebViewContentView () { |
11 base::scoped_nsprotocol<id> _mockWebView; | 14 id _mockWebView; |
12 base::scoped_nsprotocol<id> _mockScrollView; | 15 id _mockScrollView; |
13 } | 16 } |
14 | 17 |
15 @end | 18 @end |
16 | 19 |
17 @implementation TestWebViewContentView | 20 @implementation TestWebViewContentView |
18 | 21 |
19 - (instancetype)initWithMockWebView:(id)webView scrollView:(id)scrollView { | 22 - (instancetype)initWithMockWebView:(id)webView scrollView:(id)scrollView { |
20 self = [super initForTesting]; | 23 self = [super initForTesting]; |
21 if (self) { | 24 if (self) { |
22 DCHECK(webView); | 25 DCHECK(webView); |
23 DCHECK(scrollView); | 26 DCHECK(scrollView); |
24 _mockWebView.reset([webView retain]); | 27 _mockWebView = webView; |
25 _mockScrollView.reset([scrollView retain]); | 28 _mockScrollView = scrollView; |
26 } | 29 } |
27 return self; | 30 return self; |
28 } | 31 } |
29 | 32 |
30 - (instancetype)initWithCoder:(NSCoder*)decoder { | 33 - (instancetype)initWithCoder:(NSCoder*)decoder { |
31 NOTREACHED(); | 34 NOTREACHED(); |
32 return nil; | 35 return nil; |
33 } | 36 } |
34 | 37 |
35 - (instancetype)initWithFrame:(CGRect)frame { | 38 - (instancetype)initWithFrame:(CGRect)frame { |
36 NOTREACHED(); | 39 NOTREACHED(); |
37 return nil; | 40 return nil; |
38 } | 41 } |
39 | 42 |
40 #pragma mark Accessors | 43 #pragma mark Accessors |
41 | 44 |
42 - (UIScrollView*)scrollView { | 45 - (UIScrollView*)scrollView { |
43 return static_cast<UIScrollView*>(_mockScrollView.get()); | 46 return static_cast<UIScrollView*>(_mockScrollView); |
44 } | 47 } |
45 | 48 |
46 - (UIView*)webView { | 49 - (UIView*)webView { |
47 return static_cast<UIView*>(_mockWebView.get()); | 50 return static_cast<UIView*>(_mockWebView); |
48 } | 51 } |
49 | 52 |
50 @end | 53 @end |
OLD | NEW |