| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 test::PeerConnectionServerRunner::KillAllPeerConnectionServers(); |
| 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); |
| 61 if (!base::PathExists(reference_file)) { | 61 if (!base::PathExists(reference_file)) { |
| 62 LOG(ERROR) << "Cannot find the reference file to be used for audio " | 62 LOG(ERROR) << "Cannot find the reference file to be used for audio " |
| 63 << "quality comparison: " << reference_file.value(); | 63 << "quality comparison: " << reference_file.value(); |
| 64 return false; | 64 return false; |
| 65 } | 65 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 81 EXPECT_EQ("ok-mixed-in", ExecuteJavascript( | 81 EXPECT_EQ("ok-mixed-in", ExecuteJavascript( |
| 82 "mixLocalStreamWithPreviouslyLoadedAudioFile()", tab_contents)); | 82 "mixLocalStreamWithPreviouslyLoadedAudioFile()", tab_contents)); |
| 83 } | 83 } |
| 84 | 84 |
| 85 void EstablishCall(content::WebContents* from_tab, | 85 void EstablishCall(content::WebContents* from_tab, |
| 86 content::WebContents* to_tab) { | 86 content::WebContents* to_tab) { |
| 87 EXPECT_EQ("ok-negotiating", | 87 EXPECT_EQ("ok-negotiating", |
| 88 ExecuteJavascript("negotiateCall()", from_tab)); | 88 ExecuteJavascript("negotiateCall()", from_tab)); |
| 89 | 89 |
| 90 // Ensure the call gets up on both sides. | 90 // Ensure the call gets up on both sides. |
| 91 EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()", | 91 EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", |
| 92 "active", from_tab)); | 92 "active", from_tab)); |
| 93 EXPECT_TRUE(PollingWaitUntil("getPeerConnectionReadyState()", | 93 EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", |
| 94 "active", to_tab)); | 94 "active", to_tab)); |
| 95 } | 95 } |
| 96 | 96 |
| 97 PeerConnectionServerRunner peerconnection_server_; | 97 test::PeerConnectionServerRunner peerconnection_server_; |
| 98 }; | 98 }; |
| 99 | 99 |
| 100 // TODO(phoglund): enable when fully implemented. | 100 // TODO(phoglund): enable when fully implemented. |
| 101 IN_PROC_BROWSER_TEST_F(WebRtcTypingDetectionBrowserTest, | 101 IN_PROC_BROWSER_TEST_F(WebRtcTypingDetectionBrowserTest, |
| 102 DISABLED_MANUAL_TestTypingDetection) { | 102 DISABLED_MANUAL_TestTypingDetection) { |
| 103 // TODO(phoglund): make this use embedded_test_server when that test server | 103 // TODO(phoglund): make this use embedded_test_server when that test server |
| 104 // can handle files > ~400Kb. | 104 // can handle files > ~400Kb. |
| 105 ASSERT_TRUE(test_server()->Start()); | 105 ASSERT_TRUE(test_server()->Start()); |
| 106 ASSERT_TRUE(peerconnection_server_.Start()); | 106 ASSERT_TRUE(peerconnection_server_.Start()); |
| 107 | 107 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 126 | 126 |
| 127 AddAudioFile(kReferenceFileRelativeUrl, left_tab); | 127 AddAudioFile(kReferenceFileRelativeUrl, left_tab); |
| 128 MixLocalStreamWithPreviouslyLoadedAudioFile(left_tab); | 128 MixLocalStreamWithPreviouslyLoadedAudioFile(left_tab); |
| 129 | 129 |
| 130 EstablishCall(left_tab, right_tab); | 130 EstablishCall(left_tab, right_tab); |
| 131 | 131 |
| 132 // Note: the media flow isn't necessarily established on the connection just | 132 // Note: the media flow isn't necessarily established on the connection just |
| 133 // because the ready state is ok on both sides. We sleep a bit between call | 133 // because the ready state is ok on both sides. We sleep a bit between call |
| 134 // establishment and playing to avoid cutting of the beginning of the audio | 134 // establishment and playing to avoid cutting of the beginning of the audio |
| 135 // file. | 135 // file. |
| 136 SleepInJavascript(left_tab, 2000); | 136 test::SleepInJavascript(left_tab, 2000); |
| 137 | 137 |
| 138 PlayAudioFile(left_tab); | 138 PlayAudioFile(left_tab); |
| 139 | 139 |
| 140 // TODO(phoglund): simulate key presses, look for changes in typing detection | 140 // TODO(phoglund): simulate key presses, look for changes in typing detection |
| 141 // state. | 141 // state. |
| 142 SleepInJavascript(left_tab, 10000); | 142 test::SleepInJavascript(left_tab, 10000); |
| 143 | 143 |
| 144 HangUp(left_tab); | 144 HangUp(left_tab); |
| 145 WaitUntilHangupVerified(left_tab); | 145 WaitUntilHangupVerified(left_tab); |
| 146 WaitUntilHangupVerified(right_tab); | 146 WaitUntilHangupVerified(right_tab); |
| 147 | 147 |
| 148 ASSERT_TRUE(peerconnection_server_.Stop()); | 148 ASSERT_TRUE(peerconnection_server_.Stop()); |
| 149 } | 149 } |
| OLD | NEW |