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

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

Issue 756133002: Purge cache when the server removes the policy for an extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix win build Created 6 years 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: components/policy/core/common/cloud/cloud_policy_client_unittest.cc
diff --git a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc
index 905b0e1b71e5a9d3f326c56691975ab6d93db5a6..767f1b83c62f1f813961db206f000ea0d8b660b7 100644
--- a/components/policy/core/common/cloud/cloud_policy_client_unittest.cc
+++ b/components/policy/core/common/cloud/cloud_policy_client_unittest.cc
@@ -504,6 +504,7 @@ TEST_F(CloudPolicyClientTest, PolicyFetchWithExtensionPolicy) {
policy_response_.policy_response().response(0));
expected_namespaces.insert(key);
key.first = dm_protocol::kChromeExtensionPolicyType;
+ expected_namespaces.insert(key);
for (size_t i = 0; i < arraysize(kExtensions); ++i) {
key.second = kExtensions[i];
em::PolicyData policy_data;
@@ -512,7 +513,6 @@ TEST_F(CloudPolicyClientTest, PolicyFetchWithExtensionPolicy) {
expected_responses[key].set_policy_data(policy_data.SerializeAsString());
policy_response_.mutable_policy_response()->add_response()->CopyFrom(
expected_responses[key]);
- expected_namespaces.insert(key);
}
// Make a policy fetch.
@@ -527,26 +527,21 @@ TEST_F(CloudPolicyClientTest, PolicyFetchWithExtensionPolicy) {
.WillOnce(SaveArg<6>(&policy_request_));
EXPECT_CALL(observer_, OnPolicyFetched(_));
EXPECT_CALL(*status_provider_, OnSubmittedSuccessfully());
- for (size_t i = 0; i < arraysize(kExtensions); ++i) {
- client_->AddPolicyTypeToFetch(dm_protocol::kChromeExtensionPolicyType,
- kExtensions[i]);
- }
+ client_->AddPolicyTypeToFetch(dm_protocol::kChromeExtensionPolicyType,
+ std::string());
client_->FetchPolicy();
// Verify that the request includes the expected namespaces.
ASSERT_TRUE(policy_request_.has_policy_request());
const em::DevicePolicyRequest& policy_request =
policy_request_.policy_request();
- ASSERT_EQ(static_cast<int>(1 + arraysize(kExtensions)),
- policy_request.request_size());
+ ASSERT_EQ(2, policy_request.request_size());
for (int i = 0; i < policy_request.request_size(); ++i) {
const em::PolicyFetchRequest& fetch_request = policy_request.request(i);
ASSERT_TRUE(fetch_request.has_policy_type());
- std::string entity_id;
- if (fetch_request.has_settings_entity_id())
- entity_id = fetch_request.settings_entity_id();
+ EXPECT_FALSE(fetch_request.has_settings_entity_id());
std::pair<std::string, std::string> key(fetch_request.policy_type(),
- entity_id);
+ std::string());
EXPECT_EQ(1u, expected_namespaces.erase(key));
}
EXPECT_TRUE(expected_namespaces.empty());

Powered by Google App Engine
This is Rietveld 408576698