Chromium Code Reviews| Index: ios/chrome/browser/installation_notifier_unittest.mm |
| diff --git a/ios/chrome/browser/installation_notifier_unittest.mm b/ios/chrome/browser/installation_notifier_unittest.mm |
| index abe9ba5c5d95f453bd6254f755fff86755bafb8d..949b48c19d3986e804a9661817a9db24a66533cd 100644 |
| --- a/ios/chrome/browser/installation_notifier_unittest.mm |
| +++ b/ios/chrome/browser/installation_notifier_unittest.mm |
| @@ -8,13 +8,16 @@ |
| #import <UIKit/UIKit.h> |
| #include "base/ios/block_types.h" |
| -#include "base/mac/scoped_nsobject.h" |
| #include "base/message_loop/message_loop.h" |
| #include "base/test/histogram_tester.h" |
| #include "ios/web/public/test/test_web_thread.h" |
| #include "net/base/backoff_entry.h" |
| #include "testing/platform_test.h" |
| +#if !defined(__has_feature) || !__has_feature(objc_arc) |
| +#error "This file requires ARC support." |
| +#endif |
| + |
| @interface MockDispatcher : NSObject<DispatcherProtocol> |
| - (int64_t)lastDelayInNSec; |
| @end |
| @@ -22,12 +25,12 @@ |
| @implementation MockDispatcher { |
|
sdefresne
2017/02/13 14:21:23
This is not a mock, this is a fake :-(
lody
2017/02/13 15:40:10
Done.
|
| int _dispatchCount; |
| int64_t _lastDelayInNSec; |
| - base::scoped_nsobject<NSMutableDictionary> _blocks; |
| + NSMutableDictionary* _blocks; |
| } |
| - (instancetype)init { |
| if ((self = [super init])) |
| - _blocks.reset([[NSMutableDictionary alloc] init]); |
| + _blocks = [[NSMutableDictionary alloc] init]; |
| return self; |
| } |
| @@ -35,7 +38,7 @@ |
| #pragma mark Testing methods |
| - (void)executeAfter:(int)dispatchCount block:(ProceduralBlock)block { |
| - [_blocks setObject:[[block copy] autorelease] |
| + [_blocks setObject:[block copy] |
| forKey:[NSNumber numberWithInt:dispatchCount]]; |
| } |
| @@ -113,10 +116,11 @@ class InstallationNotifierTest : public PlatformTest { |
| protected: |
| void SetUp() override { |
| installationNotifier_ = [InstallationNotifier sharedInstance]; |
| - dispatcher_ = [[MockDispatcher alloc] init]; |
| - notificationReceiver1_.reset(([[MockNotificationReceiver alloc] init])); |
| - notificationReceiver2_.reset(([[MockNotificationReceiver alloc] init])); |
| - sharedApplication_.reset([[MockUIApplication alloc] init]); |
| + MockDispatcher* dispatcher = [[MockDispatcher alloc] init]; |
| + dispatcher_ = dispatcher; |
| + notificationReceiver1_ = ([[MockNotificationReceiver alloc] init]); |
| + notificationReceiver2_ = ([[MockNotificationReceiver alloc] init]); |
| + sharedApplication_ = [[MockUIApplication alloc] init]; |
| [installationNotifier_ setSharedApplication:sharedApplication_]; |
| [installationNotifier_ setDispatcher:dispatcher_]; |
| histogramTester_.reset(new base::HistogramTester()); |
| @@ -146,13 +150,12 @@ class InstallationNotifierTest : public PlatformTest { |
| base::MessageLoopForUI message_loop_; |
| web::TestWebThread ui_thread_; |
| - __unsafe_unretained InstallationNotifier* |
| - installationNotifier_; // Weak pointer to singleton. |
| - __unsafe_unretained MockDispatcher* |
| - dispatcher_; // Weak. installationNotifier_ owns it. |
| - base::scoped_nsobject<MockNotificationReceiver> notificationReceiver1_; |
| - base::scoped_nsobject<MockNotificationReceiver> notificationReceiver2_; |
| - base::scoped_nsobject<MockUIApplication> sharedApplication_; |
| + __weak InstallationNotifier* |
| + installationNotifier_; // Weak pointer to singleton. |
|
sdefresne
2017/02/13 14:21:23
You can probably remove those comments now (since
lody
2017/02/13 15:40:10
Done.
|
| + __weak MockDispatcher* dispatcher_; // Weak. installationNotifier_ owns it. |
| + MockNotificationReceiver* notificationReceiver1_; |
| + MockNotificationReceiver* notificationReceiver2_; |
| + MockUIApplication* sharedApplication_; |
| std::unique_ptr<base::HistogramTester> histogramTester_; |
| }; |