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

Unified Diff: ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm

Issue 2514843002: [ObjC ARC] Converts ios/chrome/browser/ui/alert_coordinator:unit_tests to ARC.Automatically gener… (Closed)
Patch Set: removed scoped_nsobject Created 4 years 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/alert_coordinator/alert_coordinator_unittest.mm
diff --git a/ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm b/ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm
index 8933d79e3f8dd9d35027fe1d4d1605b39fb97bf2..ba8ad718d6db0397b0f208b5d5917c4317a0f85e 100644
--- a/ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm
+++ b/ios/chrome/browser/ui/alert_coordinator/alert_coordinator_unittest.mm
@@ -7,23 +7,25 @@
#import <UIKit/UIKit.h>
#import "base/mac/foundation_util.h"
-#import "base/mac/scoped_nsobject.h"
#include "testing/platform_test.h"
#import "third_party/ocmock/OCMock/OCMock.h"
#include "third_party/ocmock/gtest_support.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/strings/grit/ui_strings.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
#pragma mark - Fixture.
// Fixture to test AlertCoordinator.
class AlertCoordinatorTest : public PlatformTest {
protected:
AlertCoordinatorTest() {
- window_.reset(
- [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]);
+ window_ = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[window_ makeKeyAndVisible];
- view_controller_.reset([[UIViewController alloc] init]);
+ view_controller_ = [[UIViewController alloc] init];
[window_ setRootViewController:view_controller_];
}
@@ -38,17 +40,17 @@ class AlertCoordinatorTest : public PlatformTest {
AlertCoordinator* getAlertCoordinator(UIViewController* viewController,
NSString* title,
NSString* message) {
- alert_coordinator_.reset([[AlertCoordinator alloc]
- initWithBaseViewController:viewController
- title:title
- message:message]);
+ alert_coordinator_ =
+ [[AlertCoordinator alloc] initWithBaseViewController:viewController
+ title:title
+ message:message];
return alert_coordinator_;
}
private:
- base::scoped_nsobject<AlertCoordinator> alert_coordinator_;
- base::scoped_nsobject<UIWindow> window_;
- base::scoped_nsobject<UIViewController> view_controller_;
+ AlertCoordinator* alert_coordinator_;
+ UIWindow* window_;
+ UIViewController* view_controller_;
};
#pragma mark - Tests.
@@ -80,10 +82,9 @@ TEST_F(AlertCoordinatorTest, ValidateIsVisible) {
// visible view.
TEST_F(AlertCoordinatorTest, ValidateIsNotVisible) {
// Setup.
- base::scoped_nsobject<UIWindow> window(
- [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]);
- base::scoped_nsobject<UIViewController> viewController(
- [[UIViewController alloc] init]);
+ UIWindow* window =
+ [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
+ UIViewController* viewController = [[UIViewController alloc] init];
[window setRootViewController:viewController];
AlertCoordinator* alertCoordinator = getAlertCoordinator(viewController);
@@ -161,8 +162,7 @@ TEST_F(AlertCoordinatorTest, ValidateActions) {
@"testCancel" : @(UIAlertActionStyleCancel),
};
- base::scoped_nsobject<NSMutableDictionary> remainingActions(
- [actions mutableCopy]);
+ NSMutableDictionary* remainingActions = [actions mutableCopy];
// Action.
for (id key in actions) {

Powered by Google App Engine
This is Rietveld 408576698