Deflake SSLUIWorkerFetchTest.MixedContentSettings*

This re-enables and deflakes the MixedContentSettings* tests by having
RunMixedContentSettingsTest() create a new tab for each invocation.
Previously, the SSLStatus::RAN_INSECURE_CONTENT bit was being retained
when subsequent invocations caused the navigations to commit to the same
previously used process (|SSLHostStateDelegate| tracks per-host/process
and is used to populate the SSLStatus on new navigations) -- essentially
once insecure content is run in the process we consider it tainted. This
behavior is currently working-as-intended but we are considering
followup changes in crbug.com/956193.

The fix to deflake the test is as follows:
1) Have each invocation of RunMixedContentSettingsTest() run in a new tab
(creating and tearing down the tab in each invocation). This forces new
RenderFrames/processes to be used.
2) Ensure the WebkitPreferences are correctly set by calling
RenderViewHost::OnWebkitPreferencesChanged() (this matches the behavior
for similar tests that apply overrides like
ServiceWorkerVersionBrowserTest.FetchWithSaveData [1]).
3) Check the security state based on the visible navigation entry rather
than the last committed entry, which matches how |VisibleSecurityState|
is calculated and used for displaying security state information about
a tab.

[1] https://cs.chromium.org/chromium/src/content/browser/service_worker/service_worker_browsertest.cc?l=1669&rcl=ab71dd0147ba6d0864b00acb0ada2e08b477b585

Bug: 890372
Change-Id: Ic89ffb31ae0e97420c0cefe3ade2db8128ad26bd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1559241
Reviewed-by: Emily Stark <estark@chromium.org>
Commit-Queue: Christopher Thompson <cthomp@chromium.org>
Cr-Commit-Position: refs/heads/master@{#654138}
2 files changed