Index: sync/notifier/invalidator_registrar_unittest.cc |
diff --git a/sync/notifier/invalidator_registrar_unittest.cc b/sync/notifier/invalidator_registrar_unittest.cc |
index 043d7eb71671162915fead288935d7b5d3713653..4d5df6cf7e9f9005a4a122cc1d61ea18d9f7497a 100644 |
--- a/sync/notifier/invalidator_registrar_unittest.cc |
+++ b/sync/notifier/invalidator_registrar_unittest.cc |
@@ -124,11 +124,27 @@ INSTANTIATE_TYPED_TEST_CASE_P( |
class InvalidatorRegistrarTest : public testing::Test {}; |
+// Technically the tests below can be part of InvalidatorTest, but we |
+// want to keep the number of death tests down. |
+ |
+// When we expect a death via CHECK(), we can't match against the |
+// CHECK() message since they are removed in official builds. |
+ |
+// Having registered handlers on destruction should cause a CHECK. |
+TEST_F(InvalidatorRegistrarTest, RegisteredHandlerOnDestruction) { |
+ scoped_ptr<InvalidatorRegistrar> registrar(new InvalidatorRegistrar()); |
+ FakeInvalidationHandler handler; |
+ |
+ registrar->RegisterHandler(&handler); |
+ |
+ EXPECT_DEATH({ registrar.reset(); }, ""); |
+ |
+ ASSERT_TRUE(registrar.get()); |
+ registrar->UnregisterHandler(&handler); |
+} |
+ |
// Multiple registrations by different handlers on the same object ID should |
// cause a CHECK. |
-// |
-// Technically this can be part of InvalidatorTest, but we want to keep the |
-// number of death tests down. |
TEST_F(InvalidatorRegistrarTest, MultipleRegistration) { |
const invalidation::ObjectId id1(ipc::invalidation::ObjectSource::TEST, "a"); |
const invalidation::ObjectId id2(ipc::invalidation::ObjectSource::TEST, "a"); |
@@ -147,9 +163,10 @@ TEST_F(InvalidatorRegistrarTest, MultipleRegistration) { |
registrar.UpdateRegisteredIds(&handler1, ids); |
registrar.DetachFromThreadForTest(); |
- // We expect a death via CHECK(). We can't match against the CHECK() message |
- // though since they are removed in official builds. |
EXPECT_DEATH({ registrar.UpdateRegisteredIds(&handler2, ids); }, ""); |
+ |
+ registrar.UnregisterHandler(&handler2); |
+ registrar.UnregisterHandler(&handler1); |
} |
} // namespace |