| 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/environment.h" | 5 #include "base/environment.h" |
| 6 #include "base/file_util.h" | 6 #include "base/file_util.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/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
| 24 #include "chrome/test/base/in_process_browser_test.h" | 24 #include "chrome/test/base/in_process_browser_test.h" |
| 25 #include "chrome/test/base/ui_test_utils.h" | 25 #include "chrome/test/base/ui_test_utils.h" |
| 26 #include "chrome/test/ui/ui_test.h" | 26 #include "chrome/test/ui/ui_test.h" |
| 27 #include "content/public/browser/notification_service.h" | 27 #include "content/public/browser/notification_service.h" |
| 28 #include "content/public/test/browser_test_utils.h" | 28 #include "content/public/test/browser_test_utils.h" |
| 29 #include "net/test/embedded_test_server/embedded_test_server.h" | 29 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 30 #include "net/test/python_utils.h" | 30 #include "net/test/python_utils.h" |
| 31 #include "testing/perf/perf_test.h" | 31 #include "testing/perf/perf_test.h" |
| 32 | 32 |
| 33 // Temporarily disabled on Linux. | |
| 34 // http://crbug.com/281268. | |
| 35 #if defined(OS_LINUX) | |
| 36 #define MAYBE_WebrtcVideoQualityBrowserTest DISABLED_WebrtcVideoQualityBrowserTe
st | |
| 37 #else | |
| 38 #define MAYBE_WebrtcVideoQualityBrowserTest WebrtcVideoQualityBrowserTest | |
| 39 #endif | |
| 40 | |
| 41 static const base::FilePath::CharType kFrameAnalyzerExecutable[] = | 33 static const base::FilePath::CharType kFrameAnalyzerExecutable[] = |
| 42 #if defined(OS_WIN) | 34 #if defined(OS_WIN) |
| 43 FILE_PATH_LITERAL("frame_analyzer.exe"); | 35 FILE_PATH_LITERAL("frame_analyzer.exe"); |
| 44 #else | 36 #else |
| 45 FILE_PATH_LITERAL("frame_analyzer"); | 37 FILE_PATH_LITERAL("frame_analyzer"); |
| 46 #endif | 38 #endif |
| 47 | 39 |
| 48 static const base::FilePath::CharType kArgbToI420ConverterExecutable[] = | 40 static const base::FilePath::CharType kArgbToI420ConverterExecutable[] = |
| 49 #if defined(OS_WIN) | 41 #if defined(OS_WIN) |
| 50 FILE_PATH_LITERAL("rgba_to_i420_converter.exe"); | 42 FILE_PATH_LITERAL("rgba_to_i420_converter.exe"); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 // * zxing (see the CPP version at https://code.google.com/p/zxing) | 85 // * zxing (see the CPP version at https://code.google.com/p/zxing) |
| 94 // * ffmpeg 0.11.1 or compatible version (see http://www.ffmpeg.org) | 86 // * ffmpeg 0.11.1 or compatible version (see http://www.ffmpeg.org) |
| 95 // | 87 // |
| 96 // The test case will launch a custom binary (peerconnection_server) which will | 88 // The test case will launch a custom binary (peerconnection_server) which will |
| 97 // allow two WebRTC clients to find each other. | 89 // allow two WebRTC clients to find each other. |
| 98 // | 90 // |
| 99 // The test also runs several other custom binaries - rgba_to_i420 converter and | 91 // The test also runs several other custom binaries - rgba_to_i420 converter and |
| 100 // frame_analyzer. Both tools can be found under third_party/webrtc/tools. The | 92 // frame_analyzer. Both tools can be found under third_party/webrtc/tools. The |
| 101 // test also runs a stand alone Python implementation of a WebSocket server | 93 // test also runs a stand alone Python implementation of a WebSocket server |
| 102 // (pywebsocket) and a barcode_decoder script. | 94 // (pywebsocket) and a barcode_decoder script. |
| 103 class MAYBE_WebrtcVideoQualityBrowserTest : public WebRtcTestBase { | 95 class WebrtcVideoQualityBrowserTest : public WebRtcTestBase { |
| 104 public: | 96 public: |
| 105 MAYBE_WebrtcVideoQualityBrowserTest() | 97 WebrtcVideoQualityBrowserTest() |
| 106 : pywebsocket_server_(0), | 98 : pywebsocket_server_(0), |
| 107 environment_(base::Environment::Create()) {} | 99 environment_(base::Environment::Create()) {} |
| 108 | 100 |
| 109 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 101 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 110 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); | 102 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); |
| 111 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. | 103 DetectErrorsInJavaScript(); // Look for errors in our rather complex js. |
| 112 } | 104 } |
| 113 | 105 |
| 114 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 106 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { |
| 115 // This test expects real device handling and requires a real webcam / audio | 107 // This test expects real device handling and requires a real webcam / audio |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 base::FilePath GetBrowserDir() { | 308 base::FilePath GetBrowserDir() { |
| 317 base::FilePath browser_dir; | 309 base::FilePath browser_dir; |
| 318 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &browser_dir)); | 310 EXPECT_TRUE(PathService::Get(base::DIR_MODULE, &browser_dir)); |
| 319 return browser_dir; | 311 return browser_dir; |
| 320 } | 312 } |
| 321 | 313 |
| 322 base::ProcessHandle pywebsocket_server_; | 314 base::ProcessHandle pywebsocket_server_; |
| 323 scoped_ptr<base::Environment> environment_; | 315 scoped_ptr<base::Environment> environment_; |
| 324 }; | 316 }; |
| 325 | 317 |
| 326 IN_PROC_BROWSER_TEST_F(MAYBE_WebrtcVideoQualityBrowserTest, | 318 IN_PROC_BROWSER_TEST_F(WebrtcVideoQualityBrowserTest, |
| 327 MANUAL_TestVGAVideoQuality) { | 319 MANUAL_TestVGAVideoQuality) { |
| 328 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 150) << | 320 ASSERT_GE(TestTimeouts::action_max_timeout().InSeconds(), 150) << |
| 329 "This is a long-running test; you must specify " | 321 "This is a long-running test; you must specify " |
| 330 "--ui-test-action-max-timeout to have a value of at least 150000."; | 322 "--ui-test-action-max-timeout to have a value of at least 150000."; |
| 331 | 323 |
| 332 ASSERT_TRUE(HasAllRequiredResources()); | 324 ASSERT_TRUE(HasAllRequiredResources()); |
| 333 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 325 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
| 334 ASSERT_TRUE(StartPyWebSocketServer()); | 326 ASSERT_TRUE(StartPyWebSocketServer()); |
| 335 ASSERT_TRUE(peerconnection_server_.Start()); | 327 ASSERT_TRUE(peerconnection_server_.Start()); |
| 336 | 328 |
| 337 ui_test_utils::NavigateToURL( | |
| 338 browser(), embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); | |
| 339 content::WebContents* left_tab = | 329 content::WebContents* left_tab = |
| 340 browser()->tab_strip_model()->GetActiveWebContents(); | 330 OpenPageAndGetUserMediaInNewTab( |
| 341 GetUserMediaAndAccept(left_tab); | 331 embedded_test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 342 | |
| 343 chrome::AddTabAt(browser(), GURL(), -1, true); | |
| 344 content::WebContents* right_tab = | 332 content::WebContents* right_tab = |
| 345 browser()->tab_strip_model()->GetActiveWebContents(); | 333 OpenPageAndGetUserMediaInNewTab( |
| 346 ui_test_utils::NavigateToURL( | 334 embedded_test_server()->GetURL(kCapturingWebrtcHtmlPage)); |
| 347 browser(), embedded_test_server()->GetURL(kCapturingWebrtcHtmlPage)); | |
| 348 GetUserMediaAndAccept(right_tab); | |
| 349 | 335 |
| 350 ConnectToPeerConnectionServer("peer 1", left_tab); | 336 ConnectToPeerConnectionServer("peer 1", left_tab); |
| 351 ConnectToPeerConnectionServer("peer 2", right_tab); | 337 ConnectToPeerConnectionServer("peer 2", right_tab); |
| 352 | 338 |
| 353 EstablishCall(left_tab, right_tab); | 339 EstablishCall(left_tab, right_tab); |
| 354 | 340 |
| 355 // Poll slower here to avoid flooding the log with messages: capturing and | 341 // Poll slower here to avoid flooding the log with messages: capturing and |
| 356 // sending frames take quite a bit of time. | 342 // sending frames take quite a bit of time. |
| 357 int polling_interval_msec = 1000; | 343 int polling_interval_msec = 1000; |
| 358 | 344 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 379 | 365 |
| 380 RunARGBtoI420Converter( | 366 RunARGBtoI420Converter( |
| 381 kVgaWidth, kVgaHeight, GetWorkingDir().Append(kCapturedYuvFileName)); | 367 kVgaWidth, kVgaHeight, GetWorkingDir().Append(kCapturedYuvFileName)); |
| 382 ASSERT_TRUE( | 368 ASSERT_TRUE( |
| 383 CompareVideosAndPrintResult(kVgaWidth, | 369 CompareVideosAndPrintResult(kVgaWidth, |
| 384 kVgaHeight, | 370 kVgaHeight, |
| 385 GetWorkingDir().Append(kCapturedYuvFileName), | 371 GetWorkingDir().Append(kCapturedYuvFileName), |
| 386 GetWorkingDir().Append(kReferenceYuvFileName), | 372 GetWorkingDir().Append(kReferenceYuvFileName), |
| 387 GetWorkingDir().Append(kStatsFileName))); | 373 GetWorkingDir().Append(kStatsFileName))); |
| 388 } | 374 } |
| OLD | NEW |