| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2013 Google Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * | 24 * |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 #include "config.h" | 27 #include "config.h" |
| 28 | 28 |
| 29 #include "platform/LifecycleContext.h" | 29 #include "platform/LifecycleContext.h" |
| 30 | 30 |
| 31 #include "platform/LifecycleNotifier.h" | 31 #include "platform/LifecycleNotifier.h" |
| 32 #include <gtest/gtest.h> | 32 #include <gtest/gtest.h> |
| 33 | 33 |
| 34 using namespace WebCore; | 34 using namespace blink; |
| 35 | 35 |
| 36 namespace { | 36 namespace { |
| 37 class DummyContext : public LifecycleContext<DummyContext> { | 37 class DummyContext : public LifecycleContext<DummyContext> { |
| 38 }; | 38 }; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace blink { |
| 42 | 42 |
| 43 template<> void observerContext(DummyContext* context, LifecycleObserver<DummyCo
ntext>* observer) | 43 template<> void observerContext(DummyContext* context, LifecycleObserver<DummyCo
ntext>* observer) |
| 44 { | 44 { |
| 45 context->wasObservedBy(observer); | 45 context->wasObservedBy(observer); |
| 46 } | 46 } |
| 47 | 47 |
| 48 template<> void unobserverContext(DummyContext* context, LifecycleObserver<Dummy
Context>* observer) | 48 template<> void unobserverContext(DummyContext* context, LifecycleObserver<Dummy
Context>* observer) |
| 49 { | 49 { |
| 50 context->wasUnobservedBy(observer); | 50 context->wasUnobservedBy(observer); |
| 51 } | 51 } |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 OwnPtr<TestingObserver> observer = adoptPtr(new TestingObserver(context.get(
))); | 92 OwnPtr<TestingObserver> observer = adoptPtr(new TestingObserver(context.get(
))); |
| 93 | 93 |
| 94 observer->unobserve(); | 94 observer->unobserve(); |
| 95 context.clear(); | 95 context.clear(); |
| 96 EXPECT_EQ(observer->lifecycleContext(), static_cast<DummyContext*>(0)); | 96 EXPECT_EQ(observer->lifecycleContext(), static_cast<DummyContext*>(0)); |
| 97 EXPECT_FALSE(observer->m_contextDestroyedCalled); | 97 EXPECT_FALSE(observer->m_contextDestroyedCalled); |
| 98 } | 98 } |
| 99 | 99 |
| 100 | 100 |
| 101 } | 101 } |
| OLD | NEW |