| OLD | NEW |
| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/feature_list.h" | 8 #include "base/feature_list.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 return expect_value == controls.disable_local_echo; | 102 return expect_value == controls.disable_local_echo; |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace | 105 } // namespace |
| 106 | 106 |
| 107 namespace content { | 107 namespace content { |
| 108 | 108 |
| 109 class WebRtcGetUserMediaBrowserTest : public WebRtcContentBrowserTestBase { | 109 class WebRtcGetUserMediaBrowserTest : public WebRtcContentBrowserTestBase { |
| 110 public: | 110 public: |
| 111 WebRtcGetUserMediaBrowserTest() : trace_log_(NULL) { | 111 WebRtcGetUserMediaBrowserTest() : trace_log_(NULL) { |
| 112 scoped_feature_list_.InitWithFeatures( | 112 scoped_feature_list_.InitAndDisableFeature( |
| 113 {}, {features::kMediaStreamOldVideoConstraints, | 113 features::kMediaStreamOldAudioConstraints); |
| 114 features::kMediaStreamOldAudioConstraints}); | |
| 115 // Automatically grant device permission. | 114 // Automatically grant device permission. |
| 116 AppendUseFakeUIForMediaStreamFlag(); | 115 AppendUseFakeUIForMediaStreamFlag(); |
| 117 } | 116 } |
| 118 ~WebRtcGetUserMediaBrowserTest() override {} | 117 ~WebRtcGetUserMediaBrowserTest() override {} |
| 119 | 118 |
| 120 void StartTracing() { | 119 void StartTracing() { |
| 121 CHECK(trace_log_ == NULL) << "Can only can start tracing once"; | 120 CHECK(trace_log_ == NULL) << "Can only can start tracing once"; |
| 122 trace_log_ = base::trace_event::TraceLog::GetInstance(); | 121 trace_log_ = base::trace_event::TraceLog::GetInstance(); |
| 123 base::trace_event::TraceConfig trace_config( | 122 base::trace_event::TraceConfig trace_config( |
| 124 "video", base::trace_event::RECORD_UNTIL_FULL); | 123 "video", base::trace_event::RECORD_UNTIL_FULL); |
| (...skipping 674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 799 | 798 |
| 800 manager->SetGenerateStreamCallbackForTesting( | 799 manager->SetGenerateStreamCallbackForTesting( |
| 801 MediaStreamManager::GenerateStreamTestCallback()); | 800 MediaStreamManager::GenerateStreamTestCallback()); |
| 802 } | 801 } |
| 803 | 802 |
| 804 // TODO(guidou): Remove this test. http://crbug.com/706408 | 803 // TODO(guidou): Remove this test. http://crbug.com/706408 |
| 805 class WebRtcGetUserMediaOldConstraintsBrowserTest | 804 class WebRtcGetUserMediaOldConstraintsBrowserTest |
| 806 : public WebRtcContentBrowserTestBase { | 805 : public WebRtcContentBrowserTestBase { |
| 807 public: | 806 public: |
| 808 WebRtcGetUserMediaOldConstraintsBrowserTest() : trace_log_(NULL) { | 807 WebRtcGetUserMediaOldConstraintsBrowserTest() : trace_log_(NULL) { |
| 809 scoped_feature_list_.InitWithFeatures( | 808 scoped_feature_list_.InitAndEnableFeature( |
| 810 {features::kMediaStreamOldVideoConstraints, | 809 features::kMediaStreamOldAudioConstraints); |
| 811 features::kMediaStreamOldAudioConstraints}, | |
| 812 {}); | |
| 813 // Automatically grant device permission. | 810 // Automatically grant device permission. |
| 814 AppendUseFakeUIForMediaStreamFlag(); | 811 AppendUseFakeUIForMediaStreamFlag(); |
| 815 } | 812 } |
| 816 ~WebRtcGetUserMediaOldConstraintsBrowserTest() override {} | 813 ~WebRtcGetUserMediaOldConstraintsBrowserTest() override {} |
| 817 | 814 |
| 818 void StartTracing() { | 815 void StartTracing() { |
| 819 CHECK(trace_log_ == NULL) << "Can only can start tracing once"; | 816 CHECK(trace_log_ == NULL) << "Can only can start tracing once"; |
| 820 trace_log_ = base::trace_event::TraceLog::GetInstance(); | 817 trace_log_ = base::trace_event::TraceLog::GetInstance(); |
| 821 base::trace_event::TraceConfig trace_config( | 818 base::trace_event::TraceConfig trace_config( |
| 822 "video", base::trace_event::RECORD_UNTIL_FULL); | 819 "video", base::trace_event::RECORD_UNTIL_FULL); |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1186 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest, | 1183 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest, |
| 1187 TwoGetUserMediaWithEqualConstraints) { | 1184 TwoGetUserMediaWithEqualConstraints) { |
| 1188 std::string constraints1 = "{video: true, audio: true}"; | 1185 std::string constraints1 = "{video: true, audio: true}"; |
| 1189 const std::string& constraints2 = constraints1; | 1186 const std::string& constraints2 = constraints1; |
| 1190 std::string expected_result = "w=640:h=480-w=640:h=480"; | 1187 std::string expected_result = "w=640:h=480-w=640:h=480"; |
| 1191 | 1188 |
| 1192 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, | 1189 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, |
| 1193 expected_result); | 1190 expected_result); |
| 1194 } | 1191 } |
| 1195 | 1192 |
| 1196 // TODO(guidou): Remove this test. http://crbug.com/706408 | |
| 1197 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest, | |
| 1198 TwoGetUserMediaWithSecondVideoCropped) { | |
| 1199 std::string constraints1 = "{video: true}"; | |
| 1200 std::string constraints2 = "{video: {mandatory: {maxHeight: 360}}}"; | |
| 1201 std::string expected_result = "w=640:h=480-w=640:h=360"; | |
| 1202 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, | |
| 1203 expected_result); | |
| 1204 } | |
| 1205 | |
| 1206 // Test fails under MSan, http://crbug.com/445745 | |
| 1207 // TODO(guidou): Remove this test. http://crbug.com/706408 | |
| 1208 #if defined(MEMORY_SANITIZER) | |
| 1209 #define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \ | |
| 1210 DISABLED_TwoGetUserMediaWithFirstHdSecondVga | |
| 1211 #else | |
| 1212 #define MAYBE_TwoGetUserMediaWithFirstHdSecondVga \ | |
| 1213 TwoGetUserMediaWithFirstHdSecondVga | |
| 1214 #endif | |
| 1215 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest, | |
| 1216 MAYBE_TwoGetUserMediaWithFirstHdSecondVga) { | |
| 1217 std::string constraints1 = | |
| 1218 "{video: {mandatory: {maxWidth:1280 , minWidth:1280 , maxHeight: 720, " | |
| 1219 "minHeight: 720}}}"; | |
| 1220 std::string constraints2 = | |
| 1221 "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}"; | |
| 1222 std::string expected_result = "w=1280:h=720-w=640:h=480"; | |
| 1223 RunTwoGetTwoGetUserMediaWithDifferentContraints(constraints1, constraints2, | |
| 1224 expected_result); | |
| 1225 } | |
| 1226 | |
| 1227 // Timing out on Windows 7 bot: http://crbug.com/443294 | 1193 // Timing out on Windows 7 bot: http://crbug.com/443294 |
| 1228 // Flaky: http://crbug.com/660656; possible the test is too perf sensitive. | 1194 // Flaky: http://crbug.com/660656; possible the test is too perf sensitive. |
| 1229 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest, | 1195 IN_PROC_BROWSER_TEST_F(WebRtcGetUserMediaOldConstraintsBrowserTest, |
| 1230 DISABLED_TwoGetUserMediaWithFirst1080pSecondVga) { | 1196 DISABLED_TwoGetUserMediaWithFirst1080pSecondVga) { |
| 1231 std::string constraints1 = | 1197 std::string constraints1 = |
| 1232 "{video: {mandatory: {maxWidth:1920 , minWidth:1920 , maxHeight: 1080, " | 1198 "{video: {mandatory: {maxWidth:1920 , minWidth:1920 , maxHeight: 1080, " |
| 1233 "minHeight: 1080}}}"; | 1199 "minHeight: 1080}}}"; |
| 1234 std::string constraints2 = | 1200 std::string constraints2 = |
| 1235 "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}"; | 1201 "{video: {mandatory: {maxWidth:640 , maxHeight: 480}}}"; |
| 1236 std::string expected_result = "w=1920:h=1080-w=640:h=480"; | 1202 std::string expected_result = "w=1920:h=1080-w=640:h=480"; |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1509 "failTestAfterTimeout('Got no unmute event', 1500);")); | 1475 "failTestAfterTimeout('Got no unmute event', 1500);")); |
| 1510 | 1476 |
| 1511 // Mute | 1477 // Mute |
| 1512 media::FakeAudioInputStream::SetGlobalMutedState(true); | 1478 media::FakeAudioInputStream::SetGlobalMutedState(true); |
| 1513 EXPECT_EQ("onmute: muted=true, readyState=live", | 1479 EXPECT_EQ("onmute: muted=true, readyState=live", |
| 1514 ExecuteJavascriptAndReturnResult( | 1480 ExecuteJavascriptAndReturnResult( |
| 1515 "failTestAfterTimeout('Got no mute event', 1500);")); | 1481 "failTestAfterTimeout('Got no mute event', 1500);")); |
| 1516 } | 1482 } |
| 1517 | 1483 |
| 1518 } // namespace content | 1484 } // namespace content |
| OLD | NEW |