Commit c3cb3cf5 authored by baxley's avatar baxley Committed by Commit Bot

[ObjC ARC] Converts ios/chrome/test/app:test_support to ARC.

Also convert ios/chrome/browser/ui/sync:eg_tests to ARC, since this
simplifies use of output parameters in sync_test_util.mm.

Automatically generated ARCMigrate commit
Notable issues:None
BUG=624363
TEST=None

Review-Url: https://codereview.chromium.org/2888173002
Cr-Commit-Position: refs/heads/master@{#478845}
parent 3d6f939e
......@@ -30,6 +30,7 @@ source_set("sync") {
}
source_set("eg_tests") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"sync_fake_server_egtest.mm",
......
......@@ -38,6 +38,10 @@
#include "ui/base/l10n/l10n_util.h"
#include "url/gurl.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
// Constant for timeout while waiting for asynchronous sync operations.
......@@ -455,9 +459,6 @@ void AssertNumberOfEntitiesWithName(int entity_count,
}];
BOOL success = [condition waitWithTimeout:kSyncOperationTimeout];
DCHECK(success || blockSafeError);
if (blockSafeError) {
[blockSafeError autorelease];
}
GREYAssertTrue(success, [blockSafeError localizedDescription]);
}
......@@ -580,9 +581,6 @@ void AssertNumberOfEntitiesWithName(int entity_count,
}];
BOOL success = [condition waitWithTimeout:kSyncOperationTimeout];
DCHECK(success || blockSafeError);
if (blockSafeError) {
[blockSafeError autorelease];
}
GREYAssert(success, [blockSafeError localizedDescription]);
}
......
......@@ -3,6 +3,7 @@
# found in the LICENSE file.
source_set("test_support") {
configs += [ "//build/config/compiler:enable_arc" ]
testonly = true
sources = [
"bookmarks_test_util.h",
......
specific_include_rules = {
# TODO(crbug.com/732525): Remove crw_web_controller.h exception.
"^tab_test_util.mm$": [
"+ios/web/web_state/ui/crw_web_controller.h",
],
}
......@@ -9,6 +9,10 @@
#include "ios/chrome/browser/bookmarks/bookmarks_utils.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace chrome_test_util {
bool BookmarksLoaded() {
......
......@@ -27,6 +27,10 @@
#import "ios/chrome/browser/ui/ntp/new_tab_page_controller.h"
#import "ios/web/public/test/native_controller_test_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
// Methods to access private members for testing.
@interface BreakpadController (Testing)
- (BOOL)isEnabled;
......
......@@ -14,6 +14,10 @@
#include "base/metrics/statistics_recorder.h"
#include "base/stl_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
base::HistogramBase* FindHistogram(const std::string& name,
FailureBlock failure_block) {
......
......@@ -14,13 +14,17 @@
#include "ios/chrome/browser/callback_counter.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace chrome_test_util {
void ClearBrowsingHistory() {
MainController* main_controller = GetMainController();
ios::ChromeBrowserState* active_state = GetOriginalBrowserState();
scoped_refptr<CallbackCounter> callback_counter(
new CallbackCounter(base::BindBlock(^{
new CallbackCounter(base::BindBlockArc(^{
})));
callback_counter->IncrementCount();
__block bool did_complete = false;
......
......@@ -7,6 +7,10 @@
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/web/public/test/navigation_test_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace chrome_test_util {
void LoadUrl(const GURL& url) {
......
......@@ -8,6 +8,10 @@
#include "ios/chrome/browser/content_settings/host_content_settings_map_factory.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace chrome_test_util {
void SetContentSettingsBlockPopups(ContentSetting setting) {
......
......@@ -25,6 +25,10 @@
#include "net/url_request/url_fetcher_delegate.h"
#include "net/url_request/url_request_status.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
net::FakeURLFetcherFactory* gFakeURLFetcherFactory = nullptr;
......@@ -154,9 +158,8 @@ bool SignOutAndClearAccounts() {
// Clear known identities.
ios::ChromeIdentityService* identity_service =
ios::GetChromeBrowserProvider()->GetChromeIdentityService();
base::scoped_nsobject<NSArray> identities(
[identity_service->GetAllIdentities() copy]);
for (ChromeIdentity* identity in identities.get()) {
NSArray* identities([identity_service->GetAllIdentities() copy]);
for (ChromeIdentity* identity in identities) {
identity_service->ForgetIdentity(identity, nil);
}
......
......@@ -11,6 +11,10 @@
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/chrome/test/app/tab_test_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace chrome_test_util {
bool IsTabSwitcherActive() {
......
......@@ -12,6 +12,10 @@
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/testing/wait_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace chrome_test_util {
// Synchronously returns the result of executed JavaScript.
......@@ -31,7 +35,7 @@ id ExecuteScriptInStaticController(
return did_finish;
});
return [result autorelease];
return result;
}
// Returns the StaticHtmlViewController for the given |web_state|. If none is
......
......@@ -34,6 +34,10 @@
#import "ios/chrome/test/app/chrome_test_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace {
fake_server::FakeServer* gSyncFakeServer = nullptr;
......@@ -286,7 +290,7 @@ BOOL IsTypedUrlPresentOnClient(const GURL& url,
__block int count = 0;
using history::OriginCountAndLastVisitMap;
history_service->GetCountsAndLastVisitForOrigins(
origins, base::BindBlock(^(const OriginCountAndLastVisitMap& result) {
origins, base::BindBlockArc(^(const OriginCountAndLastVisitMap& result) {
auto iter = result.find(block_safe_url);
if (iter != result.end())
count = iter->second.first;
......
......@@ -7,7 +7,6 @@
#import <Foundation/Foundation.h>
#import "base/mac/foundation_util.h"
#import "base/mac/scoped_nsobject.h"
#import "ios/chrome/app/main_controller_private.h"
#import "ios/chrome/browser/autofill/form_input_accessory_view_controller.h"
#include "ios/chrome/browser/experimental_flags.h"
......@@ -21,6 +20,11 @@
#import "ios/chrome/browser/ui/tabs/tab_strip_controller_private.h"
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/testing/wait_util.h"
#import "ios/web/web_state/ui/crw_web_controller.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace chrome_test_util {
......@@ -46,16 +50,16 @@ BOOL IsIncognitoMode() {
void OpenNewTab() {
@autoreleasepool { // Make sure that all internals are deallocated.
base::scoped_nsobject<GenericChromeCommand> command(
[[GenericChromeCommand alloc] initWithTag:IDC_NEW_TAB]);
GenericChromeCommand* command =
[[GenericChromeCommand alloc] initWithTag:IDC_NEW_TAB];
chrome_test_util::RunCommandWithActiveViewController(command);
}
}
void OpenNewIncognitoTab() {
@autoreleasepool { // Make sure that all internals are deallocated.
base::scoped_nsobject<GenericChromeCommand> command(
[[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB]);
GenericChromeCommand* command =
[[GenericChromeCommand alloc] initWithTag:IDC_NEW_INCOGNITO_TAB];
chrome_test_util::RunCommandWithActiveViewController(command);
}
}
......
......@@ -7,6 +7,10 @@
#import "ios/chrome/test/app/chrome_test_util.h"
#import "ios/web/public/test/web_view_interaction_test_util.h"
#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "This file requires ARC support."
#endif
namespace chrome_test_util {
void TapWebViewElementWithId(const std::string& element_id) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment