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

Issue 8727037: Signed settings refactoring: Proper caching and more tests. (Closed)

Created:
9 years ago by pastarmovj
Modified:
9 years ago
CC:
chromium-reviews, stevenjb+watch_chromium.org, nkostylev+watch_chromium.org, davemoore+watch_chromium.org, Paweł Hajdan Jr.
Visibility:
Public.

Description

PART 5 Of the signed settings refactoring. List of all changes follow beneath: Read from the bottom to the top: * Add new unit tests to cover what was removed before. * Rename SignedSettingsTempStorage to SignedSettingsCache. * Revitalize existing tests for SignedSettings[Helper]. * Add the needed infrastucture to support enrollment as well. * Remove the second cache in OwnershipService it is obsolete. * Remove the prop ops completely. * Remove direct prop op from the proxy stuff. * Serialize policy changes correctly and map side effects of policies. Mainly make sure we never serialize dirty policy. Don't reload if policy is serialized fine. Clear local state registration. * Clean up redundand SS ops and make proper callbacks for the helper Move the temp storage finalization to where it belongs. * Make the temp storage be the cache and use policy ops. * Make DeviceSettingsProvider work with the protobuf blob directly. * Merged DeviceSettingsProvider and UserCrosSettingsTrust. * Rename UserCrosSettingsProvider to DeviceSettingsProvider. * Extract the SignedSettingsMigrationHelper in its own file. BUG=chromium-os:14054 TEST=unit_tests:SignedSettings*,*CrosSettings*,suite_Smoke:login_OwnershipApi Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=112713

Patch Set 1 #

Patch Set 2 : Rebased to ToT and removed some debug output left. #

Total comments: 90

Patch Set 3 : Addressed comments. #

Total comments: 10

Patch Set 4 : Addressed second round of comments and fixed a mem leak in one of the new tests. #

Total comments: 8

Patch Set 5 : Next round of comments. All bots meanwhile good and manual testing seems fine as well. #

Total comments: 35

