OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/test/content_browser_test.h" | 5 #include "content/test/content_browser_test.h" |
6 | 6 |
7 class CommandLine; | 7 class CommandLine; |
8 | 8 |
9 namespace content { | 9 namespace content { |
10 | 10 |
11 // Contains stuff WebRTC browsertests have in common. | 11 // Contains stuff WebRTC browsertests have in common. |
12 class WebRtcContentBrowserTest: public ContentBrowserTest { | 12 class WebRtcContentBrowserTest: public ContentBrowserTest { |
13 public: | 13 public: |
14 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; | 14 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE; |
15 virtual void SetUp() OVERRIDE; | 15 virtual void SetUp() OVERRIDE; |
16 | 16 |
17 protected: | 17 protected: |
18 // Executes |javascript| and returns after it has been executed. | |
19 bool ExecuteJavascript(const std::string& javascript); | |
20 | |
21 // Executes |javascript|. The script is required to use | 18 // Executes |javascript|. The script is required to use |
22 // window.domAutomationController.send to send a string value back to here. | 19 // window.domAutomationController.send to send a string value back to here. |
23 std::string ExecuteJavascriptAndReturnResult( | 20 std::string ExecuteJavascriptAndReturnResult( |
24 const std::string& javascript); | 21 const std::string& javascript); |
25 | 22 |
26 // Waits for the page title to be set to |expected_title|. | 23 // Waits for the javascript to return OK via the automation controller. |
27 void ExpectTitle(const std::string& expected_title) const; | 24 // If the javascript returns != OK or times out, we fail the test. |
| 25 void ExecuteJavascriptAndWaitForOk(const std::string& javascript); |
28 | 26 |
29 // Generates javascript code for a getUserMedia call. | 27 // Generates javascript code for a getUserMedia call. |
30 std::string GenerateGetUserMediaCall(const char* function_name, | 28 std::string GenerateGetUserMediaCall(const char* function_name, |
31 int min_width, | 29 int min_width, |
32 int max_width, | 30 int max_width, |
33 int min_height, | 31 int min_height, |
34 int max_height, | 32 int max_height, |
35 int min_frame_rate, | 33 int min_frame_rate, |
36 int max_frame_rate) const; | 34 int max_frame_rate) const; |
37 }; | 35 }; |
38 | 36 |
39 } // namespace content | 37 } // namespace content |
OLD | NEW |