Enable IdentityTestEnvironment to take in IdentityManager's dependencies

Currently, IdentityTestEnvironment internally constructs all the
dependencies of IdentityManager as well as the IdentityManager object
itself. This behavior is nice for hiding the fact that IdentityManager
has these dependencies from consumers, but doesn't allow for
usage of IdentityTestEnviroment in incremental conversion of tests that
have broad direct usage of these dependencies. Concretely,
profile_sync_test_util.h provides one such problematic case: it
constructs and directly exposes these dependencies, which are then
broadly used by a set of tests that consume this utility class.
Converting all these tests in one go is not practical.

This CL adds an alternate IdentityTestEnvironment constructor that
takes in the dependencies and constructs IdentityManager via those
passed-in dependencies. To enable this constructor, the CL also
encapsulates the fact that IdentityTestEnvironment otherwise obtains
these dependencies from an internal object within the current
IdentityTestEnvironment constructor.  It also moves ownership of
IdentityManager from that internal object to IdentityTestEnvironment
itself so that it can be created/owned independent of that internal

A followup CL will use this new constructor.

Bug: 886599
Change-Id: I4c6a503dcc11c327193f80bc7d7c48e467c6919b
Reviewed-on: https://chromium-review.googlesource.com/c/1273298
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#599178}
2 files changed