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

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 a48c5ac62dfd1132fd53c4f591b29f5a5215a523..2422ec5c2e93a4ae7d00c29e84da1590f231273c 100644
--- a/Source/core/testing/Internals.cpp
+++ b/Source/core/testing/Internals.cpp
@@ -105,6 +105,7 @@
#include "core/page/Chrome.h"
#include "core/page/ChromeClient.h"
#include "core/page/EventHandler.h"
+#include "core/page/NetworkStateNotifier.h"
#include "core/page/Page.h"
#include "core/page/PagePopupController.h"
#include "core/page/PrintContext.h"
@@ -128,6 +129,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"
@@ -2334,4 +2336,25 @@ String Internals::textSurroundingNode(Node* node, int x, int y, unsigned long ma
return surroundingText.content();
}
+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);
adamk 2014/05/22 15:40:32 It looks to me like this might leak state between
jkarlin 2014/05/22 17:38:02 Good point that it changes state between runs. On
adamk 2014/05/23 22:33:57 Not sure what you mean by "One would expect the ne
+}
}
adamk 2014/05/22 15:40:32 Nit: Please add a blank line between these two bra
jkarlin 2014/05/22 17:38:02 Done.
« 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