forked from mozilla/gecko-dev
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bug 1611817 - Add mochitests for the performance-new panel in DevTool…
…s; r=julienw Note that this patch also updates the setReactFriendlyInputValue function in head.js, as it was not working for selects. Differential Revision: https://phabricator.services.mozilla.com/D65151 --HG-- extra : moz-landing-system : lando
- Loading branch information
Showing
6 changed files
with
266 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
devtools/client/performance-new/test/browser/browser_devtools-presets.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
"use strict"; | ||
|
||
add_task(async function test() { | ||
info("Test that about:profiling presets configure the profiler"); | ||
|
||
if (!Services.profiler.GetFeatures().includes("stackwalk")) { | ||
ok(true, "This platform does not support stackwalking, skip this test."); | ||
return; | ||
} | ||
|
||
await withDevToolsPanel(async document => { | ||
{ | ||
const presets = await getNearestInputFromText(document, "Settings"); | ||
|
||
is(presets.value, "web-developer", "The presets default to webdev mode."); | ||
ok( | ||
!(await devToolsActiveConfigurationHasFeature(document, "stackwalk")), | ||
"Stack walking is not used in Web Developer mode." | ||
); | ||
} | ||
|
||
{ | ||
const presets = await getNearestInputFromText(document, "Settings"); | ||
setReactFriendlyInputValue(presets, "firefox-platform"); | ||
is( | ||
presets.value, | ||
"firefox-platform", | ||
"The preset was changed to Firefox Platform" | ||
); | ||
ok( | ||
await devToolsActiveConfigurationHasFeature(document, "stackwalk"), | ||
"Stack walking is used in Firefox Platform mode." | ||
); | ||
} | ||
}); | ||
|
||
const { revertRecordingPreferences } = ChromeUtils.import( | ||
"resource://devtools/client/performance-new/popup/background.jsm.js" | ||
); | ||
|
||
revertRecordingPreferences(); | ||
}); |
47 changes: 47 additions & 0 deletions
47
devtools/client/performance-new/test/browser/browser_devtools-record-capture.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
"use strict"; | ||
|
||
add_task(async function test() { | ||
info("Test that DevTools can capture profiles."); | ||
|
||
await setProfilerFrontendUrl( | ||
"http://example.com/browser/devtools/client/performance-new/test/browser/fake-frontend.html" | ||
); | ||
|
||
await withDevToolsPanel(async document => { | ||
{ | ||
const button = await getActiveButtonFromText(document, "Start recording"); | ||
info("Click the button to start recording"); | ||
button.click(); | ||
} | ||
|
||
{ | ||
const button = await getActiveButtonFromText( | ||
document, | ||
"Capture recording" | ||
); | ||
info("Click the button to capture the recording."); | ||
button.click(); | ||
} | ||
|
||
info( | ||
"If the DevTools successfully injects a profile into the page, then the " + | ||
"fake frontend will rename the title of the page." | ||
); | ||
|
||
await checkTabLoadedProfile({ | ||
initialTitle: "Waiting on the profile", | ||
successTitle: "Profile received", | ||
errorTitle: "Error", | ||
}); | ||
}); | ||
|
||
const { revertRecordingPreferences } = ChromeUtils.import( | ||
"resource://devtools/client/performance-new/popup/background.jsm.js" | ||
); | ||
|
||
revertRecordingPreferences(); | ||
}); |
41 changes: 41 additions & 0 deletions
41
devtools/client/performance-new/test/browser/browser_devtools-record-discard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this | ||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
"use strict"; | ||
|
||
add_task(async function test() { | ||
info("Test that DevTools can capture profiles."); | ||
|
||
await setProfilerFrontendUrl( | ||
"http://example.com/browser/devtools/client/performance-new/test/browser/fake-frontend.html" | ||
); | ||
|
||
await withDevToolsPanel(async document => { | ||
{ | ||
const button = await getActiveButtonFromText(document, "Start recording"); | ||
info("Click the button to start recording"); | ||
button.click(); | ||
} | ||
|
||
{ | ||
const button = await getActiveButtonFromText( | ||
document, | ||
"Cancel recording" | ||
); | ||
info("Click the button to discard to profile."); | ||
button.click(); | ||
} | ||
|
||
{ | ||
const button = await getActiveButtonFromText(document, "Start recording"); | ||
ok(Boolean(button), "The start recording button is available again."); | ||
} | ||
}); | ||
|
||
const { revertRecordingPreferences } = ChromeUtils.import( | ||
"resource://devtools/client/performance-new/popup/background.jsm.js" | ||
); | ||
|
||
revertRecordingPreferences(); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters