Transient item can only be added for pending non-app-specific loads. |
||||
Issue descriptionThis should be a valid assumption in |AddTransientItem| in NavigationManagerImpl, but for now, we cannot add a DCHECK for it because some tests are trying to add a transient item without first adding a pending item, such as: https://cs.chromium.org/chromium/src/ios/chrome/browser/ssl/ios_ssl_error_handler_unittest.mm?type=cs&q=IOSSSLErrorHandlerTest+package:%5Echromium$&l=51 btw, we cannot modify the test to add pending item because it has no access to NavigationManagerImpl. it makes more sense to convert those tests to eg tests once the https server is implemented, and then the DCHECK can be added in |AddTransientItem|.
,
Apr 3 2017
EG tests are end-to-end integration tests that test app via user interface. They are not a replacement for unit tests, so I don't think we should convert IOSSSLErrorHandlerTest.NonOverridable to EG.
,
Apr 3 2017
IOSSSLErrorHandlerTest.NonOverridable is loading a URL and verifying that an interstitial page is showing, which sounds like an end-to-end integration test to me. But I think what you said makes sense: we should try refactoring IOSSSLErrorHandlerTest.NonOverridable first.
,
Apr 3 2017
IOSSSLErrorHandler::HandleSSLError takes WebState. Test can pass TestWebState instead of a real web state. TestWebState allows using TestNavigationManager and we can change TestNavigationManager to allow adding pending and transient items.
,
Apr 3 2017
void WebStateImpl::ShowWebInterstitial(WebInterstitialImpl* interstitial) {
DCHECK(Configured());
DCHECK(interstitial);
interstitial_ = interstitial;
ShowTransientContentView(interstitial_->GetContentView());
}
it seems that this test requires a WebStateImpl, and if we use TestWebState, following line will be executed: return static_cast<web::WebStateImpl*>(web_state());
It doesn't feel right to me to cast a WebState to WebStateImpl, but I'm not sure what's the best solution for this situation.
,
Apr 4 2017
Casting WebState to WebStateImpl violates Liskov Substitution Principle, which is bad, but that's unfortunately the code we have. One way to fix the problem would be: 1.) Fix crbug.com/570699 2.) Start and Stop the load in the test Another fix could be: 1.) Add WebTestWithWebState::AddPendingItem 2.) Use WebTestWithWebState::AddPendingItem in the test I think adding WebTestWithWebState::AddPendingItem is just fine for a fix.
,
Apr 4 2017
Thank you very much for thinking about this! AddPendingItem sounds like a reasonable fix given all the options we have.
,
Apr 4 2017
+1 to Eugene's suggestion of adding API to WebTestWithWebState
,
Apr 4 2017
,
Apr 5 2017
,
Apr 6 2017
|
||||
►
Sign in to add a comment |
||||
Comment 1 by liaoyuke@chromium.org
, Apr 3 2017