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