| 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 <ctime> | 5 #include <ctime> |
| 6 | 6 |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/strings/stringprintf.h" | 8 #include "base/strings/stringprintf.h" |
| 9 #include "chrome/browser/media/webrtc_browsertest_base.h" | 9 #include "chrome/browser/media/webrtc_browsertest_base.h" |
| 10 #include "chrome/browser/media/webrtc_browsertest_common.h" | 10 #include "chrome/browser/media/webrtc_browsertest_common.h" |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 static base::FilePath GetTestDataDir() { | 41 static base::FilePath GetTestDataDir() { |
| 42 base::FilePath source_dir; | 42 base::FilePath source_dir; |
| 43 PathService::Get(chrome::DIR_TEST_DATA, &source_dir); | 43 PathService::Get(chrome::DIR_TEST_DATA, &source_dir); |
| 44 return source_dir; | 44 return source_dir; |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Test that the typing detection feature works. | 47 // Test that the typing detection feature works. |
| 48 // You must have the src-internal solution in your .gclient to put the required | 48 // You must have the src-internal solution in your .gclient to put the required |
| 49 // pyauto_private directory into chrome/test/data/. | 49 // pyauto_private directory into chrome/test/data/. |
| 50 class WebrtcTypingDetectionBrowserTest : public WebRtcTestBase { | 50 class WebRtcTypingDetectionBrowserTest : public WebRtcTestBase { |
| 51 public: | 51 public: |
| 52 // TODO(phoglund): clean up duplication from audio quality browser test when | 52 // TODO(phoglund): clean up duplication from audio quality browser test when |
| 53 // this test is complete and is proven to work. | 53 // this test is complete and is proven to work. |
| 54 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 54 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 55 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); | 55 PeerConnectionServerRunner::KillAllPeerConnectionServersOnCurrentSystem(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 bool HasAllRequiredResources() { | 58 bool HasAllRequiredResources() { |
| 59 base::FilePath reference_file = | 59 base::FilePath reference_file = |
| 60 GetTestDataDir().Append(kReferenceFile); | 60 GetTestDataDir().Append(kReferenceFile); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 | 100 |
| 101 void WaitUntilHangupVerified(content::WebContents* tab_contents) { | 101 void WaitUntilHangupVerified(content::WebContents* tab_contents) { |
| 102 EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()", | 102 EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()", |
| 103 "no-peer-connection", tab_contents)); | 103 "no-peer-connection", tab_contents)); |
| 104 } | 104 } |
| 105 | 105 |
| 106 PeerConnectionServerRunner peerconnection_server_; | 106 PeerConnectionServerRunner peerconnection_server_; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 // TODO(phoglund): enable when fully implemented. | 109 // TODO(phoglund): enable when fully implemented. |
| 110 IN_PROC_BROWSER_TEST_F(WebrtcTypingDetectionBrowserTest, | 110 IN_PROC_BROWSER_TEST_F(WebRtcTypingDetectionBrowserTest, |
| 111 DISABLED_MANUAL_TestTypingDetection) { | 111 DISABLED_MANUAL_TestTypingDetection) { |
| 112 // TODO(phoglund): make this use embedded_test_server when that test server | 112 // TODO(phoglund): make this use embedded_test_server when that test server |
| 113 // can handle files > ~400Kb. | 113 // can handle files > ~400Kb. |
| 114 ASSERT_TRUE(test_server()->Start()); | 114 ASSERT_TRUE(test_server()->Start()); |
| 115 ASSERT_TRUE(peerconnection_server_.Start()); | 115 ASSERT_TRUE(peerconnection_server_.Start()); |
| 116 | 116 |
| 117 ui_test_utils::NavigateToURL( | 117 ui_test_utils::NavigateToURL( |
| 118 browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage)); | 118 browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage)); |
| 119 content::WebContents* left_tab = | 119 content::WebContents* left_tab = |
| 120 browser()->tab_strip_model()->GetActiveWebContents(); | 120 browser()->tab_strip_model()->GetActiveWebContents(); |
| (...skipping 28 matching lines...) Expand all Loading... |
| 149 // TODO(phoglund): simulate key presses, look for changes in typing detection | 149 // TODO(phoglund): simulate key presses, look for changes in typing detection |
| 150 // state. | 150 // state. |
| 151 SleepInJavascript(left_tab, 10000); | 151 SleepInJavascript(left_tab, 10000); |
| 152 | 152 |
| 153 HangUp(left_tab); | 153 HangUp(left_tab); |
| 154 WaitUntilHangupVerified(left_tab); | 154 WaitUntilHangupVerified(left_tab); |
| 155 WaitUntilHangupVerified(right_tab); | 155 WaitUntilHangupVerified(right_tab); |
| 156 | 156 |
| 157 ASSERT_TRUE(peerconnection_server_.Stop()); | 157 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 158 } | 158 } |
| OLD | NEW |