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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | content/test/data/media/getusermedia.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/json/json_reader.h" 6 #include "base/json/json_reader.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/test/trace_event_analyzer.h" 8 #include "base/test/trace_event_analyzer.h"
9 #include "base/trace_event/trace_event_impl.h" 9 #include "base/trace_event/trace_event_impl.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 647 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html")); 658 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
659 659
660 std::string constraints_1_1 = GenerateGetUserMediaCall( 660 std::string constraints_1_1 = GenerateGetUserMediaCall(
661 kGetUserMediaAndAnalyseAndStop, 320, 320, 320, 320, 10, 30); 661 kGetUserMediaAndAnalyseAndStop, 320, 320, 320, 320, 10, 30);
662 662
663 NavigateToURL(shell(), url); 663 NavigateToURL(shell(), url);
664 ASSERT_EQ("w=320:h=320", 664 ASSERT_EQ("w=320:h=320",
665 ExecuteJavascriptAndReturnResult(constraints_1_1)); 665 ExecuteJavascriptAndReturnResult(constraints_1_1));
666 } 666 }
667 667
668 // This test calls getUserMedia in an iframe and immediately close the iframe
669 // in the scope of the success callback.
670 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
671 AudioInIFrameAndCloseInSuccessCb) {
672 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
673
674 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
675 NavigateToURL(shell(), url);
676
677 std::string call =
678 "getUserMediaInIframeAndCloseInSuccessCb({audio: true});";
679 ExecuteJavascriptAndWaitForOk(call);
680 }
681
682 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
683 VideoInIFrameAndCloseInSuccessCb) {
684 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
685
686 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
687 NavigateToURL(shell(), url);
688
689 std::string call =
690 "getUserMediaInIframeAndCloseInSuccessCb({video: true});";
691 ExecuteJavascriptAndWaitForOk(call);
692 }
693
694 // This test calls getUserMedia in an iframe and immediately close the iframe
695 // in the scope of the failure callback.
696 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
697 VideoWithBadConstraintsInIFrameAndCloseInFailureCb) {
698 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
699
700 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
701
702 int large_value = 99999;
703 std::string call =
704 GenerateGetUserMediaCall("getUserMediaInIframeAndCloseInFailureCb",
705 large_value,
706 large_value,
707 large_value,
708 large_value,
709 large_value,
710 large_value);
711 NavigateToURL(shell(), url);
712
713 ExecuteJavascriptAndWaitForOk(call);
714 }
715
716 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaBrowserTest,
717 InvalidSourceIdInIFrameAndCloseInFailureCb) {
718 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
719
720 GURL url(embedded_test_server()->GetURL("/media/getusermedia.html"));
721
722 std::string call =
723 GenerateGetUserMediaWithMandatorySourceID(
724 "getUserMediaInIframeAndCloseInFailureCb", "invalid", "invalid");
725 NavigateToURL(shell(), url);
726
727 ExecuteJavascriptAndWaitForOk(call);
728 }
729
668 namespace { 730 namespace {
669 731
670 struct UserMediaSizes { 732 struct UserMediaSizes {
671 int min_width; 733 int min_width;
672 int max_width; 734 int max_width;
673 int min_height; 735 int min_height;
674 int max_height; 736 int max_height;
675 int min_frame_rate; 737 int min_frame_rate;
676 int max_frame_rate; 738 int max_frame_rate;
677 }; 739 };
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
720 {640, 640, 360, 360, 10, 30}, 782 {640, 640, 360, 360, 10, 30},
721 {640, 640, 480, 480, 10, 30}, 783 {640, 640, 480, 480, 10, 30},
722 {960, 960, 720, 720, 10, 30}, 784 {960, 960, 720, 720, 10, 30},
723 {1280, 1280, 720, 720, 10, 30}}; 785 {1280, 1280, 720, 720, 10, 30}};
724 786
725 INSTANTIATE_TEST_CASE_P(UserMedia, 787 INSTANTIATE_TEST_CASE_P(UserMedia,
726 WebRtcConstraintsBrowserTest, 788 WebRtcConstraintsBrowserTest,
727 testing::ValuesIn(kAllUserMediaSizes)); 789 testing::ValuesIn(kAllUserMediaSizes));
728 790
729 } // namespace content 791 } // namespace content
OLDNEW
« 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