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

Unified Diff: third_party/WebKit/Source/devtools/front_end/Tests.js

Issue 2087293003: [DevTools] Network.emulateNetworkConditions now affects NetworkStateNotifier. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: addressed review comments Created 4 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/devtools/front_end/Tests.js
diff --git a/third_party/WebKit/Source/devtools/front_end/Tests.js b/third_party/WebKit/Source/devtools/front_end/Tests.js
index a8bfc3eadf8afea927e221972c71a440ec117243..268f62c932c955791f0e865e38a48117adb0d2ee 100644
--- a/third_party/WebKit/Source/devtools/front_end/Tests.js
+++ b/third_party/WebKit/Source/devtools/front_end/Tests.js
@@ -717,6 +717,59 @@ TestSuite.prototype.testDeviceMetricsOverrides = function()
step1();
};
+TestSuite.prototype.testEmulateNetworkConditions = function()
+{
+ var test = this;
+
+ function testPreset(preset, messages, next)
+ {
+ function onConsoleMessage(event)
+ {
+ var index = messages.indexOf(event.data.messageText);
+ if (index === -1) {
+ test.fail("Unexpected message: " + event.data.messageText);
+ return;
+ }
+
+ messages.splice(index, 1);
+ if (!messages.length) {
+ WebInspector.multitargetConsoleModel.removeEventListener(WebInspector.ConsoleModel.Events.MessageAdded, onConsoleMessage, this);
+ next();
+ }
+ }
+
+ WebInspector.multitargetConsoleModel.addEventListener(WebInspector.ConsoleModel.Events.MessageAdded, onConsoleMessage, this);
+ WebInspector.multitargetNetworkManager.setNetworkConditions(preset);
+ }
+
+ test.takeControl();
+ step1();
+
+ function step1()
+ {
+ testPreset(
+ WebInspector.NetworkConditionsSelector._presets[0],
+ ["offline event: online = false", "connection change event: type = none; downlinkMax = 0"],
+ step2);
+ }
+
+ function step2()
+ {
+ testPreset(
+ WebInspector.NetworkConditionsSelector._presets[2],
+ ["online event: online = true", "connection change event: type = cellular; downlinkMax = 0.244140625"],
+ step3);
+ }
+
+ function step3()
+ {
+ testPreset(
+ WebInspector.NetworkConditionsSelector._presets[8],
+ ["connection change event: type = wifi; downlinkMax = 30"],
+ test.releaseControl.bind(test));
+ }
+};
+
TestSuite.prototype.testScreenshotRecording = function()
{
var test = this;

Powered by Google App Engine
This is Rietveld 408576698