Commit b1da81df authored by Joey Arhar's avatar Joey Arhar Committed by Commit Bot

[DevTools] Fix network panel for service workers

Bug: 863846
Change-Id: I391a15458f540165e78b86a306a782254d317727
Reviewed-on: https://chromium-review.googlesource.com/c/1306593Reviewed-by: default avatarDmitry Gozman <dgozman@chromium.org>
Commit-Queue: Joey Arhar <jarhar@chromium.org>
Cr-Commit-Position: refs/heads/master@{#604048}
parent 24e83391
......@@ -1844,6 +1844,19 @@ IN_PROC_BROWSER_TEST_F(WorkerDevToolsSanityTest,
CloseDevToolsWindow();
}
IN_PROC_BROWSER_TEST_F(WorkerDevToolsSanityTest,
InspectSharedWorkerNetworkPanel) {
ASSERT_TRUE(spawned_test_server()->Start());
GURL url = spawned_test_server()->GetURL(kSharedWorkerTestPage);
ui_test_utils::NavigateToURL(browser(), url);
scoped_refptr<DevToolsAgentHost> host =
WaitForFirstSharedWorker(kSharedWorkerTestWorker);
OpenDevToolsWindow(host);
RunTestFunction(window_, "testSharedWorkerNetworkPanel");
CloseDevToolsWindow();
}
class DevToolsAgentHostTest : public InProcessBrowserTest {};
// Tests DevToolsAgentHost retention by its target.
......
......@@ -591,6 +591,15 @@
}
};
TestSuite.prototype.testSharedWorkerNetworkPanel = function() {
this.takeControl();
this.showPanel('network').then(() => {
if (!document.querySelector('#network-container'))
this.fail('unable to find #network-container');
this.releaseControl();
});
};
TestSuite.prototype.enableTouchEmulation = function() {
const deviceModeModel = new Emulation.DeviceModeModel(function() {});
deviceModeModel._target = SDK.targetManager.mainTarget();
......
......@@ -592,20 +592,31 @@ Network.NetworkLogView = class extends UI.VBox {
this._hideRecordingHint();
this._recordingHint = this.element.createChild('div', 'network-status-pane fill');
const hintText = this._recordingHint.createChild('div', 'recording-hint');
const reloadShortcutNode = this._recordingHint.createChild('b');
reloadShortcutNode.textContent = UI.shortcutRegistry.shortcutDescriptorsForAction('inspector_main.reload')[0].name;
let reloadShortcutNode = null;
const reloadShortcutDescriptor = UI.shortcutRegistry.shortcutDescriptorsForAction('inspector_main.reload')[0];
if (reloadShortcutDescriptor) {
reloadShortcutNode = this._recordingHint.createChild('b');
reloadShortcutNode.textContent = reloadShortcutDescriptor.name;
}
if (this._recording) {
const recordingText = hintText.createChild('span');
recordingText.textContent = Common.UIString('Recording network activity\u2026');
hintText.createChild('br');
hintText.appendChild(
UI.formatLocalized('Perform a request or hit %s to record the reload.', [reloadShortcutNode]));
if (reloadShortcutNode) {
hintText.createChild('br');
hintText.appendChild(
UI.formatLocalized('Perform a request or hit %s to record the reload.', [reloadShortcutNode]));
}
} else {
const recordNode = hintText.createChild('b');
recordNode.textContent = UI.shortcutRegistry.shortcutTitleForAction('network.toggle-recording');
hintText.appendChild(UI.formatLocalized(
'Record (%s) or reload (%s) to display network activity.', [recordNode, reloadShortcutNode]));
if (reloadShortcutNode) {
hintText.appendChild(UI.formatLocalized(
'Record (%s) or reload (%s) to display network activity.', [recordNode, reloadShortcutNode]));
} else {
hintText.appendChild(UI.formatLocalized('Record (%s) to display network activity.', [recordNode]));
}
}
}
......
......@@ -368,10 +368,13 @@ Network.NetworkPanel = class extends UI.Panel {
}
_resetFilmStripView() {
const reloadShortcutDescriptor = UI.shortcutRegistry.shortcutDescriptorsForAction('inspector_main.reload')[0];
this._filmStripView.reset();
this._filmStripView.setStatusText(Common.UIString(
'Hit %s to reload and capture filmstrip.',
UI.shortcutRegistry.shortcutDescriptorsForAction('inspector_main.reload')[0].name));
if (reloadShortcutDescriptor) {
this._filmStripView.setStatusText(
Common.UIString('Hit %s to reload and capture filmstrip.', reloadShortcutDescriptor.name));
}
}
/**
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment