OLD | NEW |
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 #ifndef IOS_WEB_PUBLIC_TEST_EARL_GREY_JS_TEST_UTIL_H_ | 5 #ifndef IOS_WEB_PUBLIC_TEST_EARL_GREY_JS_TEST_UTIL_H_ |
6 #define IOS_WEB_PUBLIC_TEST_EARL_GREY_JS_TEST_UTIL_H_ | 6 #define IOS_WEB_PUBLIC_TEST_EARL_GREY_JS_TEST_UTIL_H_ |
7 | 7 |
8 #import <Foundation/Foundation.h> | 8 #import <Foundation/Foundation.h> |
9 | 9 |
10 #import "ios/web/public/web_state/web_state.h" | 10 #import "ios/web/public/web_state/web_state.h" |
11 | 11 |
12 namespace web { | 12 namespace web { |
13 | 13 |
14 // Waits until the Window ID has been injected and the page is thus ready to | 14 // Waits until the Window ID has been injected and the page is thus ready to |
15 // respond to JavaScript injection. Fails with a GREYAssert on timeout or if | 15 // respond to JavaScript injection. Fails with a GREYAssert on timeout or if |
16 // unrecoverable error (such as no web view) occurs. | 16 // unrecoverable error (such as no web view) occurs. |
17 void WaitUntilWindowIdInjected(WebState* web_state); | 17 void WaitUntilWindowIdInjected(WebState* web_state); |
18 | 18 |
19 // Executes |javascript| on the given |web_state|, and waits until execution is | 19 // Executes |javascript| on the given |web_state|, and waits until execution is |
20 // completed. If |out_error| is not nil, it is set to the error resulting from | 20 // completed. If |out_error| is not nil, it is set to the error resulting from |
21 // the execution, if one occurs. The return value is the result of the | 21 // the execution, if one occurs. The return value is the result of the |
22 // JavaScript execution. If the script execution is timed out, then this method | 22 // JavaScript execution. If the script execution is timed out, then this method |
23 // fails with a GREYAssert. | 23 // fails with a GREYAssert. |
24 id ExecuteJavaScript(WebState* web_state, | 24 id ExecuteJavaScript(WebState* web_state, |
25 NSString* javascript, | 25 NSString* javascript, |
26 NSError** out_error); | 26 NSError* __autoreleasing* out_error); |
27 | 27 |
28 // Synchronously returns the result of executed JavaScript on interstitial page | 28 // Synchronously returns the result of executed JavaScript on interstitial page |
29 // displayed for |web_state|. | 29 // displayed for |web_state|. |
30 id ExecuteScriptOnInterstitial(WebState* web_state, NSString* script); | 30 id ExecuteScriptOnInterstitial(WebState* web_state, NSString* script); |
31 | 31 |
32 } // namespace web | 32 } // namespace web |
33 | 33 |
34 #endif // IOS_WEB_PUBLIC_TEST_EARL_GREY_JS_TEST_UTIL_H_ | 34 #endif // IOS_WEB_PUBLIC_TEST_EARL_GREY_JS_TEST_UTIL_H_ |
OLD | NEW |