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

Unified Diff: chrome/browser/chromeos/settings/device_settings_provider_unittest.cc

Issue 1280003004: Added policy to disable/enable a system log upload. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed build to pass browser and unit tests. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
diff --git a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
index 56ff9d9fb4081e9bba5e623aeb7ec90016569b83..a9251b2e3c945ee552df9d5bc1d6848effe10366 100644
--- a/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
+++ b/chrome/browser/chromeos/settings/device_settings_provider_unittest.cc
@@ -99,6 +99,18 @@ class DeviceSettingsProviderTest : public DeviceSettingsTestBase {
Mock::VerifyAndClearExpectations(this);
}
+ // Helper routine to enable/disable log upload settings in policy.
+ void SetLogUploadSettings(bool enable_log_upload) {
+ EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1));
+ em::DeviceLogUploadSettingsProto* proto =
+ device_policy_.payload().mutable_device_log_upload_settings();
+ proto->set_log_upload_enabled(enable_log_upload);
+ device_policy_.Build();
+ device_settings_test_helper_.set_policy_blob(device_policy_.GetBlob());
+ ReloadDeviceSettings();
+ Mock::VerifyAndClearExpectations(this);
+ }
+
// Helper routine to ensure all heartbeat policies have been correctly
// decoded.
void VerifyHeartbeatSettings(bool expected_enable_state,
@@ -140,6 +152,14 @@ class DeviceSettingsProviderTest : public DeviceSettingsTestBase {
&expected_frequency_value));
}
+ // Helper routine to ensure log upload policy has been correctly
+ // decoded.
+ void VerifyLogUploadSettings(bool expected_enable_state) {
+ const base::FundamentalValue expected_enabled_value(expected_enable_state);
+ EXPECT_TRUE(base::Value::Equals(provider_->Get(kLogUploadEnabled),
+ &expected_enabled_value));
+ }
+
// Helper routine to set LoginScreenDomainAutoComplete policy.
void SetDomainAutoComplete(const std::string& domain) {
EXPECT_CALL(*this, SettingChanged(_)).Times(AtLeast(1));
@@ -478,4 +498,11 @@ TEST_F(DeviceSettingsProviderTest, DecodeDomainAutoComplete) {
VerifyDomainAutoComplete(&domain_value);
}
+TEST_F(DeviceSettingsProviderTest, DecodeLogUploadSettings) {
+ SetLogUploadSettings(true);
+ VerifyLogUploadSettings(true);
+
+ SetLogUploadSettings(false);
+ VerifyLogUploadSettings(false);
+}
} // namespace chromeos
« no previous file with comments | « chrome/browser/chromeos/settings/device_settings_provider.cc ('k') | chrome/test/data/policy/policy_test_cases.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698