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

Unified Diff: ios/web/public/test/js_test_util.mm

Issue 2726243003: Improve DCHECK error message for web::ExecuteJavaScript. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..b4ee0c405efb22b6d57361e728e576b97df2a5a3 100644
--- a/ios/web/public/test/js_test_util.mm
+++ b/ios/web/public/test/js_test_util.mm
@@ -8,7 +8,7 @@
#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"
@@ -24,9 +24,12 @@ id ExecuteJavaScript(CRWJSInjectionManager* manager, NSString* script) {
completed = true;
}];
- base::test::ios::WaitUntilCondition(^{
- return completed;
- });
+ BOOL success = testing::WaitUntilConditionOrTimeout(
+ testing::kWaitForJSCompletionTimeout, ^{
+ return completed;
+ });
+ DCHECK(success)
Eugene But (OOO till 7-30) 2017/03/02 21:27:26 Ideally we should not DCHECK in tests. Can we log
michaeldo 2017/03/02 21:34:37 We can log, however I didn't want to change the cu
+ << "CRWJSInjectionManager failed to complete javascript execution.";
return [[result retain] autorelease];
}
@@ -50,9 +53,11 @@ 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;
+ });
+ DCHECK(success) << "WKWebView failed to complete javascript execution.";
return [[result retain] autorelease];
}
« 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