Add mojom::PrefServiceObserver for OnProfilePrefServiceInitialized |
||
Issue descriptionIn browser tests, we could have the following case (crrev.com/c/858938): Start new user session, which will make ash side SessionController call AddUserSession and connect to pref service. Since ash's ConnectToPrefService is a async across process call, we need a reliable way to wait ConnectToPrefService is done before performing tests that need ash's pref change communicated to chrome side. Propose: interface PrefServiceObserver { // Called when the pref service of |account_id| is initialized. OnProfilePrefServiceInitialized(signin.mojom.AccountId account_id); }; Questions: (1) observer interface location: ash/public/interfaces/session_controller.mojom or services/preferences/public/interfaces/preferences.mojom? (2) how about OnConnectedToPrefService? (3) Currently it will be used in tests only. Any suggestion because this, location or naming? An example usage: https://chromium-review.googlesource.com/c/chromium/src/+/877109 (diff between ps1 and ps4).
,
Jan 22 2018
Adding this observer interface should only be our last resort. Can we wait for a pref change in test like [1]? This would make test depends on impl details but... [1]: https://cs.chromium.org/chromium/src/services/preferences/pref_service_factory_unittest.cc?rcl=983d2e755d9c1602ffd1af620bd6dfa484f0dd5e&l=201
,
Jan 23 2018
I agree it would be nice to avoid adding this interface. I'm OK with relying on impl details.
,
Jan 30 2018
Re #2, it is a StringPrefMember which doesn't go though PrefChangeRegistrar. I am not able to fix it through this way right now. But For #1, I made a change in shared_pref_registry.cc: if pref_registry is empty, create separate connection for it: See the new patch in: https://chromium-review.googlesource.com/c/chromium/src/+/858938/9..13 I am going to close this issue as this method is not encouraged. |
||
►
Sign in to add a comment |
||
Comment 1 by warx@chromium.org
, Jan 21 2018