Skip to content

Commit

Permalink
Bug 1528042 - Test correct device list order in enumerateDevices(). r…
Browse files Browse the repository at this point in the history
…=karlt

Differential Revision: https://phabricator.services.mozilla.com/D155430

UltraBlame original commit: 6c8c76da9ab72b9901733e6475496c83fea9988c
  • Loading branch information
marco-c committed May 31, 2023
1 parent db5474c commit 82e9848
Showing 1 changed file with 172 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,106 @@
"
)
;
assert_equals
(
devices
.
filter
(
(
{
kind
}
)
=
>
kind
=
=
"
audiooutput
"
)
.
length
0
"
there
should
be
no
audio
output
devices
.
"
)
;
assert_less_than_equal
(
devices
.
length
2
"
there
should
be
no
more
than
two
devices
.
"
)
;
if
(
devices
.
length
>
1
)
{
assert_equals
(
devices
[
0
]
.
kind
"
audioinput
"
"
audioinput
is
first
"
)
;
assert_equals
(
devices
[
1
]
.
kind
"
videoinput
"
"
videoinput
is
second
"
)
;
}
}
"
mediaDevices
Expand Down Expand Up @@ -798,7 +898,7 @@
)
;
const
kinds
order
=
[
"
Expand Down Expand Up @@ -826,7 +926,7 @@
assert_in_array
(
kind
kinds
order
"
expected
kind
Expand Down Expand Up @@ -904,6 +1004,76 @@
;
}
}
const
kinds
=
devices
.
map
(
(
{
kind
}
)
=
>
kind
)
;
const
correct
=
[
.
.
.
kinds
]
.
sort
(
(
a
b
)
=
>
order
.
indexOf
(
a
)
-
order
.
indexOf
(
b
)
)
;
assert_equals
(
JSON
.
stringify
(
kinds
)
JSON
.
stringify
(
correct
)
"
correct
order
"
)
;
}
"
mediaDevices
Expand Down

0 comments on commit 82e9848

Please sign in to comment.