New issue
Advanced search Search tips

Issue 882865 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Oct 19
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug


Sign in to add a comment

Design //chrome-level infrastructure for injecting IdentityManager built on top of fake signin classes into the Profile

Project Member Reported by blundell@chromium.org, Sep 11

Issue description

Currently IdentityTestEnvironment only works if it can internally construct its fakes. We should make //chrome-level helpers that play nicely with Profile, injecting necessary fakes of dependencies of IdentityManager in a way that's transparent to tests. See bugs blocked on this one for example tests to examine when bringing up this infrastructure.
 
Blocking: 882864
Blocking: 887266
Note: When we devise and implement the strategy here, we should update the migration doc to reflect the strategy: https://docs.google.com/document/d/14f3qqkDM9IE4Ff_l6wuXvCMeHfSC9TxKezXTCyeaPUY/edit#heading=h.6msdocu34hy0.
Blocking: 894075
Owner: blundell@chromium.org
Status: Started (was: Available)
Blocking: 895772
Project Member

Comment 7 by bugdroid1@chromium.org, Oct 17

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/3f4b72c0e0344c2dd5f37e10c5d5472d455d1e30

commit 3f4b72c0e0344c2dd5f37e10c5d5472d455d1e30
Author: Colin Blundell <blundell@chromium.org>
Date: Wed Oct 17 11:25:57 2018

Allow IdentityTestEnvironment to be used in Profile-based unittests

Currently IdentityTestEnvironment only works if it can internally
construct the IdentityManager instance that it uses. This is definitely
the cleanest mode of operation (and long-term the only targeted one)
However, it prevents IdentityTestEnvironment's usage in //chrome-level
unittests wherein the IdentityManager instance that the test interacts
with must the one constructed via the Profile (i.e., because the
production code being tested obtains IdentityManager from the Profile).

This CL adds support for using IdentityTestEnvironment in this context.
Specifically, it adds a new IdentityTestEnvironment constructor that
takes in an IdentityManager instance as well as its dependencies and
a //chrome-level adaptor that configures Profile to build the necessary
fakes and wraps an IdentityTestEnvironment instance using this new
constructor.

Bug:  882865 
Change-Id: If45f29643fc5a2cacf357ac159c709b068443e9c
Reviewed-on: https://chromium-review.googlesource.com/c/1280264
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600350}
[modify] https://crrev.com/3f4b72c0e0344c2dd5f37e10c5d5472d455d1e30/chrome/browser/BUILD.gn
[add] https://crrev.com/3f4b72c0e0344c2dd5f37e10c5d5472d455d1e30/chrome/browser/signin/identity_test_environment_profile_adaptor.cc
[add] https://crrev.com/3f4b72c0e0344c2dd5f37e10c5d5472d455d1e30/chrome/browser/signin/identity_test_environment_profile_adaptor.h
[modify] https://crrev.com/3f4b72c0e0344c2dd5f37e10c5d5472d455d1e30/services/identity/public/cpp/identity_test_environment.cc
[modify] https://crrev.com/3f4b72c0e0344c2dd5f37e10c5d5472d455d1e30/services/identity/public/cpp/identity_test_environment.h

Project Member

Comment 8 by bugdroid1@chromium.org, Oct 17

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/e98cb472d5d4071d98ada63979eedc205ec94e2d

commit e98cb472d5d4071d98ada63979eedc205ec94e2d
Author: Colin Blundell <blundell@chromium.org>
Date: Wed Oct 17 12:16:16 2018

IdentityTestEnvProfileAdaptor: Add method to create configured Profile

This CL augments IdentityTestEnvironmentProfileAdaptor with a static
method that creates and returns a TestingProfile that is configured
with the factories that IdentityTestEnvironment requires. This API
can be used to convert unittests that use TestingProfile::Builder. It
is preferable to use this API if possible rather than the lower-level
AppendIdentityTestEnvironmentFactories() as this API is less fragile.
That API is still required for tests that do not create the
TestingProfile internally but simply supply the list of TestingFactories
to configure it (e.g., to some common superclass).

This CL converts one unittest as an example and validation.

Bug:  882865 
Change-Id: Ia7cfa648e0086385f4d1506ca4afda80866240b2
Reviewed-on: https://chromium-review.googlesource.com/c/1280764
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Marc Treib <treib@chromium.org>
Reviewed-by: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: David Roger <droger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#600356}
[modify] https://crrev.com/e98cb472d5d4071d98ada63979eedc205ec94e2d/chrome/browser/signin/identity_test_environment_profile_adaptor.cc
[modify] https://crrev.com/e98cb472d5d4071d98ada63979eedc205ec94e2d/chrome/browser/signin/identity_test_environment_profile_adaptor.h
[modify] https://crrev.com/e98cb472d5d4071d98ada63979eedc205ec94e2d/chrome/browser/ui/search/search_tab_helper_unittest.cc

Status: Fixed (was: Started)

Sign in to add a comment