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

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

Issue 2924913002: NetInfo network quality extension: Add callbacks and Layout tests (Closed)
Patch Set: Created 3 years, 6 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
Index: third_party/WebKit/Source/core/testing/Internals.cpp
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp
index 8e794f8d537a64b639c1e2346c7d255a7eb4f3d1..f87b72f8e8c4596e07c359ad9897b4e9b8466943 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -3088,7 +3088,35 @@ void Internals::setNetworkConnectionInfoOverride(
ExceptionMessages::FailedToEnumerate("connection type", type));
return;
}
- GetNetworkStateNotifier().SetOverride(on_line, webtype, downlink_max_mbps);
+ GetNetworkStateNotifier().SetNetworkConnectionInfoOverride(on_line, webtype,
+ downlink_max_mbps);
+}
+
+void Internals::setNetworkQualityInfoOverride(const String& effective_type,
+ unsigned long transport_rtt_msec,
+ double downlink_throughput_mbps,
+ ExceptionState& exception_state) {
+ WebEffectiveConnectionType web_effective_type =
+ WebEffectiveConnectionType::kTypeUnknown;
+ if (effective_type == "offline") {
+ web_effective_type = WebEffectiveConnectionType::kTypeOffline;
+ } else if (effective_type == "slow-2g") {
+ web_effective_type = WebEffectiveConnectionType::kTypeSlow2G;
+ } else if (effective_type == "2g") {
+ web_effective_type = WebEffectiveConnectionType::kType2G;
+ } else if (effective_type == "3g") {
+ web_effective_type = WebEffectiveConnectionType::kType3G;
+ } else if (effective_type == "4g") {
+ web_effective_type = WebEffectiveConnectionType::kType4G;
+ } else if (effective_type != "unknown") {
+ exception_state.ThrowDOMException(
+ kNotFoundError, ExceptionMessages::FailedToEnumerate(
+ "effective connection type", effective_type));
+ return;
+ }
+
+ GetNetworkStateNotifier().SetNetworkQualityInfoOverride(
+ web_effective_type, transport_rtt_msec, downlink_throughput_mbps);
}
void Internals::clearNetworkConnectionInfoOverride() {
« no previous file with comments | « third_party/WebKit/Source/core/testing/Internals.h ('k') | third_party/WebKit/Source/core/testing/Internals.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698