| <!DOCTYPE HTML> |
| <html> |
| <head> |
| <script src="../../resources/testharness.js"></script> |
| <script src="../../resources/testharnessreport.js"></script> |
| </head> |
| <body> |
| <script> |
| promise_test((test) => { |
| var isPageVisible = true; |
| if (window.testRunner) |
| testRunner.setUserMediaPermission(true); |
| return navigator.mediaDevices.getUserMedia({audio:false, video:true}).then((stream) => { |
| if (window.testRunner) |
| testRunner.setUserMediaPermission(false); |
| isPageVisible = false; |
| if (window.testRunner) |
| testRunner.setPageVisibility("hidden"); |
| setTimeout(() => { |
| isPageVisible = true; |
| if (window.testRunner) |
| testRunner.setPageVisibility(); |
| }, 1000); |
| return navigator.mediaDevices.getUserMedia({audio:false, video:true}); |
| }).then(() => { |
| assert_true(isPageVisible, "Resolving getUserMedia promise should wait for page to be visible"); |
| }); |
| }, "Testing same page getUserMedia grant persistency with visibility"); |
| </script> |
| </body> |
| </html> |