| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/file_util.h" | 5 #include "base/file_util.h" |
| 6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
| 7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "chrome/browser/infobars/infobar.h" | 10 #include "chrome/browser/infobars/infobar.h" |
| 11 #include "chrome/browser/infobars/infobar_service.h" | 11 #include "chrome/browser/infobars/infobar_service.h" |
| 12 #include "chrome/browser/media/media_stream_infobar_delegate.h" | 12 #include "chrome/browser/media/media_stream_infobar_delegate.h" |
| 13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 15 #include "chrome/browser/ui/browser_tabstrip.h" | 15 #include "chrome/browser/ui/browser_tabstrip.h" |
| 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 16 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 17 #include "chrome/common/chrome_notification_types.h" | 17 #include "chrome/common/chrome_notification_types.h" |
| 18 #include "chrome/common/chrome_switches.h" | 18 #include "chrome/common/chrome_switches.h" |
| 19 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
| 20 #include "chrome/test/base/ui_test_utils.h" | 20 #include "chrome/test/base/ui_test_utils.h" |
| 21 #include "chrome/test/ui/ui_test.h" | 21 #include "chrome/test/ui/ui_test.h" |
| 22 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
| 23 #include "content/public/test/browser_test_utils.h" | 23 #include "content/public/test/browser_test_utils.h" |
| 24 #include "net/test/spawned_test_server/spawned_test_server.h" | 24 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 25 | 25 |
| 26 static const base::FilePath::CharType kPeerConnectionServer[] = | 26 static const base::FilePath::CharType kPeerConnectionServer[] = |
| 27 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
| 28 FILE_PATH_LITERAL("peerconnection_server.exe"); | 28 FILE_PATH_LITERAL("peerconnection_server.exe"); |
| 29 #else | 29 #else |
| 30 FILE_PATH_LITERAL("peerconnection_server"); | 30 FILE_PATH_LITERAL("peerconnection_server"); |
| 31 #endif | 31 #endif |
| 32 | 32 |
| 33 static const char kMainWebrtcTestHtmlPage[] = | 33 static const char kMainWebrtcTestHtmlPage[] = |
| 34 "files/webrtc/webrtc_jsep01_test.html"; | 34 "/webrtc/webrtc_jsep01_test.html"; |
| 35 | 35 |
| 36 // Top-level integration test for WebRTC. Requires a real webcam and microphone | 36 // Top-level integration test for WebRTC. Requires a real webcam and microphone |
| 37 // on the running system. This test is not meant to run in the main browser | 37 // on the running system. This test is not meant to run in the main browser |
| 38 // test suite since normal tester machines do not have webcams. | 38 // test suite since normal tester machines do not have webcams. |
| 39 class WebrtcBrowserTest : public InProcessBrowserTest { | 39 class WebrtcBrowserTest : public InProcessBrowserTest { |
| 40 public: | 40 public: |
| 41 WebrtcBrowserTest() : peerconnection_server_(0) {} | 41 WebrtcBrowserTest() : peerconnection_server_(0) {} |
| 42 | 42 |
| 43 virtual void SetUp() OVERRIDE { | 43 virtual void SetUp() OVERRIDE { |
| 44 RunPeerConnectionServer(); | 44 RunPeerConnectionServer(); |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 209 void ShutdownPeerConnectionServer() { | 209 void ShutdownPeerConnectionServer() { |
| 210 EXPECT_TRUE(base::KillProcess(peerconnection_server_, 0, false)) << | 210 EXPECT_TRUE(base::KillProcess(peerconnection_server_, 0, false)) << |
| 211 "Failed to shut down peerconnection_server!"; | 211 "Failed to shut down peerconnection_server!"; |
| 212 } | 212 } |
| 213 | 213 |
| 214 base::ProcessHandle peerconnection_server_; | 214 base::ProcessHandle peerconnection_server_; |
| 215 }; | 215 }; |
| 216 | 216 |
| 217 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, | 217 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, |
| 218 MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { | 218 MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { |
| 219 EXPECT_TRUE(test_server()->Start()); | 219 EXPECT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 220 | 220 |
| 221 ui_test_utils::NavigateToURL( | 221 ui_test_utils::NavigateToURL( |
| 222 browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 222 browser(), embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 223 content::WebContents* left_tab = | 223 content::WebContents* left_tab = |
| 224 browser()->tab_strip_model()->GetActiveWebContents(); | 224 browser()->tab_strip_model()->GetActiveWebContents(); |
| 225 GetUserMedia(left_tab); | 225 GetUserMedia(left_tab); |
| 226 | 226 |
| 227 chrome::AddBlankTabAt(browser(), -1, true); | 227 chrome::AddBlankTabAt(browser(), -1, true); |
| 228 content::WebContents* right_tab = | 228 content::WebContents* right_tab = |
| 229 browser()->tab_strip_model()->GetActiveWebContents(); | 229 browser()->tab_strip_model()->GetActiveWebContents(); |
| 230 ui_test_utils::NavigateToURL( | 230 ui_test_utils::NavigateToURL( |
| 231 browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 231 browser(), embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 232 GetUserMedia(right_tab); | 232 GetUserMedia(right_tab); |
| 233 | 233 |
| 234 ConnectToPeerConnectionServer("peer 1", left_tab); | 234 ConnectToPeerConnectionServer("peer 1", left_tab); |
| 235 ConnectToPeerConnectionServer("peer 2", right_tab); | 235 ConnectToPeerConnectionServer("peer 2", right_tab); |
| 236 | 236 |
| 237 EstablishCall(left_tab, right_tab); | 237 EstablishCall(left_tab, right_tab); |
| 238 | 238 |
| 239 AssertNoAsynchronousErrors(left_tab); | 239 AssertNoAsynchronousErrors(left_tab); |
| 240 AssertNoAsynchronousErrors(right_tab); | 240 AssertNoAsynchronousErrors(right_tab); |
| 241 | 241 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 | 292 |
| 293 WaitForVideoToPlay(right_tab); | 293 WaitForVideoToPlay(right_tab); |
| 294 | 294 |
| 295 HangUp(left_tab); | 295 HangUp(left_tab); |
| 296 WaitUntilHangupVerified(left_tab); | 296 WaitUntilHangupVerified(left_tab); |
| 297 WaitUntilHangupVerified(right_tab); | 297 WaitUntilHangupVerified(right_tab); |
| 298 | 298 |
| 299 AssertNoAsynchronousErrors(left_tab); | 299 AssertNoAsynchronousErrors(left_tab); |
| 300 AssertNoAsynchronousErrors(right_tab); | 300 AssertNoAsynchronousErrors(right_tab); |
| 301 } | 301 } |
| OLD | NEW |