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

Side by Side Diff: content/test/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: Rebased again :) 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
« no previous file with comments | « content/test/webrtc_content_browsertest_base.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/test/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 void WebRtcContentBrowserTest::SetUp() {
27 // These tests require pixel output.
28 UseRealGLContexts();
29 ContentBrowserTest::SetUp();
30 }
31
32 bool WebRtcContentBrowserTest::ExecuteJavascript(
33 const std::string& javascript) {
34 return ExecuteScript(shell()->web_contents(), javascript);
35 }
36
37 // Executes |javascript|. The script is required to use
38 // window.domAutomationController.send to send a string value back to here.
39 std::string WebRtcContentBrowserTest::ExecuteJavascriptAndReturnResult(
40 const std::string& javascript) {
41 std::string result;
42 EXPECT_TRUE(ExecuteScriptAndExtractString(shell()->web_contents(),
43 javascript,
44 &result));
45 return result;
46 }
47
48 void WebRtcContentBrowserTest::ExpectTitle(
49 const std::string& expected_title) const {
50 base::string16 expected_title16(base::ASCIIToUTF16(expected_title));
51 TitleWatcher title_watcher(shell()->web_contents(), expected_title16);
52 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
53 }
54
55 std::string WebRtcContentBrowserTest::GenerateGetUserMediaCall(
56 const char* function_name,
57 int min_width,
58 int max_width,
59 int min_height,
60 int max_height,
61 int min_frame_rate,
62 int max_frame_rate) const {
63 return base::StringPrintf(
64 "%s({video: {mandatory: {minWidth: %d, maxWidth: %d, "
65 "minHeight: %d, maxHeight: %d, minFrameRate: %d, maxFrameRate: %d}, "
66 "optional: []}});",
67 function_name,
68 min_width,
69 max_width,
70 min_height,
71 max_height,
72 min_frame_rate,
73 max_frame_rate);
74 }
75
76 } // namespace content
OLDNEW
« no previous file with comments | « content/test/webrtc_content_browsertest_base.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698