Patch Set 6 : Addressed comments. Fixed small bugs. Rebased to ToT. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1536 lines, -1924 lines) Patch
M chrome/browser/chromeos/cros_settings.h View 1 2 3 4 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/cros_settings.cc View 1 2 3 4 7 chunks +12 lines, -9 lines 0 comments Download
M chrome/browser/chromeos/cros_settings_provider.h View 1 2 1 chunk +5 lines, -2 lines 0 comments Download
A chrome/browser/chromeos/cros_settings_unittest.cc View 1 2 3 4 5 1 chunk +228 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/device_settings_provider.h View 1 2 3 4 5 1 chunk +131 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/device_settings_provider.cc View 1 2 3 4 5 1 chunk +523 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/mock_ownership_service.h View 1 chunk +0 lines, -3 lines 0 comments Download
M chrome/browser/chromeos/login/mock_signed_settings_helper.h View 1 chunk +6 lines, -9 lines 0 comments Download
M chrome/browser/chromeos/login/owner_manager.cc View 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/chromeos/login/ownership_service.h View 1 2 3 4 5 4 chunks +0 lines, -14 lines 0 comments Download
M chrome/browser/chromeos/login/ownership_service.cc View 2 chunks +0 lines, -14 lines 0 comments Download
M chrome/browser/chromeos/login/session_manager_observer.cc View 1 2 3 4 2 chunks +2 lines, -2 lines 0 comments Download
M chrome/browser/chromeos/login/signed_settings.h View 1 2 3 4 5 4 chunks +4 lines, -43 lines 0 comments Download
M chrome/browser/chromeos/login/signed_settings.cc View 7 chunks +2 lines, -416 lines 0 comments Download
A chrome/browser/chromeos/login/signed_settings_cache.h View 1 2 3 4 5 1 chunk +43 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/login/signed_settings_cache.cc View 1 2 3 4 5 1 chunk +114 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/login/signed_settings_cache_unittest.cc View 1 2 1 chunk +57 lines, -0 lines 0 comments Download
M chrome/browser/chromeos/login/signed_settings_helper.h View 1 chunk +8 lines, -34 lines 0 comments Download
M chrome/browser/chromeos/login/signed_settings_helper.cc View 10 chunks +21 lines, -133 lines 0 comments Download
M chrome/browser/chromeos/login/signed_settings_helper_unittest.cc View 1 2 3 4 5 5 chunks +110 lines, -89 lines 0 comments Download
D chrome/browser/chromeos/login/signed_settings_temp_storage.h View 1 chunk +0 lines, -45 lines 0 comments Download
D chrome/browser/chromeos/login/signed_settings_temp_storage.cc View 1 chunk +0 lines, -77 lines 0 comments Download
D chrome/browser/chromeos/login/signed_settings_temp_storage_unittest.cc View 1 chunk +0 lines, -57 lines 0 comments Download
M chrome/browser/chromeos/login/signed_settings_unittest.cc View 1 2 3 4 5 11 chunks +22 lines, -255 lines 0 comments Download
M chrome/browser/chromeos/login/user_manager.cc View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/chromeos/login/wizard_controller.cc View 1 2 3 chunks +2 lines, -16 lines 0 comments Download
M chrome/browser/chromeos/proxy_config_service_impl.h View 5 chunks +4 lines, -9 lines 0 comments Download
M chrome/browser/chromeos/proxy_config_service_impl.cc View 1 2 3 5 chunks +33 lines, -37 lines 0 comments Download
A chrome/browser/chromeos/signed_settings_migration_helper.h View 1 chunk +59 lines, -0 lines 0 comments Download
A chrome/browser/chromeos/signed_settings_migration_helper.cc View 1 chunk +66 lines, -0 lines 0 comments Download
D chrome/browser/chromeos/user_cros_settings_provider.h View 1 chunk +0 lines, -54 lines 0 comments Download
D chrome/browser/chromeos/user_cros_settings_provider.cc View 1 chunk +0 lines, -536 lines 0 comments Download
M chrome/browser/policy/device_policy_cache.h View 1 2 3 chunks +7 lines, -7 lines 0 comments Download
M chrome/browser/policy/device_policy_cache.cc View 1 2 3 4 5 7 chunks +20 lines, -20 lines 0 comments Download
M chrome/browser/policy/device_policy_cache_unittest.cc View 1 2 5 chunks +9 lines, -3 lines 0 comments Download
M chrome/browser/policy/enterprise_metrics_browsertest.cc View 1 2 3 4 5 2 chunks +0 lines, -4 lines 0 comments Download
M chrome/browser/prefs/browser_prefs.cc View 1 2 2 chunks +2 lines, -4 lines 0 comments Download
M chrome/browser/prefs/pref_value_map.h View 1 2 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/prefs/pref_value_map.cc View 1 2 1 chunk +4 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/options/chromeos/about_page_handler.cc View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/options/chromeos/accounts_options_handler.h View 1 2 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/browser/ui/webui/options/chromeos/accounts_options_handler.cc View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc View 1 2 3 4 5 4 chunks +6 lines, -6 lines 0 comments Download
M chrome/browser/ui/webui/options/chromeos/internet_options_handler.cc View 1 2 3 4 5 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/options/chromeos/stats_options_handler.cc View 1 2 1 chunk +0 lines, -1 line 0 comments Download
M chrome/browser/ui/webui/options/chromeos/system_settings_provider.h View 1 2 2 chunks +4 lines, -3 lines 0 comments Download
M chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc View 1 2 3 4 5 3 chunks +14 lines, -8 lines 0 comments Download
M chrome/chrome_browser.gypi View 1 2 3 4 5 3 chunks +6 lines, -4 lines 0 comments Download
M chrome/chrome_tests.gypi View 1 2 3 4 5 2 chunks +2 lines, -1 line 0 comments Download
M chrome/common/pref_names.h View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download
M chrome/common/pref_names.cc View 1 2 3 4 5 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 12 (0 generated)
pastarmovj
Hey Mattias this should be it. This seems scary big but it actually isn't because ...
9 years ago (2011-11-29 17:03:55 UTC) #1
Mattias Nissler (ping if slow)
First round of comments, I'll do the rest after lunch. Also, your try jobs are ...
9 years ago (2011-11-30 11:22:44 UTC) #2
Mattias Nissler (ping if slow)
moar comments. http://codereview.chromium.org/8727037/diff/2001/chrome/browser/chromeos/login/signed_settings_helper_unittest.cc File chrome/browser/chromeos/login/signed_settings_helper_unittest.cc (right): http://codereview.chromium.org/8727037/diff/2001/chrome/browser/chromeos/login/signed_settings_helper_unittest.cc#newcode43 chrome/browser/chromeos/login/signed_settings_helper_unittest.cc:43: mock_(new MockKeyUtils), Is this needed? http://codereview.chromium.org/8727037/diff/2001/chrome/browser/chromeos/login/signed_settings_helper_unittest.cc#newcode44 chrome/browser/chromeos/login/signed_settings_helper_unittest.cc:44: ...
9 years ago (2011-11-30 12:25:50 UTC) #3
pastarmovj
Thanks for the review! :) Addressed all your comments and fixed the failing tests. http://codereview.chromium.org/8727037/diff/2001/chrome/browser/chromeos/cros_settings.h ...
9 years ago (2011-11-30 17:21:16 UTC) #4
pastarmovj
Pulling in dilmah as a second reviewer as he reviewed the previous parts as well. ...
9 years ago (2011-11-30 17:30:54 UTC) #5
Denis Lagno
Feel free to commit with just Mattias' LG*M. I just picked couple of stylistic nits. ...
9 years ago (2011-12-01 00:38:12 UTC) #6
pastarmovj
Addressed the nits and put some more comments around too. http://codereview.chromium.org/8727037/diff/3004/chrome/browser/chromeos/cros_settings.cc File chrome/browser/chromeos/cros_settings.cc (right): http://codereview.chromium.org/8727037/diff/3004/chrome/browser/chromeos/cros_settings.cc#newcode199 ...
9 years ago (2011-12-01 10:07:17 UTC) #7
Mattias Nissler (ping if slow)
Some comments. I'd like to do another full review pass once you've fixed the things ...
9 years ago (2011-12-01 11:17:49 UTC) #8
pastarmovj
Addressed the comments and updated the CL title as discussed offline. http://codereview.chromium.org/8727037/diff/16001/chrome/browser/chromeos/cros_settings.h File chrome/browser/chromeos/cros_settings.h (right): ...
9 years ago (2011-12-01 15:34:49 UTC) #9
Mattias Nissler (ping if slow)
LGTM with lots of nits :) http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/cros_settings_unittest.cc File chrome/browser/chromeos/cros_settings_unittest.cc (right): http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/cros_settings_unittest.cc#newcode41 chrome/browser/chromeos/cros_settings_unittest.cc:41: // Reset the ...
9 years ago (2011-12-02 12:13:36 UTC) #10
Mattias Nissler (ping if slow)
LGTM with lots of nits :) http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/cros_settings_unittest.cc File chrome/browser/chromeos/cros_settings_unittest.cc (right): http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/cros_settings_unittest.cc#newcode41 chrome/browser/chromeos/cros_settings_unittest.cc:41: // Reset the ...
9 years ago (2011-12-02 12:13:36 UTC) #11
pastarmovj
9 years ago (2011-12-02 14:43:38 UTC) #12
Addressed last round of comments. Running some try jobs and if all is good I
will commit this patch.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/cro...
File chrome/browser/chromeos/cros_settings_unittest.cc (right):

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/cro...
chrome/browser/chromeos/cros_settings_unittest.cc:41: // Reset the cache between
tests.
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> You might also want to do that on SetUp(), since otherwise tests that leave
> behind state might kill you.

