Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / media / webrtc_browsertest_common.h
blob9d51c172b50e47eff8eec0bb61f34d61f131e3a0
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_
8 #include <string>
10 #include "base/process/process_handle.h"
12 namespace content {
13 class WebContents;
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 {
35 public:
36 static const char kDefaultPort[];
38 PeerConnectionServerRunner(): server_pid_(0) {}
39 ~PeerConnectionServerRunner() {}
41 // Starts the peerconnection server on localhost on |kDefaultPort|.
42 bool Start();
44 // Stops the peerconnection server.
45 bool Stop();
47 static void KillAllPeerConnectionServersOnCurrentSystem();
49 private:
50 base::ProcessHandle server_pid_;
53 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_COMMON_H_