Index: Source/core/page/NetworkStateNotifier.cpp |
diff --git a/Source/core/page/NetworkStateNotifier.cpp b/Source/core/page/NetworkStateNotifier.cpp |
index c4e4fe5248ff22a7e8627b716f02e003cc162780..e270afe6f12aff7f58acc853390e7fdc00e9b73b 100644 |
--- a/Source/core/page/NetworkStateNotifier.cpp |
+++ b/Source/core/page/NetworkStateNotifier.cpp |
@@ -60,6 +60,16 @@ void NetworkStateNotifier::setOnLine(bool onLine) |
void NetworkStateNotifier::setWebConnectionType(blink::WebConnectionType type) |
{ |
ASSERT(isMainThread()); |
+ if (m_testUpdatesOnly) |
+ return; |
+ |
+ setWebConnectionTypeImpl(type); |
+} |
+ |
+void NetworkStateNotifier::setWebConnectionTypeImpl(blink::WebConnectionType type) |
+{ |
+ ASSERT(isMainThread()); |
+ ASSERT(!m_testUpdatesOnly); |
MutexLocker locker(m_mutex); |
if (m_type == type) |
@@ -106,6 +116,19 @@ void NetworkStateNotifier::removeObserver(NetworkStateObserver* observer, Execut |
collectZeroedObservers(observerList, context); |
} |
+void NetworkStateNotifier::setTestUpdatesOnly(bool updatesOnly) |
+{ |
+ ASSERT(isMainThread()); |
+ m_testUpdatesOnly = updatesOnly; |
+} |
+ |
+void NetworkStateNotifier::setWebConnectionTypeForTest(blink::WebConnectionType type) |
+{ |
+ ASSERT(isMainThread()); |
+ ASSERT(m_testUpdatesOnly); |
+ setWebConnectionTypeImpl(type); |
+} |
+ |
void NetworkStateNotifier::notifyObserversOnContext(ExecutionContext* context, blink::WebConnectionType type) |
{ |
ObserverList* observerList = lockAndFindObserverList(context); |