New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 639786 link

Starred by 0 users

Issue metadata

Status: WontFix
Owner:
hobby only
Closed: Nov 19
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Task

Blocked on:
issue 621355



Sign in to add a comment

Allow mocking of PasswordManager and PasswordFormManager

Project Member Reported by vabr@chromium.org, Aug 22 2016

Issue description

Currently, PasswordManager has no separation from its interface so when testing PasswordFormManager, the production version of PasswordManager needs to be used. This causes need for complex mocking (all dependencies of PasswordManager instead of PasswordManager itself), and after https://codereview.chromium.org/2263933002, some tests (UpdateFormManagers_IsCalled) are no longer even possible.

Similarly, PasswordFormManager lacks an API to be mocked when testing PasswordManager.

We need to abstract the public API from both classes and allow injecting mocked versions at least when testing PasswordManager and PasswordFormManager. Injecting a mocked PasswordManager into PasswordFormManager is easy (it is already a parameter on construction). The other direction is harder: PasswordManager creates its own instances of PasswordFormManager on demand; to ensure they are mocked, we might need to pull out creating them into a separate factory object.

Additional notes:
PasswordManager.UpdateFormManagers_IsCalled used to test that when PasswordFormManager::Save was called, then the PasswordFormManager also called PasswordManager::UpdateFormManagers.
 

Comment 1 by vabr@chromium.org, Aug 22 2016

Description: Show this description

Comment 2 by vabr@chromium.org, Aug 22 2016

Owner: vabr@chromium.org
Status: Assigned (was: Available)
Assigning to myself, as I'd like not to forget about doing this.
If  bug 621355  is fixed and this one not, feel free to notify me and grab this from me, if you want.

Comment 3 by vabr@chromium.org, Aug 22 2016

Description: Show this description

Comment 4 by vabr@chromium.org, Aug 22 2016

Summary: Allow mocking of PasswordManager and PasswordFormManager (was: Allow mocking of PasswordManager)

Comment 5 by vabr@chromium.org, Jun 28 2017

Labels: -Type-Bug Type-Task
Status: WontFix (was: Assigned)
The value of this is questionable, and nobody seems to have time to do it anyway.

Sign in to add a comment