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 - Migrate remaining chrome tests to devtools browser test…
…s; r=julienw Differential Revision: https://phabricator.services.mozilla.com/D65153 --HG-- extra : moz-landing-system : lando
- Loading branch information
Showing
15 changed files
with
261 additions
and
530 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
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
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
47 changes: 47 additions & 0 deletions
47
devtools/client/performance-new/test/browser/browser_devtools-interrupted.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 what happens when a recording is interrupted by another tool."); | ||
|
||
const { | ||
revertRecordingPreferences, | ||
stopProfiler: stopProfilerByAnotherTool, | ||
} = ChromeUtils.import( | ||
"resource://devtools/client/performance-new/popup/background.jsm.js" | ||
); | ||
|
||
await withDevToolsPanel(async document => { | ||
const getRecordingState = setupGetRecordingState(document); | ||
|
||
const startRecording = await getActiveButtonFromText( | ||
document, | ||
"Start recording" | ||
); | ||
info("Click to start recording"); | ||
startRecording.click(); | ||
|
||
info("Wait until the profiler UI has updated to show that it is ready."); | ||
await getActiveButtonFromText(document, "Capture recording"); | ||
|
||
info("Stop the profiler by another tool."); | ||
|
||
stopProfilerByAnotherTool(); | ||
|
||
info("Check that the user was notified of this interruption."); | ||
await getElementFromDocumentByText( | ||
document, | ||
"The recording was stopped by another tool." | ||
); | ||
|
||
is( | ||
getRecordingState(), | ||
"available-to-record", | ||
"The client is ready to record again, even though it was interrupted." | ||
); | ||
}); | ||
|
||
revertRecordingPreferences(); | ||
}); |
58 changes: 58 additions & 0 deletions
58
devtools/client/performance-new/test/browser/browser_devtools-previously-started.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,58 @@ | ||
/* 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 what happens if the profiler was previously started by another tool." | ||
); | ||
|
||
const { revertRecordingPreferences, startProfiler } = ChromeUtils.import( | ||
"resource://devtools/client/performance-new/popup/background.jsm.js" | ||
); | ||
|
||
info("Start the profiler before DevTools is loaded."); | ||
startProfiler("aboutprofiling"); | ||
|
||
await withDevToolsPanel(async document => { | ||
const getRecordingState = setupGetRecordingState(document); | ||
|
||
is( | ||
getRecordingState(), | ||
"not-yet-known", | ||
"The component starts out in an unknown state." | ||
); | ||
|
||
const cancelRecording = await getActiveButtonFromText( | ||
document, | ||
"Cancel recording" | ||
); | ||
|
||
is( | ||
getRecordingState(), | ||
"recording", | ||
"The profiler is reflecting the recording state." | ||
); | ||
|
||
info("Click the button to cancel the recording"); | ||
cancelRecording.click(); | ||
|
||
is( | ||
getRecordingState(), | ||
"request-to-stop-profiler", | ||
"We can request to stop the profiler." | ||
); | ||
|
||
await getActiveButtonFromText(document, "Start recording"); | ||
|
||
is( | ||
getRecordingState(), | ||
"available-to-record", | ||
"The profiler is now available to record." | ||
); | ||
}); | ||
|
||
revertRecordingPreferences(); | ||
}); |
63 changes: 63 additions & 0 deletions
63
devtools/client/performance-new/test/browser/browser_devtools-private-window.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,63 @@ | ||
/* 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 opening a private browsing window while the profiler is active."); | ||
|
||
const { revertRecordingPreferences } = ChromeUtils.import( | ||
"resource://devtools/client/performance-new/popup/background.jsm.js" | ||
); | ||
|
||
await withDevToolsPanel(async document => { | ||
const getRecordingState = setupGetRecordingState(document); | ||
|
||
const startRecording = await getActiveButtonFromText( | ||
document, | ||
"Start recording" | ||
); | ||
|
||
ok(!startRecording.disabled, "The start recording button is not disabled."); | ||
is( | ||
getRecordingState(), | ||
"available-to-record", | ||
"The panel is available to record." | ||
); | ||
|
||
const privateWindow = await BrowserTestUtils.openNewBrowserWindow({ | ||
private: true, | ||
}); | ||
|
||
await getElementFromDocumentByText( | ||
document, | ||
"The profiler is disabled when Private Browsing is enabled" | ||
); | ||
|
||
ok( | ||
startRecording.disabled, | ||
"The start recording button is disabled when a private browsing window is open." | ||
); | ||
|
||
is( | ||
getRecordingState(), | ||
"locked-by-private-browsing", | ||
"The client knows about the private window." | ||
); | ||
|
||
info("Closing the private window"); | ||
await BrowserTestUtils.closeWindow(privateWindow); | ||
|
||
info("Finally wait for the start recording button to become active again."); | ||
await getActiveButtonFromText(document, "Start recording"); | ||
|
||
is( | ||
getRecordingState(), | ||
"available-to-record", | ||
"The panel is available to record again." | ||
); | ||
}); | ||
|
||
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
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.