Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| 7 | 7 |
| 8 #include <queue> | 8 #include <queue> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 // or the keyboard layout. | 159 // or the keyboard layout. |
| 160 void SimulateKeyPress(WebContents* web_contents, | 160 void SimulateKeyPress(WebContents* web_contents, |
| 161 ui::DomKey key, | 161 ui::DomKey key, |
| 162 ui::DomCode code, | 162 ui::DomCode code, |
| 163 ui::KeyboardCode key_code, | 163 ui::KeyboardCode key_code, |
| 164 bool control, | 164 bool control, |
| 165 bool shift, | 165 bool shift, |
| 166 bool alt, | 166 bool alt, |
| 167 bool command); | 167 bool command); |
| 168 | 168 |
| 169 // | |
| 170 // Queries for video input devices on the current system using the getSources | |
| 171 // API. | |
| 172 // | |
| 173 // This does not guarantee that a getUserMedia with video will succeed, as the | |
| 174 // camera could be busy for instance. | |
| 175 // | |
| 176 // Returns has-video-input-device to the test if there is a webcam available, | |
| 177 // no-video-input-devices otherwise. | |
| 178 static const std::string hasVideoInputDeviceOnSystem = | |
|
mcasas
2016/09/06 15:34:54
Move this string to the anonymous namespace in the
lunalu1
2016/09/06 20:56:13
Done.
| |
| 179 "(function() {" | |
| 180 "MediaStreamTrack.getSources(function(devices) {" | |
| 181 "devices.forEach(function(device) {" | |
| 182 "if (device.kind == 'video')" | |
| 183 "returnToTest('has-video-input-device');" | |
| 184 "});" | |
| 185 "returnToTest('no-video-input-devices');" | |
| 186 "});" | |
| 187 "})()"; | |
|
mcasas
2016/09/06 15:34:54
Can we indent these lines to make them more readab
lunalu1
2016/09/06 20:56:13
Done.
| |
| 188 | |
| 189 // Method to check what devices we have on the system. | |
| 190 bool HasWebcamAvailableOnSystem(WebContents* tab_contents); | |
| 191 | |
| 169 // Allow ExecuteScript* methods to target either a WebContents or a | 192 // Allow ExecuteScript* methods to target either a WebContents or a |
| 170 // RenderFrameHost. Targetting a WebContents means executing the script in the | 193 // RenderFrameHost. Targetting a WebContents means executing the script in the |
| 171 // RenderFrameHost returned by WebContents::GetMainFrame(), which is the main | 194 // RenderFrameHost returned by WebContents::GetMainFrame(), which is the main |
| 172 // frame. Pass a specific RenderFrameHost to target it. Embedders may declare | 195 // frame. Pass a specific RenderFrameHost to target it. Embedders may declare |
| 173 // additional ConvertToRenderFrameHost functions for convenience. | 196 // additional ConvertToRenderFrameHost functions for convenience. |
| 174 class ToRenderFrameHost { | 197 class ToRenderFrameHost { |
| 175 public: | 198 public: |
| 176 template <typename T> | 199 template <typename T> |
| 177 ToRenderFrameHost(T* frame_convertible_value) | 200 ToRenderFrameHost(T* frame_convertible_value) |
| 178 : render_frame_host_(ConvertToRenderFrameHost(frame_convertible_value)) {} | 201 : render_frame_host_(ConvertToRenderFrameHost(frame_convertible_value)) {} |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 640 scoped_refptr<MessageLoopRunner> did_finish_loop_runner_; | 663 scoped_refptr<MessageLoopRunner> did_finish_loop_runner_; |
| 641 | 664 |
| 642 base::WeakPtrFactory<TestNavigationManager> weak_factory_; | 665 base::WeakPtrFactory<TestNavigationManager> weak_factory_; |
| 643 | 666 |
| 644 DISALLOW_COPY_AND_ASSIGN(TestNavigationManager); | 667 DISALLOW_COPY_AND_ASSIGN(TestNavigationManager); |
| 645 }; | 668 }; |
| 646 | 669 |
| 647 } // namespace content | 670 } // namespace content |
| 648 | 671 |
| 649 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 672 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
| OLD | NEW |