| 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 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 void ShutdownPeerConnectionServer() { | 211 void ShutdownPeerConnectionServer() { |
| 212 EXPECT_TRUE(base::KillProcess(peerconnection_server_, 0, false)) << | 212 EXPECT_TRUE(base::KillProcess(peerconnection_server_, 0, false)) << |
| 213 "Failed to shut down peerconnection_server!"; | 213 "Failed to shut down peerconnection_server!"; |
| 214 } | 214 } |
| 215 | 215 |
| 216 base::ProcessHandle peerconnection_server_; | 216 base::ProcessHandle peerconnection_server_; |
| 217 }; | 217 }; |
| 218 | 218 |
| 219 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, | 219 IN_PROC_BROWSER_TEST_F(WebrtcBrowserTest, |
| 220 MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { | 220 MANUAL_RunsAudioVideoWebRTCCallInTwoTabs) { |
| 221 EXPECT_TRUE(test_server()->Start()); | 221 EXPECT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 222 | 222 |
| 223 ui_test_utils::NavigateToURL( | 223 ui_test_utils::NavigateToURL( |
| 224 browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 224 browser(), embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 225 content::WebContents* left_tab = | 225 content::WebContents* left_tab = |
| 226 browser()->tab_strip_model()->GetActiveWebContents(); | 226 browser()->tab_strip_model()->GetActiveWebContents(); |
| 227 GetUserMedia(left_tab); | 227 GetUserMedia(left_tab); |
| 228 | 228 |
| 229 chrome::AddBlankTabAt(browser(), -1, true); | 229 chrome::AddBlankTabAt(browser(), -1, true); |
| 230 content::WebContents* right_tab = | 230 content::WebContents* right_tab = |
| 231 browser()->tab_strip_model()->GetActiveWebContents(); | 231 browser()->tab_strip_model()->GetActiveWebContents(); |
| 232 ui_test_utils::NavigateToURL( | 232 ui_test_utils::NavigateToURL( |
| 233 browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 233 browser(), embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 234 GetUserMedia(right_tab); | 234 GetUserMedia(right_tab); |
| 235 | 235 |
| 236 ConnectToPeerConnectionServer("peer 1", left_tab); | 236 ConnectToPeerConnectionServer("peer 1", left_tab); |
| 237 ConnectToPeerConnectionServer("peer 2", right_tab); | 237 ConnectToPeerConnectionServer("peer 2", right_tab); |
| 238 | 238 |
| 239 EstablishCall(left_tab, right_tab); | 239 EstablishCall(left_tab, right_tab); |
| 240 | 240 |
| 241 AssertNoAsynchronousErrors(left_tab); | 241 AssertNoAsynchronousErrors(left_tab); |
| 242 AssertNoAsynchronousErrors(right_tab); | 242 AssertNoAsynchronousErrors(right_tab); |
| 243 | 243 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 294 | 294 |
| 295 WaitForVideoToPlay(right_tab); | 295 WaitForVideoToPlay(right_tab); |
| 296 | 296 |
| 297 HangUp(left_tab); | 297 HangUp(left_tab); |
| 298 WaitUntilHangupVerified(left_tab); | 298 WaitUntilHangupVerified(left_tab); |
| 299 WaitUntilHangupVerified(right_tab); | 299 WaitUntilHangupVerified(right_tab); |
| 300 | 300 |
| 301 AssertNoAsynchronousErrors(left_tab); | 301 AssertNoAsynchronousErrors(left_tab); |
| 302 AssertNoAsynchronousErrors(right_tab); | 302 AssertNoAsynchronousErrors(right_tab); |
| 303 } | 303 } |
| OLD | NEW |