Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(217)

Side by Side Diff: chrome/browser/media/chrome_webrtc_typing_detection_browsertest.cc

Issue 271653002: Rewrote WebRTC browser tests to not use peerconnection_server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit fixes Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return source_dir; 43 return source_dir;
44 } 44 }
45 45
46 // Test that the typing detection feature works. 46 // Test that the typing detection feature works.
47 // You must have the src-internal solution in your .gclient to put the required 47 // You must have the src-internal solution in your .gclient to put the required
48 // pyauto_private directory into chrome/test/data/. 48 // pyauto_private directory into chrome/test/data/.
49 class WebRtcTypingDetectionBrowserTest : public WebRtcTestBase { 49 class WebRtcTypingDetectionBrowserTest : public WebRtcTestBase {
50 public: 50 public:
51 // TODO(phoglund): clean up duplication from audio quality browser test when 51 // TODO(phoglund): clean up duplication from audio quality browser test when
52 // this test is complete and is proven to work. 52 // this test is complete and is proven to work.
53 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
54 test::PeerConnectionServerRunner::KillAllPeerConnectionServers();
55 }
56
57 bool HasAllRequiredResources() { 53 bool HasAllRequiredResources() {
58 base::FilePath reference_file = 54 base::FilePath reference_file =
59 GetTestDataDir().Append(kReferenceFile); 55 GetTestDataDir().Append(kReferenceFile);
60 if (!base::PathExists(reference_file)) { 56 if (!base::PathExists(reference_file)) {
61 LOG(ERROR) << "Cannot find the reference file to be used for audio " 57 LOG(ERROR) << "Cannot find the reference file to be used for audio "
62 << "quality comparison: " << reference_file.value(); 58 << "quality comparison: " << reference_file.value();
63 return false; 59 return false;
64 } 60 }
65 return true; 61 return true;
66 } 62 }
(...skipping 18 matching lines...) Expand all
85 content::WebContents* to_tab) { 81 content::WebContents* to_tab) {
86 EXPECT_EQ("ok-negotiating", 82 EXPECT_EQ("ok-negotiating",
87 ExecuteJavascript("negotiateCall()", from_tab)); 83 ExecuteJavascript("negotiateCall()", from_tab));
88 84
89 // Ensure the call gets up on both sides. 85 // Ensure the call gets up on both sides.
90 EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", 86 EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()",
91 "active", from_tab)); 87 "active", from_tab));
92 EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()", 88 EXPECT_TRUE(test::PollingWaitUntil("getPeerConnectionReadyState()",
93 "active", to_tab)); 89 "active", to_tab));
94 } 90 }
95
96 test::PeerConnectionServerRunner peerconnection_server_;
97 }; 91 };
98 92
99 // TODO(phoglund): enable when fully implemented. 93 // TODO(phoglund): enable when fully implemented.
100 IN_PROC_BROWSER_TEST_F(WebRtcTypingDetectionBrowserTest, 94 IN_PROC_BROWSER_TEST_F(WebRtcTypingDetectionBrowserTest,
101 DISABLED_MANUAL_TestTypingDetection) { 95 DISABLED_MANUAL_TestTypingDetection) {
102 // TODO(phoglund): make this use embedded_test_server when that test server 96 // TODO(phoglund): make this use embedded_test_server when that test server
103 // can handle files > ~400Kb. 97 // can handle files > ~400Kb.
104 ASSERT_TRUE(test_server()->Start()); 98 ASSERT_TRUE(test_server()->Start());
105 ASSERT_TRUE(peerconnection_server_.Start());
106 99
107 ui_test_utils::NavigateToURL( 100 ui_test_utils::NavigateToURL(
108 browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage)); 101 browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage));
109 content::WebContents* left_tab = 102 content::WebContents* left_tab =
110 browser()->tab_strip_model()->GetActiveWebContents(); 103 browser()->tab_strip_model()->GetActiveWebContents();
111 104
112 chrome::AddTabAt(browser(), GURL(), -1, true); 105 chrome::AddTabAt(browser(), GURL(), -1, true);
113 content::WebContents* right_tab = 106 content::WebContents* right_tab =
114 browser()->tab_strip_model()->GetActiveWebContents(); 107 browser()->tab_strip_model()->GetActiveWebContents();
115 ui_test_utils::NavigateToURL( 108 ui_test_utils::NavigateToURL(
116 browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage)); 109 browser(), test_server()->GetURL(kMainWebrtcTestHtmlPage));
117 110
118 ConnectToPeerConnectionServer("peer 1", left_tab);
119 ConnectToPeerConnectionServer("peer 2", right_tab);
120
121 GetUserMediaWithSpecificConstraintsAndAccept(left_tab, 111 GetUserMediaWithSpecificConstraintsAndAccept(left_tab,
122 kAudioOnlyCallConstraints); 112 kAudioOnlyCallConstraints);
123 EXPECT_EQ("ok-peerconnection-created", 113 EXPECT_EQ("ok-peerconnection-created",
124 ExecuteJavascript("preparePeerConnection()", left_tab)); 114 ExecuteJavascript("preparePeerConnection()", left_tab));
125 115
126 AddAudioFile(kReferenceFileRelativeUrl, left_tab); 116 AddAudioFile(kReferenceFileRelativeUrl, left_tab);
127 MixLocalStreamWithPreviouslyLoadedAudioFile(left_tab); 117 MixLocalStreamWithPreviouslyLoadedAudioFile(left_tab);
128 118
129 EstablishCall(left_tab, right_tab); 119 SetupPeerconnectionWithLocalStream(left_tab);
120 SetupPeerconnectionWithLocalStream(right_tab);
121
122 NegotiateCall(left_tab, right_tab);
130 123
131 // Note: the media flow isn't necessarily established on the connection just 124 // Note: the media flow isn't necessarily established on the connection just
132 // because the ready state is ok on both sides. We sleep a bit between call 125 // because the ready state is ok on both sides. We sleep a bit between call
133 // establishment and playing to avoid cutting of the beginning of the audio 126 // establishment and playing to avoid cutting of the beginning of the audio
134 // file. 127 // file.
135 test::SleepInJavascript(left_tab, 2000); 128 test::SleepInJavascript(left_tab, 2000);
136 129
137 PlayAudioFile(left_tab); 130 PlayAudioFile(left_tab);
138 131
139 // TODO(phoglund): simulate key presses, look for changes in typing detection 132 // TODO(phoglund): simulate key presses, look for changes in typing detection
140 // state. 133 // state.
141 test::SleepInJavascript(left_tab, 10000); 134 test::SleepInJavascript(left_tab, 10000);
142 135
143 HangUp(left_tab); 136 HangUp(left_tab);
144 WaitUntilHangupVerified(left_tab);
145 WaitUntilHangupVerified(right_tab);
146
147 ASSERT_TRUE(peerconnection_server_.Stop());
148 } 137 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698