New issue
Advanced search Search tips

Issue 908810 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Nov 29
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 1
Type: Bug

Blocking:
issue 883318
issue 883330
issue 909715



Sign in to add a comment

Provide a IdentityTestEnvinroment ctor that takes a PrefService

Project Member Reported by toniki...@chromium.org, Nov 27

Issue description

The ctor would still supply the internal dependencies, but the tests could tweak the PrefService instance they hold.

Other objects, eg PO2TS, SigninManager, AccountTrackerService would be hidden from the tests.
 
Summary: Provide a IdentityTestEnvinroment ctor that takes a PrefService (was: Provide a IdentityTestEnvinroment ctor that takes a pref)
Blocking: 883330 883318
Labels: -Pri-2 Pri-1
Status: Available (was: Untriaged)
So somes alternative APIS:

1_ extend the existing constructor that takes the optional bool parameter to take an also optional PrefService instance, and adapt IdentityManagerDependenciesOwner accordingly.

2_ add a new constructor that takes PrefService instance and the optional bool parameter, and adapt IdentityManagerDependenciesOwner accordingly.

3_ keep the constructors as is, and add a getter to IdentityTestEnvironment for the PrefService

Colin, WDYT?
Let's do 1. Thanks!
Blocking: 909715
Ok, I am actively working on it.
Project Member

Comment 8 by bugdroid1@chromium.org, Nov 29

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

commit 5c70ec8578d5785c2268c6531b1b049d0c3bb780
Author: Antonio Gomes <tonikitoo@igalia.com>
Date: Thu Nov 29 14:09:25 2018

Provide a IdentityTestEnvinroment ctor that takes a PrefService

This CL extends the existing simple IdentityTestEnvinroment ctor by
supplying an optional TestingPrefServiceSyncable instance. This way
tests could still tweak the PrefService instance they hold and
other objects, eg PO2TS, SigninManager, AccountTrackerService would be
hidden from the tests.

BUG= 908810 

Change-Id: If8257ddc6bdc22481d3530197025592264ffe256
Reviewed-on: https://chromium-review.googlesource.com/c/1351160
Commit-Queue: Antonio Gomes <tonikitoo@igalia.com>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#612181}
[modify] https://crrev.com/5c70ec8578d5785c2268c6531b1b049d0c3bb780/services/identity/public/cpp/identity_test_environment.cc
[modify] https://crrev.com/5c70ec8578d5785c2268c6531b1b049d0c3bb780/services/identity/public/cpp/identity_test_environment.h

Status: Fixed (was: Available)
one of the possible users of this API might require a bit more refinement:

AccountReconcilorTest::AccountReconcilorTest()
    : account_consistency_(signin::AccountConsistencyMethod::kDisabled),
      test_signin_client_(&pref_service_),
      token_service_(&pref_service_),
      cookie_manager_service_(&token_service_,
                              &test_signin_client_),
#if defined(OS_CHROMEOS)
      signin_manager_(&test_signin_client_, &account_tracker_),
#else
      signin_manager_(&test_signin_client_,
                      &token_service_,
                      &account_tracker_,
                      &cookie_manager_service_),
#endif
      identity_test_env_(&account_tracker_,
                         &token_service_,
                         &signin_manager_,
                         &cookie_manager_service_) {
  AccountTrackerService::RegisterPrefs(pref_service_.registry());
  ProfileOAuth2TokenService::RegisterProfilePrefs(pref_service_.registry());
  SigninManagerBase::RegisterProfilePrefs(pref_service_.registry());
  SigninManagerBase::RegisterPrefs(pref_service_.registry());
  pref_service_.registry()->RegisterBooleanPref(
      prefs::kTokenServiceDiceCompatible, false);

  account_tracker_.Initialize(&pref_service_, base::FilePath());
  cookie_manager_service_.SetListAccountsResponseHttpNotFound();

The call to SetListAccountsResponseHttpNotFound ^^^ can not be achieved as is 
if we use the IdentityTestEnvironment ctor provided by this CL.

Sorry, can you be more specific as to the problem?

Sign in to add a comment