summaryrefslogtreecommitdiffstats
path: root/nixos/tests/chromium.nix
diff options
context:
space:
mode:
authorMichael Weiss <dev.primeos@gmail.com>2021-01-23 12:06:09 +0100
committerMichael Weiss <dev.primeos@gmail.com>2021-01-23 12:15:56 +0100
commit86897c8f633f38c9169e130e35fd9322aec6b329 (patch)
treef55f587b35325b7e5777faf48def45fe23489745 /nixos/tests/chromium.nix
parenta6f6f739c865727a967ec1cbe2055bdff119d1e6 (diff)
nixos/tests/chromium: Fix another potential race condition
The create_new_win() function could open multiple windows when used incorrectly. This change makes sure that a new window will only be created if the main window could be selected successfully. This also ignores the out return values as they're never used.
Diffstat (limited to 'nixos/tests/chromium.nix')
-rw-r--r--nixos/tests/chromium.nix19
1 files changed, 10 insertions, 9 deletions
diff --git a/nixos/tests/chromium.nix b/nixos/tests/chromium.nix
index 4d6b726d9e4c..43a99fda5c50 100644
--- a/nixos/tests/chromium.nix
+++ b/nixos/tests/chromium.nix
@@ -77,7 +77,7 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
def create_new_win():
with machine.nested("Creating a new Chromium window"):
- machine.execute(
+ status, _ = machine.execute(
ru(
"${xdo "new-window" ''
search --onlyvisible --name "startup done"
@@ -86,13 +86,14 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
''}"
)
)
- machine.execute(
- ru(
- "${xdo "new-window" ''
- key Ctrl+n
- ''}"
+ if status == 0:
+ machine.execute(
+ ru(
+ "${xdo "new-window" ''
+ key Ctrl+n
+ ''}"
+ )
)
- )
def close_win():
@@ -115,7 +116,7 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
)
)
for _ in range(1, 20):
- status, out = machine.execute(
+ status, _ = machine.execute(
ru(
"${xdo "wait-for-close" ''
search --onlyvisible --name "new tab"
@@ -134,7 +135,7 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
ret = False
with machine.nested("Waiting for new Chromium window to appear"):
for _ in range(1, 20):
- status, out = machine.execute(
+ status, _ = machine.execute(
ru(
"${xdo "wait-for-window" ''
search --onlyvisible --name "new tab"