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

Unified Diff: ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller_unittest.mm

Issue 2806323003: [ObjC ARC] Converts ios/chrome/browser/ui/settings:unit_tests to ARC. (Closed)
Patch Set: rebase Created 3 years, 8 months 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/settings/time_range_selector_collection_view_controller_unittest.mm
diff --git a/ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller_unittest.mm b/ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller_unittest.mm
index d7a5b28188c790e14133c5289a1ce37652d78525..e0326ec0a58e07bdc8910c1a9e89f9203698125e 100644
--- a/ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller_unittest.mm
+++ b/ios/chrome/browser/ui/settings/time_range_selector_collection_view_controller_unittest.mm
@@ -17,6 +17,10 @@
#include "third_party/ocmock/OCMock/OCMock.h"
#import "third_party/ocmock/gtest_support.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
@interface TimeRangeSelectorCollectionViewController (ExposedForTesting)
- (void)updatePrefValue:(int)prefValue;
@end
@@ -31,19 +35,18 @@ class TimeRangeSelectorCollectionViewControllerTest
void SetUp() override {
CollectionViewControllerTest::SetUp();
pref_service_ = CreateLocalState();
- delegate_.reset([[OCMockObject
+ delegate_ = [OCMockObject
mockForProtocol:@protocol(
- TimeRangeSelectorCollectionViewControllerDelegate)]
- retain]);
+ TimeRangeSelectorCollectionViewControllerDelegate)];
CreateController();
}
- CollectionViewController* NewController() override NS_RETURNS_RETAINED {
- time_range_selector_controller_.reset(
+ CollectionViewController* InstantiateController() override {
+ time_range_selector_controller_ =
[[TimeRangeSelectorCollectionViewController alloc]
initWithPrefs:pref_service_.get()
- delegate:delegate_.get()]);
- return [time_range_selector_controller_ retain];
+ delegate:delegate_];
+ return time_range_selector_controller_;
}
std::unique_ptr<PrefService> CreateLocalState() {
@@ -63,9 +66,8 @@ class TimeRangeSelectorCollectionViewControllerTest
base::MessageLoopForUI message_loop_;
std::unique_ptr<PrefService> pref_service_;
- base::scoped_nsobject<id> delegate_;
- base::scoped_nsobject<TimeRangeSelectorCollectionViewController>
- time_range_selector_controller_;
+ id delegate_;
+ TimeRangeSelectorCollectionViewController* time_range_selector_controller_;
};
TEST_F(TimeRangeSelectorCollectionViewControllerTest, TestModel) {
@@ -114,12 +116,12 @@ TEST_F(TimeRangeSelectorCollectionViewControllerTest, TestUpdateCheckedState) {
TEST_F(TimeRangeSelectorCollectionViewControllerTest, TestUpdatePrefValue) {
CheckController();
UICollectionView* collectionView =
- time_range_selector_controller_.get().collectionView;
+ time_range_selector_controller_.collectionView;
for (NSInteger checkedItem = 0; checkedItem < kNumberOfItems; ++checkedItem) {
NSIndexPath* indexPath =
[NSIndexPath indexPathForItem:checkedItem inSection:0];
- [[delegate_.get() expect]
- timeRangeSelectorViewController:time_range_selector_controller_.get()
+ [[delegate_ expect]
+ timeRangeSelectorViewController:time_range_selector_controller_
didSelectTimePeriod:static_cast<browsing_data::TimePeriod>(
checkedItem)];
[time_range_selector_controller_ collectionView:collectionView

Powered by Google App Engine
This is Rietveld 408576698