Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(694)

Unified Diff: content/browser/media/webrtc_getusermedia_browsertest.cc

Issue 1073783003: Add tests for closing a frame within the scope of a getusermedia callback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/test/data/media/getusermedia.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/media/webrtc_getusermedia_browsertest.cc
diff --git a/content/browser/media/webrtc_getusermedia_browsertest.cc b/content/browser/media/webrtc_getusermedia_browsertest.cc
index 185b56211745d965d3b15ebd3dd349b2b85276a0..d7bca4f9ea4e17b1d43094eb32cf07d8d25954ca 100644
--- a/content/browser/media/webrtc_getusermedia_browsertest.cc
+++ b/content/browser/media/webrtc_getusermedia_browsertest.cc
@@ -665,6 +665,68 @@ IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
ExecuteJavascriptAndReturnResult(constraints_1_1));
}
+// This test calls getUserMedia in an iframe and immediately close the iframe
+// in the scope of the success callback.
+IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
+ AudioInIFrameAndCloseInSuccessCb) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+
+ GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
+ NavigateToURL(shell(), url);
+
+ std::string call =
+ "getUserMediaInIframeAndCloseInSuccessCb({audio: true});";
+ ExecuteJavascriptAndWaitForOk(call);
+}
+
+IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
+ VideoInIFrameAndCloseInSuccessCb) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+
+ GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
+ NavigateToURL(shell(), url);
+
+ std::string call =
+ "getUserMediaInIframeAndCloseInSuccessCb({video: true});";
+ ExecuteJavascriptAndWaitForOk(call);
+}
+
+// This test calls getUserMedia in an iframe and immediately close the iframe
+// in the scope of the failure callback.
+IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
+ VideoWithBadConstraintsInIFrameAndCloseInFailureCb) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+
+ GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
+
+ int large_value = 99999;
+ std::string call =
+ GenerateGetUserMediaCall("getUserMediaInIframeAndCloseInFailureCb",
+ large_value,
+ large_value,
+ large_value,
+ large_value,
+ large_value,
+ large_value);
+ NavigateToURL(shell(), url);
+
+ ExecuteJavascriptAndWaitForOk(call);
+}
+
+IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
+ InvalidSourceIdInIFrameAndCloseInFailureCb) {
+ ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
+
+ GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
+
+ std::string call =
+ GenerateGetUserMediaWithMandatorySourceID(
+ "getUserMediaInIframeAndCloseInFailureCb", "invalid", "invalid");
+ NavigateToURL(shell(), url);
+
+ ExecuteJavascriptAndWaitForOk(call);
+}
+
namespace {
struct UserMediaSizes {
« no previous file with comments | « no previous file | content/test/data/media/getusermedia.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698