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

Unified Diff: ios/chrome/browser/ui/authentication/authentication_flow_unittest.mm

Issue 2675243003: [ObjC ARC] Converts ios/chrome/browser/ui/authentication:unit_tests to ARC. (Closed)
Patch Set: 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/authentication/authentication_flow_unittest.mm
diff --git a/ios/chrome/browser/ui/authentication/authentication_flow_unittest.mm b/ios/chrome/browser/ui/authentication/authentication_flow_unittest.mm
index 4276ab1d8effae545908b043fe41a4bea8d6c30f..05b0467bfadb2cd7d1d090ba5ea717f994599b27 100644
--- a/ios/chrome/browser/ui/authentication/authentication_flow_unittest.mm
+++ b/ios/chrome/browser/ui/authentication/authentication_flow_unittest.mm
@@ -7,7 +7,6 @@
#include <memory>
#import "base/mac/scoped_block.h"
-#import "base/mac/scoped_nsobject.h"
#include "base/memory/ptr_util.h"
#include "base/test/ios/wait_util.h"
#include "components/pref_registry/pref_registry_syncable.h"
@@ -26,6 +25,10 @@
#import "third_party/ocmock/ocmock_extensions.h"
#include "ui/base/l10n/l10n_util.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace {
class AuthenticationFlowTest : public PlatformTest {
@@ -46,12 +49,10 @@ class AuthenticationFlowTest : public PlatformTest {
[identityService->GetAllIdentitiesSortedForDisplay() objectAtIndex:0];
identity2_ =
[identityService->GetAllIdentitiesSortedForDisplay() objectAtIndex:1];
- sign_in_completion_.reset(
- ^(BOOL success) {
- finished_ = true;
- signed_in_success_ = success;
- },
- base::scoped_policy::RETAIN);
+ sign_in_completion_ = ^(BOOL success) {
+ finished_ = true;
+ signed_in_success_ = success;
+ };
finished_ = false;
signed_in_success_ = false;
}
@@ -67,7 +68,7 @@ class AuthenticationFlowTest : public PlatformTest {
}
AuthenticationFlowPerformer* GetAuthenticationFlowPerformer() {
- return static_cast<AuthenticationFlowPerformer*>(performer_.get());
+ return static_cast<AuthenticationFlowPerformer*>(performer_);
}
// Creates a new AuthenticationFlow with default values for fields that are
@@ -75,16 +76,15 @@ class AuthenticationFlowTest : public PlatformTest {
void CreateAuthenticationFlow(ShouldClearData shouldClearData,
PostSignInAction postSignInAction) {
ChromeIdentity* identity = identity1_;
- view_controller_.reset(
- [[OCMockObject niceMockForClass:[UIViewController class]] retain]);
- authentication_flow_.reset([[AuthenticationFlow alloc]
- initWithBrowserState:browser_state_.get()
- identity:identity
- shouldClearData:shouldClearData
- postSignInAction:postSignInAction
- presentingViewController:view_controller_]);
- performer_.reset([[OCMockObject
- mockForClass:[AuthenticationFlowPerformer class]] retain]);
+ view_controller_ = [OCMockObject niceMockForClass:[UIViewController class]];
+ authentication_flow_ =
+ [[AuthenticationFlow alloc] initWithBrowserState:browser_state_.get()
+ identity:identity
+ shouldClearData:shouldClearData
+ postSignInAction:postSignInAction
+ presentingViewController:view_controller_];
+ performer_ =
+ [OCMockObject mockForClass:[AuthenticationFlowPerformer class]];
[authentication_flow_
setPerformerForTesting:GetAuthenticationFlowPerformer()];
}
@@ -101,13 +101,13 @@ class AuthenticationFlowTest : public PlatformTest {
}
web::TestWebThreadBundle thread_bundle_;
- base::scoped_nsobject<AuthenticationFlow> authentication_flow_;
+ AuthenticationFlow* authentication_flow_;
std::unique_ptr<TestChromeBrowserState> browser_state_;
ChromeIdentity* identity1_;
ChromeIdentity* identity2_;
- base::scoped_nsobject<OCMockObject> performer_;
- base::mac::ScopedBlock<signin_ui::CompletionCallback> sign_in_completion_;
- base::scoped_nsobject<UIViewController> view_controller_;
+ OCMockObject* performer_;
+ signin_ui::CompletionCallback sign_in_completion_;
+ UIViewController* view_controller_;
// State of the flow
bool finished_;
@@ -253,7 +253,7 @@ TEST_F(AuthenticationFlowTest, TestFailFetchManagedStatus) {
forIdentity:identity1_];
[[[performer_ expect] andDo:^(NSInvocation* invocation) {
- ProceduralBlock completionBlock;
+ __unsafe_unretained ProceduralBlock completionBlock;
[invocation getArgument:&completionBlock atIndex:3];
completionBlock();
}] showAuthenticationError:[OCMArg any]

Powered by Google App Engine
This is Rietveld 408576698