wifi_sync: allow WifiCredentialSyncableServiceFactory to ignore LoginState
commit73bbc93c565dac4de1054a0664217989d1761979
authorquiche <quiche@chromium.org>
Fri, 6 Feb 2015 05:32:40 +0000 (5 21:32 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 6 Feb 2015 05:34:25 +0000 (6 05:34 +0000)
tree94c1ba6fd2cdb99217115c8a43cec4e67450b301
parent610520d0568606787b0b995b44d104f35d8e7390
wifi_sync: allow WifiCredentialSyncableServiceFactory to ignore LoginState

WifiCredentialSyncableServiceFactory normally uses
chromeos::LoginState to associate a SyncableService with a Shill
profile. For this to work, LoginState must have been set properly,
before someone tries to use the Factory to create a SyncableService.

The precondition is met in production mode. However, in sync
integration tests, it is difficult to arrange for LoginState to be
configured properly. The problem is that the sync integration test
framework creates multiple SyncableServices, without providing the
test case the ability to change configuration between the construction
of the SyncableServices.

Acccomodate the way sync integration test work, by allowing the
WifiCredentialSyncableServiceFactory to ignore LoginState. When
LoginState is ignored, the factory will, instead, use the
BrowserContext to associate the new SyncableService with a Shill
profile. This works for sync integration tests, because each
SyncableService created by the test framework has a separate
BrowserContext.

BUG=chromium:431435
TEST=components_unittests --gtest_filter="Wifi*"

Review URL: https://codereview.chromium.org/876833002

Cr-Commit-Position: refs/heads/master@{#314981}
components/wifi_sync/DEPS
components/wifi_sync/wifi_credential_syncable_service_factory.cc
components/wifi_sync/wifi_credential_syncable_service_factory.h