Chromium Code Reviews| Index: ios/web/public/test/js_test_util.mm |
| diff --git a/ios/web/public/test/js_test_util.mm b/ios/web/public/test/js_test_util.mm |
| index 00ab99d8776797c96f85963a093c90f63d1e11c6..0e474a33633627ded6a7459207d11efbf21d9238 100644 |
| --- a/ios/web/public/test/js_test_util.mm |
| +++ b/ios/web/public/test/js_test_util.mm |
| @@ -8,9 +8,10 @@ |
| #include "base/logging.h" |
| #import "base/mac/scoped_nsobject.h" |
| -#import "base/test/ios/wait_util.h" |
| +#import "ios/testing/wait_util.h" |
| #import "ios/web/public/web_state/js/crw_js_injection_manager.h" |
| #import "ios/web/public/web_state/js/crw_js_injection_receiver.h" |
| +#include "testing/gtest/include/gtest/gtest.h" |
| namespace web { |
| @@ -24,9 +25,15 @@ id ExecuteJavaScript(CRWJSInjectionManager* manager, NSString* script) { |
| completed = true; |
| }]; |
| - base::test::ios::WaitUntilCondition(^{ |
| - return completed; |
| - }); |
| + BOOL success = testing::WaitUntilConditionOrTimeout( |
| + testing::kWaitForJSCompletionTimeout, ^{ |
| + return completed; |
| + }); |
| + // Log stack trace to provide some context. |
| + EXPECT_TRUE(success) |
|
michaeldo
2017/03/03 00:11:00
I already have another CL in which I'd like to add
Eugene But (OOO till 7-30)
2017/03/03 01:48:06
I believe we should not have different word ("Expe
michaeldo
2017/03/03 18:17:08
Acknowledged.
|
| + << "CRWJSInjectionManager failed to complete javascript execution.\n" |
| + << [[[NSThread callStackSymbols] componentsJoinedByString:@"\n"] |
|
Eugene But (OOO till 7-30)
2017/03/03 01:48:06
Please use sys_string_conversions.h instead of NSS
michaeldo
2017/03/03 18:17:08
Of course, thank you.
|
| + cStringUsingEncoding:NSUTF8StringEncoding]; |
| return [[result retain] autorelease]; |
| } |
| @@ -50,9 +57,15 @@ id ExecuteJavaScript(WKWebView* web_view, NSString* script, NSError** error) { |
| *error = [[script_error copy] autorelease]; |
| completed = true; |
| }]; |
| - base::test::ios::WaitUntilCondition(^{ |
| - return completed; |
| - }); |
| + BOOL success = testing::WaitUntilConditionOrTimeout( |
| + testing::kWaitForJSCompletionTimeout, ^{ |
| + return completed; |
| + }); |
| + // Log stack trace to provide some context. |
| + EXPECT_TRUE(success) |
| + << "WKWebView failed to complete javascript execution.\n" |
| + << [[[NSThread callStackSymbols] componentsJoinedByString:@"\n"] |
| + cStringUsingEncoding:NSUTF8StringEncoding]; |
|
Eugene But (OOO till 7-30)
2017/03/03 01:48:06
ditto
michaeldo
2017/03/03 18:17:08
Done.
|
| return [[result retain] autorelease]; |
| } |