| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/files/file_enumerator.h" | 6 #include "base/files/file_enumerator.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/process/launch.h" | 8 #include "base/process/launch.h" |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| 11 #include "build/build_config.h" | 11 #include "build/build_config.h" |
| 12 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/infobars/infobar_responder.h" | 13 #include "chrome/browser/infobars/infobar_responder.h" |
| 14 #include "chrome/browser/infobars/infobar_service.h" | 14 #include "chrome/browser/infobars/infobar_service.h" |
| 15 #include "chrome/browser/media/webrtc_browsertest_base.h" | 15 #include "chrome/browser/media/webrtc_browsertest_base.h" |
| 16 #include "chrome/browser/media/webrtc_browsertest_common.h" | 16 #include "chrome/browser/media/webrtc_browsertest_common.h" |
| 17 #include "chrome/browser/ui/browser.h" | 17 #include "chrome/browser/ui/browser.h" |
| 18 #include "chrome/browser/ui/browser_tabstrip.h" | 18 #include "chrome/browser/ui/browser_tabstrip.h" |
| 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 19 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 20 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" | 20 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h" |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/test/base/ui_test_utils.h" | 22 #include "chrome/test/base/ui_test_utils.h" |
| 23 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
| 24 #include "content/public/common/feature_h264_with_openh264_ffmpeg.h" |
| 25 #include "content/public/common/features.h" |
| 24 #include "content/public/test/browser_test_utils.h" | 26 #include "content/public/test/browser_test_utils.h" |
| 25 #include "media/base/media_switches.h" | 27 #include "media/base/media_switches.h" |
| 26 #include "net/test/python_utils.h" | 28 #include "net/test/python_utils.h" |
| 27 #include "ui/gl/gl_switches.h" | 29 #include "ui/gl/gl_switches.h" |
| 28 | 30 |
| 29 const char kTitlePageOfAppEngineAdminPage[] = "Instances"; | 31 const char kTitlePageOfAppEngineAdminPage[] = "Instances"; |
| 30 | 32 |
| 31 const char kIsApprtcCallUpJavascript[] = | 33 const char kIsApprtcCallUpJavascript[] = |
| 32 "var remoteVideo = document.querySelector('#remote-video');" | 34 "var remoteVideo = document.querySelector('#remote-video');" |
| 33 "var remoteVideoActive =" | 35 "var remoteVideoActive =" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 218 |
| 217 base::CommandLine command_line(firefox_launcher); | 219 base::CommandLine command_line(firefox_launcher); |
| 218 command_line.AppendSwitchPath("--binary", firefox_binary); | 220 command_line.AppendSwitchPath("--binary", firefox_binary); |
| 219 command_line.AppendSwitchASCII("--webpage", url.spec()); | 221 command_line.AppendSwitchASCII("--webpage", url.spec()); |
| 220 | 222 |
| 221 DVLOG(1) << "Running " << command_line.GetCommandLineString(); | 223 DVLOG(1) << "Running " << command_line.GetCommandLineString(); |
| 222 firefox_ = base::LaunchProcess(command_line, base::LaunchOptions()); | 224 firefox_ = base::LaunchProcess(command_line, base::LaunchOptions()); |
| 223 return firefox_.IsValid(); | 225 return firefox_.IsValid(); |
| 224 } | 226 } |
| 225 | 227 |
| 228 void FirefoxApprtcInteropTest(const char* codec) { |
| 229 DetectErrorsInJavaScript(); |
| 230 ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost("9999")); |
| 231 ASSERT_TRUE(LaunchColliderOnLocalHost("http://localhost:9999", "8089")); |
| 232 while (!LocalApprtcInstanceIsUp()) |
| 233 DVLOG(1) << "Waiting for AppRTC to come up..."; |
| 234 |
| 235 GURL room_url = GURL( |
| 236 base::StringPrintf("http://localhost:9999/r/some_room" |
| 237 "?wshpp=localhost:8089&wstls=false" |
| 238 "&firefox_fake_device=1&vsc=%s&vrc=%s", |
| 239 codec, codec).c_str()); |
| 240 |
| 241 chrome::AddTabAt(browser(), GURL(), -1, true); |
| 242 content::WebContents* chrome_tab = |
| 243 browser()->tab_strip_model()->GetActiveWebContents(); |
| 244 PermissionBubbleManager::FromWebContents(chrome_tab) |
| 245 ->set_auto_response_for_test(PermissionBubbleManager::ACCEPT_ALL); |
| 246 InfoBarResponder infobar_responder( |
| 247 InfoBarService::FromWebContents(chrome_tab), InfoBarResponder::ACCEPT); |
| 248 ui_test_utils::NavigateToURL(browser(), room_url); |
| 249 |
| 250 ASSERT_TRUE(LaunchFirefoxWithUrl(room_url)); |
| 251 |
| 252 ASSERT_TRUE(WaitForCallToComeUp(chrome_tab)); |
| 253 |
| 254 // Ensure Firefox manages to send video our way. |
| 255 ASSERT_TRUE(DetectRemoteVideoPlaying(chrome_tab)); |
| 256 } |
| 257 |
| 226 private: | 258 private: |
| 227 base::Process dev_appserver_; | 259 base::Process dev_appserver_; |
| 228 base::Process firefox_; | 260 base::Process firefox_; |
| 229 base::Process collider_server_; | 261 base::Process collider_server_; |
| 230 }; | 262 }; |
| 231 | 263 |
| 232 IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest, MANUAL_WorksOnApprtc) { | 264 IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest, MANUAL_WorksOnApprtc) { |
| 233 DetectErrorsInJavaScript(); | 265 DetectErrorsInJavaScript(); |
| 234 ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost("9999")); | 266 ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost("9999")); |
| 235 ASSERT_TRUE(LaunchColliderOnLocalHost("http://localhost:9999", "8089")); | 267 ASSERT_TRUE(LaunchColliderOnLocalHost("http://localhost:9999", "8089")); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 263 ASSERT_TRUE(WaitForCallToComeUp(right_tab)); | 295 ASSERT_TRUE(WaitForCallToComeUp(right_tab)); |
| 264 | 296 |
| 265 ASSERT_TRUE(DetectRemoteVideoPlaying(left_tab)); | 297 ASSERT_TRUE(DetectRemoteVideoPlaying(left_tab)); |
| 266 ASSERT_TRUE(DetectRemoteVideoPlaying(right_tab)); | 298 ASSERT_TRUE(DetectRemoteVideoPlaying(right_tab)); |
| 267 | 299 |
| 268 chrome::CloseWebContents(browser(), left_tab, false); | 300 chrome::CloseWebContents(browser(), left_tab, false); |
| 269 chrome::CloseWebContents(browser(), right_tab, false); | 301 chrome::CloseWebContents(browser(), right_tab, false); |
| 270 } | 302 } |
| 271 | 303 |
| 272 #if defined(OS_LINUX) | 304 #if defined(OS_LINUX) |
| 273 #define MAYBE_MANUAL_FirefoxApprtcInteropTest MANUAL_FirefoxApprtcInteropTest | 305 #define MAYBE_MANUAL_FirefoxApprtcInteropTestVP8 MANUAL_FirefoxApprtcInteropTest
VP8 |
| 306 #define MAYBE_MANUAL_FirefoxApprtcInteropTestVP9 MANUAL_FirefoxApprtcInteropTest
VP9 |
| 307 #define MAYBE_MANUAL_FirefoxApprtcInteropTestH264 MANUAL_FirefoxApprtcInteropTes
tH264 |
| 274 #else | 308 #else |
| 275 // Not implemented yet on Windows and Mac. | 309 // Not implemented yet on Windows and Mac. |
| 276 #define MAYBE_MANUAL_FirefoxApprtcInteropTest DISABLED_MANUAL_FirefoxApprtcInter
opTest | 310 #define MAYBE_MANUAL_FirefoxApprtcInteropTestVP9 DISABLED_MANUAL_FirefoxApprtcIn
teropTestVP8 |
| 311 #define MAYBE_MANUAL_FirefoxApprtcInteropTestVP8 DISABLED_MANUAL_FirefoxApprtcIn
teropTestVP9 |
| 312 #define MAYBE_MANUAL_FirefoxApprtcInteropTestH264 DISABLED_MANUAL_FirefoxApprtcI
nteropTestH264 |
| 277 #endif | 313 #endif |
| 278 | 314 |
| 279 IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest, | 315 IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest, |
| 280 MAYBE_MANUAL_FirefoxApprtcInteropTest) { | 316 MAYBE_MANUAL_FirefoxApprtcInteropTestVP8) { |
| 281 DetectErrorsInJavaScript(); | 317 FirefoxApprtcInteropTest("VP8"); |
| 282 ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost("9999")); | 318 } |
| 283 ASSERT_TRUE(LaunchColliderOnLocalHost("http://localhost:9999", "8089")); | |
| 284 while (!LocalApprtcInstanceIsUp()) | |
| 285 DVLOG(1) << "Waiting for AppRTC to come up..."; | |
| 286 | 319 |
| 287 GURL room_url = GURL("http://localhost:9999/r/some_room" | 320 IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest, |
| 288 "?wshpp=localhost:8089&wstls=false" | 321 MAYBE_MANUAL_FirefoxApprtcInteropTestVP9) { |
| 289 "&firefox_fake_device=1"); | 322 FirefoxApprtcInteropTest("VP9"); |
| 290 chrome::AddTabAt(browser(), GURL(), -1, true); | 323 } |
| 291 content::WebContents* chrome_tab = | |
| 292 browser()->tab_strip_model()->GetActiveWebContents(); | |
| 293 PermissionBubbleManager::FromWebContents(chrome_tab) | |
| 294 ->set_auto_response_for_test(PermissionBubbleManager::ACCEPT_ALL); | |
| 295 InfoBarResponder infobar_responder( | |
| 296 InfoBarService::FromWebContents(chrome_tab), InfoBarResponder::ACCEPT); | |
| 297 ui_test_utils::NavigateToURL(browser(), room_url); | |
| 298 | 324 |
| 299 ASSERT_TRUE(LaunchFirefoxWithUrl(room_url)); | 325 #if BUILDFLAG(RTC_USE_H264) |
| 300 | 326 |
| 301 ASSERT_TRUE(WaitForCallToComeUp(chrome_tab)); | 327 IN_PROC_BROWSER_TEST_F(WebRtcApprtcBrowserTest, |
| 328 MAYBE_MANUAL_FirefoxApprtcInteropTestH264) { |
| 329 // Only run test if run-time feature corresponding to |rtc_use_h264| is on. |
| 330 if (!base::FeatureList::IsEnabled(content::kWebRtcH264WithOpenH264FFmpeg)) { |
| 331 LOG(WARNING) << "Run-time feature WebRTC-H264WithOpenH264FFmpeg disabled. " |
| 332 "Skipping WebRtcApprtcBrowserTest.MANUAL_FirefoxApprtcInteropTestH264 " |
| 333 "(test \"OK\")"; |
| 334 return; |
| 335 } |
| 336 FirefoxApprtcInteropTest("H264"); |
| 337 } |
| 302 | 338 |
| 303 // Ensure Firefox manages to send video our way. | 339 #endif // #if BUILDFLAG(RTC_USE_H264) |
| 304 ASSERT_TRUE(DetectRemoteVideoPlaying(chrome_tab)); | |
| 305 } | |
| OLD | NEW |