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

Unified Diff: ios/chrome/browser/ui/stack_view/stack_card_unittest.mm

Issue 2686573003: [ObjC ARC] Converts ios/chrome/browser/ui/stack_view:unit_tests to ARC. (Closed)
Patch Set: nits Created 3 years, 10 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/stack_view/stack_card_unittest.mm
diff --git a/ios/chrome/browser/ui/stack_view/stack_card_unittest.mm b/ios/chrome/browser/ui/stack_view/stack_card_unittest.mm
index e2197c1c4976b2a5c114ac0b4e700897d17962a7..2fd808923d130c6d631eb44355218867595a2dc8 100644
--- a/ios/chrome/browser/ui/stack_view/stack_card_unittest.mm
+++ b/ios/chrome/browser/ui/stack_view/stack_card_unittest.mm
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "base/mac/scoped_nsobject.h"
#import "ios/chrome/browser/ui/rtl_geometry.h"
#import "ios/chrome/browser/ui/stack_view/card_view.h"
#import "ios/chrome/browser/ui/stack_view/stack_card.h"
@@ -11,6 +10,10 @@
#include "testing/gtest_mac.h"
#include "testing/platform_test.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
// Mocked-out CardView object
@interface MockCardView : UIView
@end
@@ -26,7 +29,7 @@
@implementation MockCardViewProvider
- (CardView*)cardViewWithFrame:(CGRect)frame forStackCard:(StackCard*)card {
- return (CardView*)[[[MockCardView alloc] initWithFrame:frame] autorelease];
+ return static_cast<CardView*>([[MockCardView alloc] initWithFrame:frame]);
}
@end
@@ -36,16 +39,13 @@ namespace {
class StackCardTest : public PlatformTest {
protected:
- void SetUp() override {
- view_provider_.reset([[MockCardViewProvider alloc] init]);
- }
+ StackCardTest() { view_provider_ = [[MockCardViewProvider alloc] init]; }
- base::scoped_nsobject<MockCardViewProvider> view_provider_;
+ MockCardViewProvider* view_provider_;
};
TEST_F(StackCardTest, LazyCreation) {
- base::scoped_nsobject<StackCard> card(
- [[StackCard alloc] initWithViewProvider:view_provider_]);
+ StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_];
// Set attributes before asking for the view.
LayoutRect layout = LayoutRectMake(10, 300, 20, 55, 98);
CGRect frame = LayoutRectGetRect(layout);
@@ -61,8 +61,7 @@ TEST_F(StackCardTest, LazyCreation) {
}
TEST_F(StackCardTest, LiveViewUpdating) {
- base::scoped_nsobject<StackCard> card(
- [[StackCard alloc] initWithViewProvider:view_provider_]);
+ StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_];
// Get the view, then set attributes.
UIView* view = [card view];
LayoutRect layout = LayoutRectMake(10, 300, 20, 55, 98);
@@ -76,8 +75,7 @@ TEST_F(StackCardTest, LiveViewUpdating) {
}
TEST_F(StackCardTest, BoundsUpdatePreservesCenter) {
- base::scoped_nsobject<StackCard> card(
- [[StackCard alloc] initWithViewProvider:view_provider_]);
+ StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_];
LayoutRect layout = LayoutRectMake(0, 300, 0, 40, 100);
CGRect frame = LayoutRectGetRect(layout);
[card setLayout:layout];
@@ -89,8 +87,7 @@ TEST_F(StackCardTest, BoundsUpdatePreservesCenter) {
}
TEST_F(StackCardTest, PixelAlignmentOfViewFrameAfterLiveUpdate) {
- base::scoped_nsobject<StackCard> card(
- [[StackCard alloc] initWithViewProvider:view_provider_]);
+ StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_];
// Get the view, then set attributes.
UIView* view = [card view];
const LayoutRectPosition kPosition = LayoutRectPositionMake(10.3, 20.4);
@@ -112,8 +109,7 @@ TEST_F(StackCardTest, PixelAlignmentOfViewFrameAfterLiveUpdate) {
}
TEST_F(StackCardTest, ViewFrameSynchronization) {
- base::scoped_nsobject<StackCard> card(
- [[StackCard alloc] initWithViewProvider:view_provider_]);
+ StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_];
// Get the view, then set attributes.
UIView* view = [card view];
const LayoutRect kFirstLayout = LayoutRectMake(10, 300, 20, 55, 98);
@@ -148,8 +144,7 @@ TEST_F(StackCardTest, ViewFrameSynchronization) {
}
TEST_F(StackCardTest, ViewLayoutSynchronization) {
- base::scoped_nsobject<StackCard> card(
- [[StackCard alloc] initWithViewProvider:view_provider_]);
+ StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_];
// Get the view, then set attributes.
UIView* view = [card view];
const LayoutRect kFirstLayout = LayoutRectMake(30, 300, 40, 200, 100);
@@ -185,8 +180,7 @@ TEST_F(StackCardTest, ViewLayoutSynchronization) {
}
TEST_F(StackCardTest, PixelAlignmentOfViewAfterSynchronization) {
- base::scoped_nsobject<StackCard> card(
- [[StackCard alloc] initWithViewProvider:view_provider_]);
+ StackCard* card = [[StackCard alloc] initWithViewProvider:view_provider_];
// Get the view, then set attributes.
UIView* view = [card view];
const CGFloat kBoundingWidth = 300;

Powered by Google App Engine
This is Rietveld 408576698