OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef IOS_WEB_PUBLIC_TEST_EARL_GREY_JS_TEST_UTIL_H_ |
| 6 #define IOS_WEB_PUBLIC_TEST_EARL_GREY_JS_TEST_UTIL_H_ |
| 7 |
| 8 #import <Foundation/Foundation.h> |
| 9 |
| 10 #import "ios/web/public/web_state/web_state.h" |
| 11 |
| 12 namespace web { |
| 13 |
| 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 |
| 16 // unrecoverable error (such as no web view) occurs. |
| 17 void WaitUntilWindowIdInjected(WebState* web_state); |
| 18 |
| 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 |
| 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 |
| 23 // fails with a GREYAssert. |
| 24 id ExecuteJavaScript(WebState* web_state, |
| 25 NSString* javascript, |
| 26 NSError** out_error); |
| 27 |
| 28 } // namespace web |
| 29 |
| 30 #endif // IOS_WEB_PUBLIC_TEST_EARL_GREY_JS_TEST_UTIL_H_ |
OLD | NEW |