Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(667)

Side by Side Diff: content/browser/media/webrtc_content_browsertest_base.cc

Issue 131203005: Split WebRTC browser tests in getusermedia and peerconnection tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/media/webrtc_content_browsertest_base.h"
6
7 #include "base/command_line.h"
8 #include "base/strings/stringprintf.h"
9 #include "base/strings/utf_string_conversions.h"
10 #include "content/public/common/content_switches.h"
11 #include "content/public/test/browser_test_utils.h"
12 #include "content/shell/browser/shell.h"
13 #include "content/test/content_browser_test_utils.h"
14
15 namespace content {
16
17 void WebRtcContentBrowserTest::SetUpCommandLine(CommandLine* command_line) {
18 // We need fake devices in this test since we want to run on naked VMs. We
19 // assume these switches are set by default in content_browsertests.
20 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
21 switches::kUseFakeDeviceForMediaStream));
22 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
23 switches::kUseFakeUIForMediaStream));
24 }
25
26 bool WebRtcContentBrowserTest::ExecuteJavascript(
27 const std::string& javascript) {
28 return ExecuteScript(shell()->web_contents(), javascript);
29 }
30
31 // Executes |javascript|. The script is required to use
32 // window.domAutomationController.send to send a string value back to here.
33 std::string WebRtcContentBrowserTest::ExecuteJavascriptAndReturnResult(
34 const std::string& javascript) {
35 std::string result;
36 EXPECT_TRUE(ExecuteScriptAndExtractString(shell()->web_contents(),
37 javascript,
38 &result));
39 return result;
40 }
41
42 void WebRtcContentBrowserTest::ExpectTitle(
43 const std::string& expected_title) const {
44 base::string16 expected_title16(base::ASCIIToUTF16(expected_title));
45 TitleWatcher title_watcher(shell()->web_contents(), expected_title16);
46 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
47 }
48
49 std::string WebRtcContentBrowserTest::GenerateGetUserMediaCall(
50 const char* function_name,
51 int min_width,
52 int max_width,
53 int min_height,
54 int max_height,
55 int min_frame_rate,
56 int max_frame_rate) const {
57 return base::StringPrintf(
58 "%s({video: {mandatory: {minWidth: %d, maxWidth: %d, "
59 "minHeight: %d, maxHeight: %d, minFrameRate: %d, maxFrameRate: %d}, "
60 "optional: []}});",
61 function_name,
62 min_width,
63 max_width,
64 min_height,
65 max_height,
66 min_frame_rate,
67 max_frame_rate);
68 }
69
70 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698