Call NotifyWillBeDestroyed before destroying TestBrowserContext.

Planned modifications to SpareRenderProcessHostManager (see
https://crrev.com/c/963405) require making sure that
BrowserContext::NotifyWillBeDestroyed is called before destroying the
context - otherwise some RenderProcessHost(s) (e.g. the spare one) can
survive longer than a BrowserContext leading to UaF when the
RenderProcessHost(s) are eventually destroyed later (potentially in a
different unit test :-).

This CL makes sure that NotifyWillBeDestroyed will be called from the
destructor of TestBrowserContext (and from a few other subclasses of
BrowserContext as appropriate).

Destroying the BrowserContext expands the scope of the requirement to
properly emulate browser threads in the tests by using
TestBrowserThreadBundle in a few more places.

Bug: 808114
Change-Id: I60b959e4969c39bededd6de7a3a51a8fdf12e387
Tbr: [email protected]
Tbr: [email protected]
Tbr: [email protected]
Reviewed-on: https://chromium-review.googlesource.com/964804
Commit-Queue: Łukasz Anforowicz <[email protected]>
Reviewed-by: Sami Kyöstilä <[email protected]>
Reviewed-by: Sergey Volk <[email protected]>
Reviewed-by: Istiaque Ahmed <[email protected]>
Reviewed-by: Alex Moshchuk <[email protected]>
Cr-Commit-Position: refs/heads/master@{#545463}
56 files changed