Componentize ShortcutsBackend
[chromium-blink-merge.git] / chrome / browser / media / webrtc_browsertest_common.h
blob40b99d3ecab0303c9ff91d7dcd85d322d9ef6375
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/files/file_path.h"
11 #include "base/process/process_handle.h"
13 namespace content {
14 class WebContents;
17 namespace test {
19 // Reference file locations.
21 // Checks if the user has the reference files directory, returns true if so.
22 // If the user's checkout don't have these dirs, they need to configure their
23 // .gclient as described in chrome/test/data/webrtc/resources/README. The reason
24 // for this is that we don't want to burden regular chrome devs with downloading
25 // these sizable reference files by default.
26 bool HasReferenceFilesInCheckout();
28 // Verifies both the YUV and Y4M version of the reference file exists.
29 bool HasYuvAndY4mFile(const base::FilePath::CharType* reference_file);
31 // Retrieves the reference files dir, to which file names can be appended.
32 base::FilePath GetReferenceFilesDir();
34 // Retrieves a tool binary path from chrome/test/data/webrtc/resources/tools,
35 // according to platform. If we're running on Linux, requesting pesq will yield
36 // chrome/test/data/webrtc/resources/tools/linux/pesq, whereas the same call on
37 // Windows will yield chrome/test/data/webrtc/resources/tools/win/pesq.exe.
38 // This function does not check the binary actually exists.
39 base::FilePath GetToolForPlatform(const std::string& tool_name);
41 extern const base::FilePath::CharType kReferenceFileName360p[];
42 extern const base::FilePath::CharType kReferenceFileName720p[];
43 extern const base::FilePath::CharType kYuvFileExtension[];
44 extern const base::FilePath::CharType kY4mFileExtension[];
46 // Executes javascript code which will sleep for |timeout_msec| milliseconds.
47 // Returns true on success.
48 bool SleepInJavascript(content::WebContents* tab_contents, int timeout_msec);
50 // This function will execute the provided |javascript| until it causes a call
51 // to window.domAutomationController.send() with |evaluates_to| as the message.
52 // That is, we are NOT checking what the javascript evaluates to. Returns false
53 // if we exceed the TestTimeouts::action_max_timeout().
54 // TODO(phoglund): Consider a better interaction method with the javascript
55 // than polling javascript methods.
56 bool PollingWaitUntil(const std::string& javascript,
57 const std::string& evaluates_to,
58 content::WebContents* tab_contents);
59 bool PollingWaitUntil(const std::string& javascript,
60 const std::string& evaluates_to,
61 content::WebContents* tab_contents,
62 int poll_interval_msec);
64 } // namespace test
66 #endif // CHROME_BROWSER_MEDIA_WEBRTC_BROWSERTEST_COMMON_H_