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.
This commit is contained in:
parent
a6f6f739c8
commit
86897c8f63
@ -77,7 +77,7 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
|
|||||||
|
|
||||||
def create_new_win():
|
def create_new_win():
|
||||||
with machine.nested("Creating a new Chromium window"):
|
with machine.nested("Creating a new Chromium window"):
|
||||||
machine.execute(
|
status, _ = machine.execute(
|
||||||
ru(
|
ru(
|
||||||
"${xdo "new-window" ''
|
"${xdo "new-window" ''
|
||||||
search --onlyvisible --name "startup done"
|
search --onlyvisible --name "startup done"
|
||||||
@ -86,6 +86,7 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
|
|||||||
''}"
|
''}"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
if status == 0:
|
||||||
machine.execute(
|
machine.execute(
|
||||||
ru(
|
ru(
|
||||||
"${xdo "new-window" ''
|
"${xdo "new-window" ''
|
||||||
@ -115,7 +116,7 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
|
|||||||
)
|
)
|
||||||
)
|
)
|
||||||
for _ in range(1, 20):
|
for _ in range(1, 20):
|
||||||
status, out = machine.execute(
|
status, _ = machine.execute(
|
||||||
ru(
|
ru(
|
||||||
"${xdo "wait-for-close" ''
|
"${xdo "wait-for-close" ''
|
||||||
search --onlyvisible --name "new tab"
|
search --onlyvisible --name "new tab"
|
||||||
@ -134,7 +135,7 @@ mapAttrs (channel: chromiumPkg: makeTest rec {
|
|||||||
ret = False
|
ret = False
|
||||||
with machine.nested("Waiting for new Chromium window to appear"):
|
with machine.nested("Waiting for new Chromium window to appear"):
|
||||||
for _ in range(1, 20):
|
for _ in range(1, 20):
|
||||||
status, out = machine.execute(
|
status, _ = machine.execute(
|
||||||
ru(
|
ru(
|
||||||
"${xdo "wait-for-window" ''
|
"${xdo "wait-for-window" ''
|
||||||
search --onlyvisible --name "new tab"
|
search --onlyvisible --name "new tab"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user