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

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

Issue 2726243003: Improve DCHECK error message for web::ExecuteJavaScript. (Closed)
Patch Set: Use SysNSStringToUTF8 helper. 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..9ddf9a8a06a3716954bb6e99e6b239281b0b6532 100644
--- a/ios/web/public/test/js_test_util.mm
+++ b/ios/web/public/test/js_test_util.mm
@@ -8,9 +8,11 @@
#include "base/logging.h"
#import "base/mac/scoped_nsobject.h"
-#import "base/test/ios/wait_util.h"
+#include "base/strings/sys_string_conversions.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 +26,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)
+ << "CRWJSInjectionManager failed to complete javascript execution.\n"
+ << base::SysNSStringToUTF8(
+ [[NSThread callStackSymbols] componentsJoinedByString:@"\n"]);
return [[result retain] autorelease];
}
@@ -50,9 +58,14 @@ 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"
+ << base::SysNSStringToUTF8([[NSThread callStackSymbols]
+ componentsJoinedByString:@"\n"]);
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