| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "components/policy/core/common/policy_namespace.h" | 9 #include "components/policy/core/common/policy_namespace.h" |
| 10 #include "components/policy/core/common/schema.h" | 10 #include "components/policy/core/common/schema.h" |
| 11 #include "extensions/features/features.h" |
| 11 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 13 | 14 |
| 14 using ::testing::Mock; | 15 using ::testing::Mock; |
| 15 using ::testing::_; | 16 using ::testing::_; |
| 16 | 17 |
| 17 namespace policy { | 18 namespace policy { |
| 18 | 19 |
| 19 namespace { | 20 namespace { |
| 20 | 21 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 | 108 |
| 108 registry.RemoveObserver(&observer); | 109 registry.RemoveObserver(&observer); |
| 109 } | 110 } |
| 110 | 111 |
| 111 TEST(SchemaRegistryTest, IsReady) { | 112 TEST(SchemaRegistryTest, IsReady) { |
| 112 SchemaRegistry registry; | 113 SchemaRegistry registry; |
| 113 MockSchemaRegistryObserver observer; | 114 MockSchemaRegistryObserver observer; |
| 114 registry.AddObserver(&observer); | 115 registry.AddObserver(&observer); |
| 115 | 116 |
| 116 EXPECT_FALSE(registry.IsReady()); | 117 EXPECT_FALSE(registry.IsReady()); |
| 117 #if defined(ENABLE_EXTENSIONS) | 118 #if BUILDFLAG(ENABLE_EXTENSIONS) |
| 118 EXPECT_CALL(observer, OnSchemaRegistryReady()).Times(0); | 119 EXPECT_CALL(observer, OnSchemaRegistryReady()).Times(0); |
| 119 registry.SetExtensionsDomainsReady(); | 120 registry.SetExtensionsDomainsReady(); |
| 120 Mock::VerifyAndClearExpectations(&observer); | 121 Mock::VerifyAndClearExpectations(&observer); |
| 121 EXPECT_FALSE(registry.IsReady()); | 122 EXPECT_FALSE(registry.IsReady()); |
| 122 #endif | 123 #endif |
| 123 EXPECT_CALL(observer, OnSchemaRegistryReady()); | 124 EXPECT_CALL(observer, OnSchemaRegistryReady()); |
| 124 registry.SetDomainReady(POLICY_DOMAIN_CHROME); | 125 registry.SetDomainReady(POLICY_DOMAIN_CHROME); |
| 125 Mock::VerifyAndClearExpectations(&observer); | 126 Mock::VerifyAndClearExpectations(&observer); |
| 126 EXPECT_TRUE(registry.IsReady()); | 127 EXPECT_TRUE(registry.IsReady()); |
| 127 EXPECT_CALL(observer, OnSchemaRegistryReady()).Times(0); | 128 EXPECT_CALL(observer, OnSchemaRegistryReady()).Times(0); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 319 EXPECT_TRUE(forwarding_2.IsReady()); | 320 EXPECT_TRUE(forwarding_2.IsReady()); |
| 320 | 321 |
| 321 // Destruction of the wrapped registry doesn't change the readiness of the | 322 // Destruction of the wrapped registry doesn't change the readiness of the |
| 322 // forwarding registry. | 323 // forwarding registry. |
| 323 registry.reset(); | 324 registry.reset(); |
| 324 EXPECT_TRUE(forwarding_1.IsReady()); | 325 EXPECT_TRUE(forwarding_1.IsReady()); |
| 325 EXPECT_TRUE(forwarding_2.IsReady()); | 326 EXPECT_TRUE(forwarding_2.IsReady()); |
| 326 } | 327 } |
| 327 | 328 |
| 328 } // namespace policy | 329 } // namespace policy |
| OLD | NEW |