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

Unified Diff: ios/chrome/test/earl_grey/chrome_earl_grey.mm

Issue 2684023003: [ObjC ARC] Converts ios/chrome/test/earl_grey:test_support to ARC. (Closed)
Patch Set: Add __unsafe_unretained 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/test/earl_grey/chrome_earl_grey.mm
diff --git a/ios/chrome/test/earl_grey/chrome_earl_grey.mm b/ios/chrome/test/earl_grey/chrome_earl_grey.mm
index 16ec1cf07b940db82769fc6c92bdcdd8259f802f..ffcfa516ad3b3d3a812db944a3de8698fd7cc1e5 100644
--- a/ios/chrome/test/earl_grey/chrome_earl_grey.mm
+++ b/ios/chrome/test/earl_grey/chrome_earl_grey.mm
@@ -17,9 +17,14 @@
#import "ios/web/public/web_state/js/crw_js_injection_receiver.h"
#import "ios/web/public/web_state/web_state.h"
+#if !defined(__has_feature) || !__has_feature(objc_arc)
+#error "This file requires ARC support."
+#endif
+
namespace chrome_test_util {
-id ExecuteJavaScript(NSString* javascript, NSError** out_error) {
+id ExecuteJavaScript(NSString* javascript,
+ NSError* __unsafe_unretained* out_error) {
__block bool did_complete = false;
__block id result = nil;
__block NSError* temp_error = nil;
@@ -41,10 +46,11 @@ id ExecuteJavaScript(NSString* javascript, NSError** out_error) {
[condition waitWithTimeout:testing::kWaitForJSCompletionTimeout];
if (!did_complete)
return nil;
- [temp_error autorelease];
- if (out_error)
- *out_error = temp_error;
- return [result autorelease];
+ if (out_error) {
+ NSError* __autoreleasing auto_released_error = temp_error;
+ *out_error = auto_released_error;
+ }
+ return result;
}
} // namespace chrome_test_util

Powered by Google App Engine
This is Rietveld 408576698