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

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

Issue 2903493002: NetInfo network quality extension: Add callbacks and Layout tests (Closed)
Patch Set: haraken comments Created 3 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
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 3b40be5dd0fd8e8cef9f02160a48c91f0e6e71d1..654fe92b417c40c3c29d3d29157c541a15619670 100644
--- a/third_party/WebKit/Source/core/testing/Internals.cpp
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp
@@ -3085,7 +3085,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