| Index: chrome/browser/media/chrome_media_stream_infobar_browsertest.cc
|
| diff --git a/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc b/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc
|
| index 4c9dd5f09b3f6bbb1474cb25c17d151d8b0eb41c..07c4f0b083a2aecbf953feae8bfde65fbcf68521 100644
|
| --- a/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc
|
| +++ b/chrome/browser/media/chrome_media_stream_infobar_browsertest.cc
|
| @@ -152,7 +152,7 @@
|
| content::WebContents* tab_contents = LoadTestPageInTab();
|
|
|
| GetUserMediaAndAccept(tab_contents);
|
| - GetUserMediaAndDeny(tab_contents);
|
| + DenyRequest(tab_contents, content::MEDIA_DEVICE_PERMISSION_DENIED);
|
|
|
| // Should fail with permission denied right away with no infobar popping up.
|
| GetUserMedia(tab_contents, kAudioVideoCallConstraints);
|
| @@ -177,7 +177,56 @@
|
| // If accept were sticky the second call would hang because it hangs if an
|
| // infobar does not pop up.
|
| GetUserMediaAndAccept(tab_contents);
|
| - GetUserMediaAndAccept(tab_contents);
|
| +
|
| + // Because http request permissions are sticky per navigation, we need to
|
| + // navigate away from the current page in order to verify that the granted
|
| + // permissions are not permanently sticky.
|
| + ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(),
|
| + GURL("about:blank"), 1);
|
| +
|
| + // Now navigate back to our test page.
|
| + ui_test_utils::NavigateToURL(browser(), test_page_url());
|
| + tab_contents = browser()->tab_strip_model()->GetActiveWebContents();
|
| +
|
| + GetUserMediaAndAccept(tab_contents);
|
| +}
|
| +
|
| +// Test that accepting one getUserMedia request will not require a second
|
| +// prompt when issuing a second getUserMedia request.
|
| +IN_PROC_BROWSER_TEST_F(MediaStreamInfoBarTest,
|
| + TestAcceptIsStickyPerNavigation) {
|
| + content::WebContents* tab_contents = LoadTestPageInTab();
|
| +
|
| + GetUserMediaAndAccept(tab_contents);
|
| +
|
| + // Before issuing the second gUM request, make sure we first stop the tracks
|
| + // we started with the first request. If they're still running the permissions
|
| + // will be active for other reasons and we won't be testing the temporary
|
| + // stickiness properly.
|
| + EXPECT_TRUE(StopLocalStream(tab_contents));
|
| +
|
| + // Now no media tracks are running, so let's issue the second request.
|
| + GetUserMedia(tab_contents, kAudioVideoCallConstraints);
|
| +}
|
| +
|
| +IN_PROC_BROWSER_TEST_F(MediaStreamInfoBarTest,
|
| + TestTwoAcceptsPlusStickyPerNavigation) {
|
| + content::WebContents* tab_contents = LoadTestPageInTab();
|
| +
|
| + // First ask for audio only and approve.
|
| + GetUserMediaWithSpecificConstraintsAndAccept(tab_contents,
|
| + kAudioOnlyCallConstraints);
|
| + EXPECT_TRUE(StopLocalStream(tab_contents));
|
| +
|
| + // Next ask for video permissions.
|
| + // This will hang if the previous gUM call somehow gave video permissions.
|
| + GetUserMediaWithSpecificConstraintsAndAccept(tab_contents,
|
| + kVideoOnlyCallConstraints);
|
| + EXPECT_TRUE(StopLocalStream(tab_contents));
|
| +
|
| + // Now ask for both audio and video and expect the call to go through without
|
| + // showing any UI.
|
| + GetUserMedia(tab_contents, kAudioVideoCallConstraints);
|
| }
|
|
|
| IN_PROC_BROWSER_TEST_F(MediaStreamInfoBarTest, TestDismissIsNotSticky) {
|
|
|