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

Side by Side Diff: content/browser/webrtc_getusermedia_browsertest.cc

Issue 11413065: Adding first WebRTC browser test to content_browsertests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moved to content/browser, got rid of DEPS override Created 8 years, 1 month 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 | « no previous file | content/content_tests.gypi » ('j') | 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 "base/utf_string_conversions.h"
perkj_chrome 2012/11/20 14:20:16 Add comment what this file do. What kind of tests
6 #include "content/browser/web_contents/web_contents_impl.h"
7 #include "content/public/test/browser_test_utils.h"
8 #include "content/shell/shell.h"
9 #include "content/test/content_browser_test.h"
10 #include "content/test/content_browser_test_utils.h"
11 #include "net/test/test_server.h"
12
13 namespace content {
14
15 // Note: Requires --use-fake-device-for-media-stream (this flag is set by
16 // default in content_browsertests).
17 class WebrtcGetUserMediaTest: public ContentBrowserTest {
18 public:
19 WebrtcGetUserMediaTest() {}
20 protected:
21 void TestGetUserMediaWithConstraints(const std::string& constraints) {
22 ASSERT_TRUE(test_server()->Start());
23 GURL empty_url(test_server()->GetURL(
24 "files/webrtc/getusermedia_and_stop.html"));
25 NavigateToURL(shell(), empty_url);
26
27 RenderViewHost* render_view_host =
28 shell()->web_contents()->GetRenderViewHost();
29
30 EXPECT_TRUE(ExecuteJavaScript(render_view_host, L"",
31 ASCIIToWide(constraints)));
32
33 ExpectTitle("OK");
34 }
35
36 void ExpectTitle(const std::string& expected_title) const {
37 string16 expected_title16(ASCIIToUTF16(expected_title));
38 TitleWatcher title_watcher(shell()->web_contents(), expected_title16);
39 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
40 }
41 };
42
43 IN_PROC_BROWSER_TEST_F(WebrtcGetUserMediaTest, GetAudioStreamAndStop) {
perkj_chrome 2012/11/20 14:20:16 Add comment what this test do here and below
44 TestGetUserMediaWithConstraints("getUserMedia({audio: true});");
45 }
46
47 IN_PROC_BROWSER_TEST_F(WebrtcGetUserMediaTest, GetVideoStreamAndStop) {
48 TestGetUserMediaWithConstraints("getUserMedia({video: true});");
49 }
50
51 IN_PROC_BROWSER_TEST_F(WebrtcGetUserMediaTest, GetAudioAndVideoStreamAndStop) {
52 TestGetUserMediaWithConstraints("getUserMedia({video: true, audio: true});");
53 }
54
55 } // namespace content
56
OLDNEW
« no previous file with comments | « no previous file | content/content_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698