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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_COMMON_H_
6 #define CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_COMMON_H_
10 #include "base/process/process_handle.h"
16 // Executes javascript code which will sleep for |timeout_msec| milliseconds.
17 // Returns true on success.
18 bool SleepInJavascript(content::WebContents
* tab_contents
, int timeout_msec
);
20 // This function will execute the provided |javascript| until it causes a call
21 // to window.domAutomationController.send() with |evaluates_to| as the message.
22 // That is, we are NOT checking what the javascript evaluates to. Returns false
23 // if we exceed the TestTimeouts::action_max_timeout().
24 // TODO(phoglund): Consider a better interaction method with the javascript
25 // than polling javascript methods.
26 bool PollingWaitUntil(const std::string
& javascript
,
27 const std::string
& evaluates_to
,
28 content::WebContents
* tab_contents
);
29 bool PollingWaitUntil(const std::string
& javascript
,
30 const std::string
& evaluates_to
,
31 content::WebContents
* tab_contents
,
32 int poll_interval_msec
);
34 class PeerConnectionServerRunner
{
36 static const char kDefaultPort
[];
38 PeerConnectionServerRunner(): server_pid_(0) {}
39 ~PeerConnectionServerRunner() {}
41 // Starts the peerconnection server on localhost on |kDefaultPort|.
44 // Stops the peerconnection server.
47 static void KillAllPeerConnectionServersOnCurrentSystem();
50 base::ProcessHandle server_pid_
;
53 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_COMMON_H_