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

Side by Side Diff: ios/web/public/test/earl_grey/js_test_util.mm

Issue 2545663004: [ios] Fixed memory management in ExecuteScriptOnInterstitial. (Closed)
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #import "ios/web/public/test/earl_grey/js_test_util.h" 5 #import "ios/web/public/test/earl_grey/js_test_util.h"
6 6
7 #import <EarlGrey/EarlGrey.h> 7 #import <EarlGrey/EarlGrey.h>
8 #import <WebKit/WebKit.h> 8 #import <WebKit/WebKit.h>
9 9
10 #include "base/timer/elapsed_timer.h" 10 #include "base/timer/elapsed_timer.h"
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return [result autorelease]; 77 return [result autorelease];
78 } 78 }
79 79
80 id ExecuteScriptOnInterstitial(WebState* web_state, NSString* script) { 80 id ExecuteScriptOnInterstitial(WebState* web_state, NSString* script) {
81 web::WebInterstitialImpl* interstitial = 81 web::WebInterstitialImpl* interstitial =
82 static_cast<web::WebInterstitialImpl*>(web_state->GetWebInterstitial()); 82 static_cast<web::WebInterstitialImpl*>(web_state->GetWebInterstitial());
83 83
84 __block id script_result = nil; 84 __block id script_result = nil;
85 __block bool did_finish = false; 85 __block bool did_finish = false;
86 web::ExecuteScriptForTesting(interstitial, script, ^(id result, NSError*) { 86 web::ExecuteScriptForTesting(interstitial, script, ^(id result, NSError*) {
87 script_result = [[result copy] autorelease]; 87 script_result = [result copy];
88 did_finish = true; 88 did_finish = true;
89 }); 89 });
90 BOOL suceeded = WaitUntilConditionOrTimeout(kWaitForJSCompletionTimeout, ^{ 90 BOOL suceeded = WaitUntilConditionOrTimeout(kWaitForJSCompletionTimeout, ^{
91 return did_finish; 91 return did_finish;
92 }); 92 });
93 GREYAssert(suceeded, @"Script execution timed out"); 93 GREYAssert(suceeded, @"Script execution timed out");
94 return script_result; 94 return [script_result autorelease];
95 } 95 }
96 96
97 } // namespace web 97 } // namespace web
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698