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

Unified Diff: Source/core/testing/Internals.cpp

Issue 295003003: Internals for testing NetInfov3 code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@netinfo1
Patch Set: Rebase 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/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/testing/Internals.cpp
diff --git a/Source/core/testing/Internals.cpp b/Source/core/testing/Internals.cpp
index 3c5af8f9059ad114b1be683282f60f0b2a1ffec7..e9881e0796324cc4707d1c739d27b81b7df2464f 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -106,6 +106,7 @@
#include "core/page/ChromeClient.h"
#include "core/page/EventHandler.h"
#include "core/page/FocusController.h"
+#include "core/page/NetworkStateNotifier.h"
#include "core/page/Page.h"
#include "core/page/PagePopupController.h"
#include "core/page/PrintContext.h"
@@ -129,6 +130,7 @@
#include "platform/graphics/filters/FilterOperations.h"
#include "platform/weborigin/SchemeRegistry.h"
#include "public/platform/Platform.h"
+#include "public/platform/WebConnectionType.h"
#include "public/platform/WebGraphicsContext3D.h"
#include "public/platform/WebGraphicsContext3DProvider.h"
#include "public/platform/WebLayer.h"
@@ -2340,4 +2342,26 @@ void Internals::setFocused(bool focused)
frame()->page()->focusController().setFocused(focused);
}
+void Internals::setNetworkConnectionInfo(const String& type, ExceptionState& exceptionState)
+{
+ blink::WebConnectionType webtype;
+ if (type == "cellular") {
+ webtype = blink::ConnectionTypeCellular;
+ } else if (type == "bluetooth") {
+ webtype = blink::ConnectionTypeBluetooth;
+ } else if (type == "ethernet") {
+ webtype = blink::ConnectionTypeEthernet;
+ } else if (type == "wifi") {
+ webtype = blink::ConnectionTypeWifi;
+ } else if (type == "other") {
+ webtype = blink::ConnectionTypeOther;
+ } else if (type == "none") {
+ webtype = blink::ConnectionTypeNone;
+ } else {
+ exceptionState.throwDOMException(NotFoundError, ExceptionMessages::failedToEnumerate("connection type", type));
+ return;
+ }
+ networkStateNotifier().setWebConnectionType(webtype);
}
+
+} // namespace WebCore
« no previous file with comments | « Source/core/testing/Internals.h ('k') | Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698