Done.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/cro...
chrome/browser/chromeos/cros_settings_unittest.cc:52:
pointer_factory_.GetWeakPtr(), pref));
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> Do we need the task posting here? I guess not, so please remove.

Nope removed.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/cro...
chrome/browser/chromeos/cros_settings_unittest.cc:91: expected_props_[pref_name]
= value;
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> base::Value*& entry = expected_props_[pref_name];
> delete entry;
> entry = value;

Done.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/cro...
chrome/browser/chromeos/cros_settings_unittest.cc:135:
ASSERT_TRUE(expected_props_.empty());
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> Since you have the last two lines in every test, you may just want them to
> TearDown().

Done.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/cro...
chrome/browser/chromeos/cros_settings_unittest.cc:155: scoped_ptr<base::Value>
hacky_user(base::Value::CreateStringValue("h@xxor"));
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> No need to wrap in a scoped_ptr (here and all over the place).

Done.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/cro...
chrome/browser/chromeos/cros_settings_unittest.cc:165: kAccountsPrefUsers,
hacky_user.get()));
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> task posting not needed here I guess.

Done.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/cro...
chrome/browser/chromeos/cros_settings_unittest.cc:185:
message_loop_.RunAllPending();
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> I think at this point we should also verify that all expectations are met. You
> probably want to write a VerifyAndClearExpections() helper function.

