Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(179)

Issue 108643002: ABANDONED: Remove Chrome dependencies from TestExtensionPrefs. (Closed)

Created:
7 years ago by Daniel Erat
Modified:
6 years, 3 months ago
Reviewers:
miket_OOO
CC:
chromium-reviews, extensions-reviews_chromium.org, vandebo (ex-Chrome), Lei Zhang, tfarina, tommycli, Greg Billock, chromium-apps-reviews_chromium.org, Yoyo Zhou, benwells
Visibility:
Public.

Description

Remove Chrome dependencies from TestExtensionPrefs. This makes TestExtensionPrefs stop using PrefServiceSyncable so that TEP can eventually be moved to the toplevel extensions/ directory. preference_api_prefs_unittest.cc depends on PrefServiceSyncable being used (so it can create an incognito PrefService), so TEP now takes an optional PrefServiceFactory (which can be e.g. a Chrome PrefServiceMockFactory object). BUG=313284

Patch Set 1 #

Total comments: 4
Unified diffs Side-by-side diffs Delta from patch set Stats (+119 lines, -52 lines) Patch
M apps/shell_window_geometry_cache_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/api/extension_action/extension_action_prefs_unittest.cc View 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/extensions/api/preference/preference_api_prefs_unittest.cc View 8 chunks +22 lines, -6 lines 0 comments Download
M chrome/browser/extensions/api/signed_in_devices/signed_in_devices_api_unittest.cc View 2 chunks +2 lines, -1 line 0 comments Download
M chrome/browser/extensions/blacklist_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/chrome_app_sorting_unittest.cc View 11 chunks +17 lines, -10 lines 0 comments Download
M chrome/browser/extensions/extension_prefs_unittest.h View 3 chunks +7 lines, -2 lines 0 comments Download
M chrome/browser/extensions/extension_prefs_unittest.cc View 20 chunks +36 lines, -9 lines 0 comments Download
M chrome/browser/extensions/menu_manager_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/standard_management_policy_provider_unittest.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/extensions/test_extension_prefs.h View 4 chunks +7 lines, -4 lines 0 comments Download
M chrome/browser/extensions/test_extension_prefs.cc View 5 chunks +16 lines, -13 lines 4 comments Download
M chrome/browser/extensions/updater/extension_updater_unittest.cc View 2 chunks +4 lines, -2 lines 0 comments Download
M chrome/browser/media_galleries/media_galleries_permissions_unittest.cc View 1 chunk +2 lines, -1 line 0 comments Download

Messages

Total messages: 5 (0 generated)
Daniel Erat
This is pretty gross. Let me know if you have any better ideas.
7 years ago (2013-12-06 18:00:03 UTC) #1
miket_OOO
No better ideas. I considered a setter instead of the optional constructor argument, but I ...
7 years ago (2013-12-06 20:42:02 UTC) #2
Daniel Erat
https://codereview.chromium.org/108643002/diff/1/chrome/browser/extensions/test_extension_prefs.cc File chrome/browser/extensions/test_extension_prefs.cc (right): https://codereview.chromium.org/108643002/diff/1/chrome/browser/extensions/test_extension_prefs.cc#newcode67 chrome/browser/extensions/test_extension_prefs.cc:67: new base::PrefServiceFactory), On 2013/12/06 20:42:03, miket wrote: > After ...
7 years ago (2013-12-06 20:47:54 UTC) #3
Daniel Erat
https://codereview.chromium.org/108643002/diff/1/chrome/browser/extensions/test_extension_prefs.cc File chrome/browser/extensions/test_extension_prefs.cc (left): https://codereview.chromium.org/108643002/diff/1/chrome/browser/extensions/test_extension_prefs.cc#oldcode111 chrome/browser/extensions/test_extension_prefs.cc:111: pref_service_ = factory.CreateSyncable(pref_registry_.get()).Pass(); ugh, i think i see the ...
7 years ago (2013-12-06 21:01:17 UTC) #4
Daniel Erat
7 years ago (2013-12-06 21:07:42 UTC) #5
https://codereview.chromium.org/108643002/diff/1/chrome/browser/extensions/te...
File chrome/browser/extensions/test_extension_prefs.cc (left):

https://codereview.chromium.org/108643002/diff/1/chrome/browser/extensions/te...
chrome/browser/extensions/test_extension_prefs.cc:111: pref_service_ =
factory.CreateSyncable(pref_registry_.get()).Pass();
On 2013/12/06 21:01:17, Daniel Erat wrote:
> ugh, i think i see the problem. i changed this CreateSyncable() call to
> Create(). PrefServiceSyncableFactory (which PrefServiceMockFactory derives
from)
> doesn't override Create(), so it's presumably returning a normal PrefService
> instead of a PrefServiceSyncable.
> 
> i'm not sure why PrefServiceSyncableFactory adds a new create method instead
of
> overriding the existing one -- maybe it's so it can return a
> scoped_ptr<PrefServiceSyncable> instead of a scoped_ptr<PrefService>?
> 
> i'm not sure what the solution is. i could change PrefServiceSyncableFactory
to
> override Create() instead and then make its (few) callers do the downcast if
> they need a PrefServiceSyncable.

worse than i thought: CreateSyncable also takes a PrefRegistrySyncable rather
than a PrefRegistry (as Create does). the registry gets passed to
PrefServiceSyncable's c'tor, which requires a syncable registry.

maybe i should just keep all of this testing code in chrome/browser/extensions.
the downside is that extension_prefs_unittest.cc uses TestExtensionPrefs, so it
wouldn't be able to live alongside extension_prefs.cc after that gets moved.

Powered by Google App Engine
This is Rietveld 408576698