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

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

Issue 2726243003: Improve DCHECK error message for web::ExecuteJavaScript. (Closed)
Patch Set: Use EXPECT_TRUE instead of DCHECK. 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..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];
}
« 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