Put the proper assert here.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/dev...
File chrome/browser/chromeos/device_settings_provider.cc (right):

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/dev...
chrome/browser/chromeos/device_settings_provider.cc:22: #include
"chrome/browser/chromeos/login/ownership_status_checker.h"
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> not needed.

Done.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/dev...
chrome/browser/chromeos/device_settings_provider.cc:181: // Just store it in the
memory cache no trusted checks no persisting.
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> no comma no sentence no grammar? :)

Done,

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/dev...
File chrome/browser/chromeos/device_settings_provider.h (right):

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/dev...
chrome/browser/chromeos/device_settings_provider.h:57: const em::PolicyData
get_policy() const;
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> if this is a true accessor, it should be called policy().

It is - renamed.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/dev...
chrome/browser/chromeos/device_settings_provider.h:59: void
RetrieveCachedData();
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> missing a comment on what it does.

Done.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/dev...
chrome/browser/chromeos/device_settings_provider.h:61: void SetInPolicy(const
std::string& prop, const base::Value& value);
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> same here: where does the data actually end up?

Done.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/dev...
chrome/browser/chromeos/device_settings_provider.h:63: // Finalizes stores to
the policy file if the cache is dirt
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> y.

e.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/log...
File chrome/browser/chromeos/login/signed_settings_cache.h (right):

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/log...
chrome/browser/chromeos/login/signed_settings_cache.h:22: // There is need
(proxy settings at OOBE stage) to store settings
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> update the comment.

Done.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/log...
File chrome/browser/chromeos/login/signed_settings_helper_unittest.cc (right):

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/chromeos/log...
chrome/browser/chromeos/login/signed_settings_helper_unittest.cc:60:
.WillRepeatedly(Store(true));
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> Can this be inlined with something along the lines of WithArgs<1,
> 2>(Invoke(base::Closure::Run))?

Couldn't get this running with some gmock voodoo but at least I commented what
the idea of this code is.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/ui/webui/opt...
File chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc
(right):

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/ui/webui/opt...
chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc:48:
static_cast<base::ListValue*>(pref_value));
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> No need to pass a copy into CreateUsersWhitelist?

Done.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/ui/webui/opt...
chrome/browser/ui/webui/options/chromeos/core_chromeos_options_handler.cc:207:
const base::Value* value = CrosSettings::Get()->GetPref(*setting_name);
This call was wrong and is now changed to FetchPref to make sure we don't pass
the naked values to the UI.

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/ui/webui/opt...
File chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc
(right):

http://codereview.chromium.org/8727037/diff/16007/chrome/browser/ui/webui/opt...
chrome/browser/ui/webui/options/chromeos/system_settings_provider.cc:221: if
(path == kSystemTimezone) {
On 2011/12/02 12:13:37, Mattias Nissler wrote:
> no need for curlies.

Done.

Powered by Google App Engine
This is Rietveld 408576698