GetStaticHtmlView accesses raw WKWebView |
|||||
Issue description
This is the code and it's pretty bad way to extract StaticHtmlViewController from WebState:
UIView* web_state_view = chrome_test_util::GetCurrentWebState()->GetView();
WKWebView* web_view =
base::mac::ObjCCast<WKWebView>(web_state_view.subviews.firstObject);
return base::mac::ObjCCast<StaticHtmlViewController>(
web_view.navigationDelegate);
,
Oct 13 2017
Eugene, by "pretty bad", is the problem that it's accessing APIs we don't want to expose (raw WKWebView)? Or is there something else wrong with it (incorrect, flaky, ...)?
,
Oct 13 2017
Sorry for "pretty bad". Walking through the view hierarchy and grabbing a delegate is an encapsulation violation. Encapsulation violations are form of technical debt because the test relies on internal implementation. This WKWebView is not a part of web layer, so the bug is not about layering violation.
,
Feb 14 2018
,
Feb 14 2018
Can we prioritize this? It's a serious layering violation.
,
Feb 19 2018
I don't really know anything about this bug, Eugene, would you be a better owner for this bug?
,
Feb 19 2018
|StaticHtmlViewController* GetStaticHtmlView(web::WebState* web_state)| is a part of Chrome EG Integration testing framework, which I do not own. GetStaticHtmlView makes assumptions about view hierarchy and existence of WKWebView. I don't know the purpose of GetStaticHtmlView, but GetStaticHtmlView implementation violates layering and encapsulation. Maybe we should rewrite GetStaticHtmlView or maybe we should just throw GetStaticHtmlView away.
,
Feb 20 2018
Hey Eugene, I think there have been some confusions around who are currently the owners of EG framework. baxley@ was clearly the owner, but his leaving shouldn't leave Menglu and I being the default maintainer of the EG framework, but whether we want to or will be is a different thing, and it's also pretty unfortunate that the team hasn't reached to Menglu or me or John to discuss this. Anyway, I'm happy to voluntarily cover some of the bugs balxey@ left over, but I don't think I'll be able to get to this one any time soon, so I'm marking it as available for now.
,
Feb 20 2018
This API is only used in ReadingList tests. Olivier, is this something that you can fix?
,
Feb 21 2018
Hi We need an equivalent of WaitForWebViewContainingText for distilled page. What makes the static page implementation worse than the actual webView implementation?
,
Feb 21 2018
Thanks Oliver for clarifying the reason why GetStaticHtmlView exists. If the question was: "what's wrong with the following code: |WKWebView* web_view = base::mac::ObjCCast<WKWebView(web_state_view.subviews.firstObject);|?" Then the answer is: This code makes assumptions about 2 things which are strict implementation details: - view hierarchy create by web controller - the fact that StaticHtmlViewController is WKNavigationDelegate These assumptions will not allow to refactor NativeContent usage, without breaking the tests. Now that I understand why GetStaticHtmlView exists, I think we can put this bug on hold until we actually start repealing NativeContent. |
|||||
►
Sign in to add a comment |
|||||
Comment 1 by olivierrobin@chromium.org
, Oct 13 2017Owner: baxley@chromium.org
Status: Assigned (was: Untriaged)