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..b1b6e613e411b4b04446a46c6706a472027a6b6e 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,10 @@ std::string TestPolicyHash() { |
return base::SHA1HashString(kTestPolicy); |
} |
+bool NotEquals(const std::string& expected, const std::string& key) { |
bartfab (slow)
2013/11/05 15:53:04
Nit: s/Equals/Equal/ (x.Equals(y) reads like prope
Joao da Silva
2013/11/07 13:15:00
Done.
|
+ return key != expected; |
+} |
+ |
class MockComponentCloudPolicyStoreDelegate |
: public ComponentCloudPolicyStore::Delegate { |
public: |
@@ -282,10 +286,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(&NotEquals, kTestExtension)); |
// The policy for |ns| is still served. |
EXPECT_TRUE(store_->policy().Equals(expected_bundle_)); |
@@ -301,8 +304,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(&NotEquals, "obsolete")); |
bartfab (slow)
2013/11/05 15:53:04
The fact that "obsolete" does not match any of the
Joao da Silva
2013/11/07 13:15:00
Done.
|
Mock::VerifyAndClearExpectations(&store_delegate_); |
// No policies are served anymore. |