Skip to content

Commit

Permalink
Call stopSampling on browser stop during android power testing. (#2176)
Browse files Browse the repository at this point in the history
* Call stopSampling on browser stop in android power testing.

* Add stopSampling call for chrome.
  • Loading branch information
gmierz committed Sep 4, 2024
1 parent 367a571 commit 9579377
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
8 changes: 6 additions & 2 deletions lib/chrome/webdriver/chromium.js
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,12 @@ export class Chromium {
await unlink(netlog);
}

if (this.android && this.options.androidPower) {
await this.android.stopPowerTesting();
if (this.android) {
if (this.options.androidPower) {
await this.android.stopPowerTesting();
} else if (this.options.androidUsbPower) {
await usbPowerProfiler.stopSampling();
}
}

if (this.cdpClient) {
Expand Down
8 changes: 6 additions & 2 deletions lib/firefox/webdriver/firefox.js
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,12 @@ export class Firefox {
* Before the browser is stopped/closed.
*/
async beforeBrowserStop() {
if (isAndroidConfigured(this.options) && this.options.androidPower) {
await this.android.stopPowerTesting();
if (isAndroidConfigured(this.options)) {
if (this.options.androidPower) {
await this.android.stopPowerTesting();
} else if (this.options.androidUsbPower) {
await usbPowerProfiler.stopSampling();
}
}
}

Expand Down

0 comments on commit 9579377

Please sign in to comment.