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

Unified Diff: components/policy/core/common/cloud/component_cloud_policy_updater_unittest.cc

Issue 2706293005: Fix DCHECK hit on component policy fetch with empty ID (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « components/policy/core/common/cloud/component_cloud_policy_store_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/policy/core/common/cloud/component_cloud_policy_updater_unittest.cc
diff --git a/components/policy/core/common/cloud/component_cloud_policy_updater_unittest.cc b/components/policy/core/common/cloud/component_cloud_policy_updater_unittest.cc
index 6e0834ee8941bc9d7ccc254eee3a4ae134a8301d..e7a28e02194787e8dc092ae5ffff66ab663884c2 100644
--- a/components/policy/core/common/cloud/component_cloud_policy_updater_unittest.cc
+++ b/components/policy/core/common/cloud/component_cloud_policy_updater_unittest.cc
@@ -289,6 +289,32 @@ TEST_F(ComponentCloudPolicyUpdaterTest, PolicyFetchResponseDifferentPublicKey) {
EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0));
}
+TEST_F(ComponentCloudPolicyUpdaterTest, PolicyFetchResponseEmptyComponentId) {
+ // Submit a policy fetch response having an empty component ID.
+ builder_.policy_data().set_settings_entity_id(std::string());
+ updater_->UpdateExternalPolicy(
+ PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, std::string()),
+ CreateResponse());
+
+ task_runner_->RunUntilIdle();
+
+ // Verify that the policy fetch response has been ignored.
+ EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0));
+
+ // Submit a policy fetch response having an empty component ID with empty data
+ // fields, requesting the deletion of policy.
+ builder_.payload().clear_download_url();
+ builder_.payload().clear_secure_hash();
+ updater_->UpdateExternalPolicy(
+ PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, std::string()),
+ CreateResponse());
+
+ task_runner_->RunUntilIdle();
+
+ // Verify that the policy fetch response has been ignored.
+ EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0));
+}
+
TEST_F(ComponentCloudPolicyUpdaterTest, AlreadyCached) {
// Cache policy for an extension.
builder_.Build();
« no previous file with comments | « components/policy/core/common/cloud/component_cloud_policy_store_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698