OLD | NEW |
---|---|
(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 | |
OLD | NEW |