OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2014, Google Inc. All rights reserved. | 2 * Copyright (c) 2014, 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 void addObserverOnNotification(StateObserver* observer, StateObserver* obser
verToAdd) | 125 void addObserverOnNotification(StateObserver* observer, StateObserver* obser
verToAdd) |
126 { | 126 { |
127 observer->setNotificationCallback(bind(&NetworkStateNotifier::addObserve
r, &m_notifier, observerToAdd, executionContext())); | 127 observer->setNotificationCallback(bind(&NetworkStateNotifier::addObserve
r, &m_notifier, observerToAdd, executionContext())); |
128 } | 128 } |
129 | 129 |
130 void removeObserverOnNotification(StateObserver* observer, StateObserver* ob
serverToRemove) | 130 void removeObserverOnNotification(StateObserver* observer, StateObserver* ob
serverToRemove) |
131 { | 131 { |
132 observer->setNotificationCallback(bind(&NetworkStateNotifier::removeObse
rver, &m_notifier, observerToRemove, executionContext())); | 132 observer->setNotificationCallback(bind(&NetworkStateNotifier::removeObse
rver, &m_notifier, observerToRemove, executionContext())); |
133 } | 133 } |
134 | 134 |
135 RefPtr<Document> m_document; | 135 RefPtrWillBePersistent<Document> m_document; |
136 RefPtr<Document> m_document2; | 136 RefPtrWillBePersistent<Document> m_document2; |
137 NetworkStateNotifier m_notifier; | 137 NetworkStateNotifier m_notifier; |
138 }; | 138 }; |
139 | 139 |
140 TEST_F(NetworkStateNotifierTest, AddObserver) | 140 TEST_F(NetworkStateNotifierTest, AddObserver) |
141 { | 141 { |
142 StateObserver observer; | 142 StateObserver observer; |
143 m_notifier.addObserver(&observer, executionContext()); | 143 m_notifier.addObserver(&observer, executionContext()); |
144 EXPECT_EQ(observer.observedType(), blink::ConnectionTypeNone); | 144 EXPECT_EQ(observer.observedType(), blink::ConnectionTypeNone); |
145 | 145 |
146 setType(blink::ConnectionTypeBluetooth); | 146 setType(blink::ConnectionTypeBluetooth); |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 m_notifier.addObserver(&observer2, executionContext2()); | 271 m_notifier.addObserver(&observer2, executionContext2()); |
272 m_notifier.removeObserver(&observer1, executionContext()); | 272 m_notifier.removeObserver(&observer1, executionContext()); |
273 m_notifier.removeObserver(&observer2, executionContext2()); | 273 m_notifier.removeObserver(&observer2, executionContext2()); |
274 | 274 |
275 setType(blink::ConnectionTypeBluetooth); | 275 setType(blink::ConnectionTypeBluetooth); |
276 EXPECT_EQ(observer1.observedType(), blink::ConnectionTypeNone); | 276 EXPECT_EQ(observer1.observedType(), blink::ConnectionTypeNone); |
277 EXPECT_EQ(observer2.observedType(), blink::ConnectionTypeNone); | 277 EXPECT_EQ(observer2.observedType(), blink::ConnectionTypeNone); |
278 } | 278 } |
279 | 279 |
280 } // namespace WebCore | 280 } // namespace WebCore |
OLD | NEW |