The setup for the BrowserViewControllerTest fixture creates a real webState with a mock WebController; this means that webState->GetJSInjectionReceiver() returns nil for this webState. Tab helpers which DCHECK for a non-nil injection manager that are initialized during installDelegatesForTab: will thus encounter such DCHECKs in the BVC unit tests. ChromeIOSTranslateClient is an example of such a tab helper.
Currently [BVC installDelegatesForTab:] checks that the tab's webState has a non-nil injection manager, but this is ugly and fragile.
The ideal fix would be to have the BVC tests use a fully-functional WebController instead of a mocked one.
Comment 1 by eugene...@chromium.org
, Nov 28 2017