Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1519)

Unified Diff: Source/core/page/NetworkStateNotifier.cpp

Issue 302543006: Adds ability to prevent browser connection updates in layout tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Nits Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/page/NetworkStateNotifier.h ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « Source/core/page/NetworkStateNotifier.h ('k') | Source/core/testing/Internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698