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

Unified Diff: chrome/browser/policy/cloud/component_cloud_policy_store_unittest.cc

Issue 56623005: Policy providers all get a SchemaRegistry to work with. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@chrome-policy-schema-9-purge-with-callback
Patch Set: rebase Created 7 years, 1 month 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/policy/cloud/component_cloud_policy_store_unittest.cc
diff --git a/chrome/browser/policy/cloud/component_cloud_policy_store_unittest.cc b/chrome/browser/policy/cloud/component_cloud_policy_store_unittest.cc
index 66ac1602117f2a9766a9987835e06bc3e5b8ca62..4e46371be2841f5e2bae3b38708e73d7711ccfcd 100644
--- a/chrome/browser/policy/cloud/component_cloud_policy_store_unittest.cc
+++ b/chrome/browser/policy/cloud/component_cloud_policy_store_unittest.cc
@@ -5,10 +5,10 @@
#include "chrome/browser/policy/cloud/component_cloud_policy_store.h"
#include <map>
-#include <set>
#include <string>
#include "base/basictypes.h"
+#include "base/bind.h"
#include "base/callback.h"
#include "base/files/scoped_temp_dir.h"
#include "base/memory/ref_counted.h"
@@ -48,6 +48,14 @@ std::string TestPolicyHash() {
return base::SHA1HashString(kTestPolicy);
}
+bool NotEqual(const std::string& expected, const std::string& key) {
+ return key != expected;
+}
+
+bool True(const std::string& ignored) {
+ return true;
+}
+
class MockComponentCloudPolicyStoreDelegate
: public ComponentCloudPolicyStore::Delegate {
public:
@@ -282,10 +290,9 @@ TEST_F(ComponentCloudPolicyStoreTest, Purge) {
EXPECT_FALSE(IsEmpty());
EXPECT_TRUE(store_->policy().Equals(expected_bundle_));
- // Purge other namespaces.
- std::set<std::string> keep;
- keep.insert(kTestExtension);
- store_->Purge(POLICY_DOMAIN_EXTENSIONS, keep);
+ // Purge other components.
+ store_->Purge(POLICY_DOMAIN_EXTENSIONS,
+ base::Bind(&NotEqual, kTestExtension));
// The policy for |ns| is still served.
EXPECT_TRUE(store_->policy().Equals(expected_bundle_));
@@ -301,8 +308,7 @@ TEST_F(ComponentCloudPolicyStoreTest, Purge) {
// Now purge everything.
EXPECT_CALL(store_delegate_, OnComponentCloudPolicyStoreUpdated());
- keep.clear();
- store_->Purge(POLICY_DOMAIN_EXTENSIONS, keep);
+ store_->Purge(POLICY_DOMAIN_EXTENSIONS, base::Bind(&True));
Mock::VerifyAndClearExpectations(&store_delegate_);
// No policies are served anymore.

Powered by Google App Engine
This is Rietveld 408576698