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

Unified Diff: components/policy/core/common/schema_registry_unittest.cc

Issue 337053005: Precache policy-for-extensions for device-local accounts. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed ios tests Created 6 years, 6 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: components/policy/core/common/schema_registry_unittest.cc
diff --git a/components/policy/core/common/schema_registry_unittest.cc b/components/policy/core/common/schema_registry_unittest.cc
index b3d6dae5f3001de9a2ad7c90f6018958eab3707b..847a4173a9ba8a001e7e2c7a7b3f5abfa67ff5b9 100644
--- a/components/policy/core/common/schema_registry_unittest.cc
+++ b/components/policy/core/common/schema_registry_unittest.cc
@@ -252,10 +252,8 @@ TEST(SchemaRegistryTest, ForwardingSchemaRegistry) {
forwarding.AddObserver(&observer);
EXPECT_FALSE(registry->IsReady());
- // The ForwardingSchemaRegistry is always ready, even if the wrapped registry
- // isn't.
- EXPECT_TRUE(forwarding.IsReady());
- // But they alreday have the same SchemaMap.
+ EXPECT_FALSE(forwarding.IsReady());
+ // They always have the same SchemaMap.
EXPECT_TRUE(SchemaMapEquals(registry->schema_map(), forwarding.schema_map()));
EXPECT_CALL(observer, OnSchemaRegistryUpdated(true));
@@ -270,14 +268,34 @@ TEST(SchemaRegistryTest, ForwardingSchemaRegistry) {
Mock::VerifyAndClearExpectations(&observer);
EXPECT_TRUE(SchemaMapEquals(registry->schema_map(), forwarding.schema_map()));
- // No notifications expected for this call.
+ // No notifications expected for these calls.
EXPECT_FALSE(registry->IsReady());
- registry->SetReady(POLICY_DOMAIN_CHROME);
+ EXPECT_FALSE(forwarding.IsReady());
+
+#if defined(ENABLE_EXTENSIONS)
registry->SetReady(POLICY_DOMAIN_EXTENSIONS);
+ EXPECT_FALSE(registry->IsReady());
+ EXPECT_FALSE(forwarding.IsReady());
+#endif
+
+ registry->SetReady(POLICY_DOMAIN_CHROME);
EXPECT_TRUE(registry->IsReady());
+ // The ForwardingSchemaRegistry becomes ready independently of the wrapped
+ // registry.
+ EXPECT_FALSE(forwarding.IsReady());
+
EXPECT_TRUE(SchemaMapEquals(registry->schema_map(), forwarding.schema_map()));
Mock::VerifyAndClearExpectations(&observer);
+ forwarding.SetReady(POLICY_DOMAIN_EXTENSIONS);
bartfab (slow) 2014/06/23 09:53:38 Why is this conditional for |registry| above but u
Joao da Silva 2014/07/16 11:47:52 Good catch, it's actually not needed above. POLIC
+ EXPECT_FALSE(forwarding.IsReady());
+ Mock::VerifyAndClearExpectations(&observer);
+
+ EXPECT_CALL(observer, OnSchemaRegistryReady());
+ forwarding.SetReady(POLICY_DOMAIN_CHROME);
+ EXPECT_TRUE(forwarding.IsReady());
+ Mock::VerifyAndClearExpectations(&observer);
+
// Keep the same SchemaMap when the original registry is gone.
// No notifications are expected in this case either.
scoped_refptr<SchemaMap> schema_map = registry->schema_map();

Powered by Google App Engine
This is Rietveld 408576698