Commit 7a984aa0 authored by Paul Irish's avatar Paul Irish Committed by Commit Bot

DevTools: Allow auditing while remote debugging

http://crrev.com/497194 blocked auditing of extension pages and
remote debugging to avoid crashes. These crashes are gone, and users
are very interested in running Audits panel while remote debugging.

Bug: 734532, 931849
Change-Id: I8b6109062cadd1e76e02a7a235a0627af1b24d97
Reviewed-on: https://chromium-review.googlesource.com/c/1471112
Auto-Submit: Paul Irish <paulirish@chromium.org>
Commit-Queue: Paul Irish <paulirish@chromium.org>
Commit-Queue: Pavel Feldman <pfeldman@chromium.org>
Reviewed-by: default avatarPavel Feldman <pfeldman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#631927}
parent bb05897d
......@@ -101,12 +101,6 @@ Audits2.AuditController = class extends Common.Object {
'Navigate to a different page to start an audit.');
}
// Audits don't work on most undockable targets (extension popup pages, remote debugging, etc).
// However, the tests run in a content shell which is not dockable yet audits just fine,
// so disable this check when under test.
if (!Host.isUnderTest() && !Runtime.queryParam('can_dock'))
return Common.UIString('Can only audit tabs. Navigate to this page in a separate tab to start an audit.');
return null;
}
......
Tests that audits panel prevents run of unauditable pages.
**Prevents audit with no categories**
========== Audits2 Start Audit State ==========
......@@ -11,6 +13,8 @@ Tests that audits panel prevents run of unauditable pages.
[ ] Clear storage
Help text: At least one category must be selected.
Run audits: disabled visible
**Allows audit with a single category**
========== Audits2 Start Audit State ==========
......@@ -21,7 +25,9 @@ Run audits: disabled visible
[ ] SEO
[ ] Clear storage
Run audits: enabled visible
**Prevents audit on undockable page**
**Allows audit on undockable page**
========== Audits2 Start Audit State ==========
[x] Performance
......@@ -30,8 +36,9 @@ Run audits: enabled visible
[ ] Accessibility
[ ] SEO
[ ] Clear storage
Help text: Can only audit tabs. Navigate to this page in a separate tab to start an audit.
Run audits: disabled visible
Run audits: enabled visible
**Prevents audit on internal page**
URL: about:blank
......
......@@ -18,28 +18,24 @@
await TestRunner.loadModule('audits2_test_runner');
await TestRunner.showPanel('audits2');
TestRunner.addResult('**Prevents audit with no categories**');
TestRunner.addResult('\n\n**Prevents audit with no categories**');
Audits2TestRunner.openStartAudit();
var containerElement = Audits2TestRunner.getContainerElement();
var checkboxes = containerElement.querySelectorAll('.checkbox');
checkboxes.forEach(checkbox => checkbox.checkboxElement.click());
Audits2TestRunner.dumpStartAuditState();
TestRunner.addResult('**Allows audit with a single category**');
TestRunner.addResult('\n\n**Allows audit with a single category**');
checkboxes[0].checkboxElement.click();
Audits2TestRunner.dumpStartAuditState();
TestRunner.addResult('**Prevents audit on undockable page**');
// The content shell of the test runner is an undockable page that would normally always show the error
// Temporarily fool the audits panel into thinking we're not under test so the validation logic will be triggered.
Host.isUnderTest = () => false;
TestRunner.addResult('\n\n**Allows audit on undockable page**');
// Extension page and remote debugging previously caused crashes (crbug.com/734532)
// However, the crashes have been resolved, so these should now pass.
Audits2TestRunner.forcePageAuditabilityCheck();
Audits2TestRunner.dumpStartAuditState();
// Reset our test state
Host.isUnderTest = () => true;
Audits2TestRunner.forcePageAuditabilityCheck();
TestRunner.addResult('**Prevents audit on internal page**');
TestRunner.addResult('\n\n**Prevents audit on internal page**');
await navigateToAboutBlankAndWait();
TestRunner.addResult(`URL: ${TestRunner.mainTarget.inspectedURL()}`);
Audits2TestRunner.dumpStartAuditState();
......
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