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 "components/policy/core/common/policy_namespace.h" | 7 #include "components/policy/core/common/policy_namespace.h" |
8 #include "components/policy/core/common/schema.h" | 8 #include "components/policy/core/common/schema.h" |
9 #include "testing/gmock/include/gmock/gmock.h" | 9 #include "testing/gmock/include/gmock/gmock.h" |
10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 EXPECT_FALSE(combined.schema_map()->GetSchema( | 219 EXPECT_FALSE(combined.schema_map()->GetSchema( |
220 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "def"))); | 220 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "def"))); |
221 | 221 |
222 EXPECT_CALL(observer, OnSchemaRegistryUpdated(true)).Times(2); | 222 EXPECT_CALL(observer, OnSchemaRegistryUpdated(true)).Times(2); |
223 registry1.RegisterComponent(PolicyNamespace(POLICY_DOMAIN_CHROME, ""), | 223 registry1.RegisterComponent(PolicyNamespace(POLICY_DOMAIN_CHROME, ""), |
224 schema); | 224 schema); |
225 registry2.RegisterComponent(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "hij"), | 225 registry2.RegisterComponent(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "hij"), |
226 schema); | 226 schema); |
227 Mock::VerifyAndClearExpectations(&observer); | 227 Mock::VerifyAndClearExpectations(&observer); |
228 | 228 |
229 // Untracking |registry1| doesn't trigger an update nofitication, because it | 229 // Untracking |registry1| doesn't trigger an update notification, because it |
230 // doesn't contain any components. | 230 // doesn't contain any components. |
231 EXPECT_CALL(observer, OnSchemaRegistryUpdated(_)).Times(0); | 231 EXPECT_CALL(observer, OnSchemaRegistryUpdated(_)).Times(0); |
232 combined.Untrack(®istry1); | 232 combined.Untrack(®istry1); |
233 Mock::VerifyAndClearExpectations(&observer); | 233 Mock::VerifyAndClearExpectations(&observer); |
234 | 234 |
235 EXPECT_CALL(observer, OnSchemaRegistryUpdated(false)); | 235 EXPECT_CALL(observer, OnSchemaRegistryUpdated(false)); |
236 combined.Untrack(®istry2); | 236 combined.Untrack(®istry2); |
237 Mock::VerifyAndClearExpectations(&observer); | 237 Mock::VerifyAndClearExpectations(&observer); |
238 | 238 |
239 combined.RemoveObserver(&observer); | 239 combined.RemoveObserver(&observer); |
240 } | 240 } |
241 | 241 |
242 } // namespace policy | 242 } // namespace policy |
OLD | NEW |