| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "components/policy/core/common/schema_registry.h" | 5 #include "components/policy/core/common/schema_registry.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "components/policy/core/common/policy_namespace.h" | 8 #include "components/policy/core/common/policy_namespace.h" |
| 9 #include "components/policy/core/common/schema.h" | 9 #include "components/policy/core/common/schema.h" |
| 10 #include "testing/gmock/include/gmock/gmock.h" | 10 #include "testing/gmock/include/gmock/gmock.h" |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 EXPECT_CALL(observer, OnSchemaRegistryUpdated(false)); | 265 EXPECT_CALL(observer, OnSchemaRegistryUpdated(false)); |
| 266 registry->UnregisterComponent( | 266 registry->UnregisterComponent( |
| 267 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "abc")); | 267 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "abc")); |
| 268 Mock::VerifyAndClearExpectations(&observer); | 268 Mock::VerifyAndClearExpectations(&observer); |
| 269 EXPECT_TRUE(SchemaMapEquals(registry->schema_map(), forwarding.schema_map())); | 269 EXPECT_TRUE(SchemaMapEquals(registry->schema_map(), forwarding.schema_map())); |
| 270 | 270 |
| 271 // No notifications expected for these calls. | 271 // No notifications expected for these calls. |
| 272 EXPECT_FALSE(registry->IsReady()); | 272 EXPECT_FALSE(registry->IsReady()); |
| 273 EXPECT_FALSE(forwarding.IsReady()); | 273 EXPECT_FALSE(forwarding.IsReady()); |
| 274 | 274 |
| 275 #if defined(ENABLE_EXTENSIONS) | |
| 276 registry->SetReady(POLICY_DOMAIN_EXTENSIONS); | 275 registry->SetReady(POLICY_DOMAIN_EXTENSIONS); |
| 277 EXPECT_FALSE(registry->IsReady()); | 276 EXPECT_FALSE(registry->IsReady()); |
| 278 EXPECT_FALSE(forwarding.IsReady()); | 277 EXPECT_FALSE(forwarding.IsReady()); |
| 279 #endif | |
| 280 | 278 |
| 281 registry->SetReady(POLICY_DOMAIN_CHROME); | 279 registry->SetReady(POLICY_DOMAIN_CHROME); |
| 282 EXPECT_TRUE(registry->IsReady()); | 280 EXPECT_TRUE(registry->IsReady()); |
| 283 // The ForwardingSchemaRegistry becomes ready independently of the wrapped | 281 // The ForwardingSchemaRegistry becomes ready independently of the wrapped |
| 284 // registry. | 282 // registry. |
| 285 EXPECT_FALSE(forwarding.IsReady()); | 283 EXPECT_FALSE(forwarding.IsReady()); |
| 286 | 284 |
| 287 EXPECT_TRUE(SchemaMapEquals(registry->schema_map(), forwarding.schema_map())); | 285 EXPECT_TRUE(SchemaMapEquals(registry->schema_map(), forwarding.schema_map())); |
| 288 Mock::VerifyAndClearExpectations(&observer); | 286 Mock::VerifyAndClearExpectations(&observer); |
| 289 | 287 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 300 // No notifications are expected in this case either. | 298 // No notifications are expected in this case either. |
| 301 scoped_refptr<SchemaMap> schema_map = registry->schema_map(); | 299 scoped_refptr<SchemaMap> schema_map = registry->schema_map(); |
| 302 registry.reset(); | 300 registry.reset(); |
| 303 EXPECT_TRUE(SchemaMapEquals(schema_map, forwarding.schema_map())); | 301 EXPECT_TRUE(SchemaMapEquals(schema_map, forwarding.schema_map())); |
| 304 Mock::VerifyAndClearExpectations(&observer); | 302 Mock::VerifyAndClearExpectations(&observer); |
| 305 | 303 |
| 306 forwarding.RemoveObserver(&observer); | 304 forwarding.RemoveObserver(&observer); |
| 307 } | 305 } |
| 308 | 306 |
| 309 } // namespace policy | 307 } // namespace policy |
| OLD | NEW |