New issue
Advanced search Search tips

Issue 868319 link

Starred by 1 user

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: 0
NextAction: ----
OS: iOS
Pri: 3
Type: Task



Sign in to add a comment

WebJsTest::LoadHtmlAndInject doesn't fail on missing JavaScript file.

Project Member Reported by mrsuyi@chromium.org, Jul 27

Issue description


What steps will reproduce the problem?
(1)Create a web::WebJsTest with JavaScript file which exists but is not added in BUILD.gn;
(2)Call web::WebJsTest::LoadHtmlAndInject in the unittest;
(3)Run the unittest;
(4)The JavaScript file is not injected, and no error or exception appears.

What is the expected result?
web::WebJsTest::LoadHtmlAndInject should return false or throw exception for JavaScript file not found.

What happens instead?
Nothing happened, and every test case about that JavaScript file would fail.

Code ref:
https://cs.chromium.org/chromium/src/ios/web/public/test/web_js_test.h?rcl=d2fc8d1b79b5e61c56bbc52e7604757a79847850&l=72

 
Cc: mrsuyi@chromium.org
Owner: olivierrobin@chromium.org
Status: Assigned (was: Untriaged)
Components: -Test>iOS Test Mobile>WebView>Glue
Labels: -Type-Bug Type-Task
Returning a bool and adding WARN_UNUSED_RESULT would be a great improvement for LoadHtmlAndInject
After https://chromium-review.googlesource.com/c/chromium/src/+/1136301
WebJsTest will DCHECK is content is empty (as all other instances of GetPageScript).
Is that acceptable?
DCHECKing in the test is not great, because DCHECK fails the whole test suite instead of a single test. Returning boolean from a helper and calling ASSERT or EXPECT in the test seems like a better option.
Components: Mobile>iOSWeb
Components: -Mobile>WebView>Glue
Components: -Mobile>iOSWeb Mobile>iOSWeb>PublicAPI

Sign in to add a comment