Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
|
jam
2012/12/03 15:55:54
seems that a bit of code here is duplicated in the
phoglund_chromium
2012/12/03 17:34:51
Good idea, I'll do that. I think I can even merge
| |
| 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" | |
| 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 | |
|
jam
2012/12/03 15:55:54
nit: better than a comment, add a dcheck. that way
phoglund_chromium
2012/12/03 17:34:51
Done.
| |
| 16 // default in content_browsertests). | |
| 17 class WebrtcPeerConnectionTest: public ContentBrowserTest { | |
| 18 public: | |
| 19 WebrtcPeerConnectionTest() {} | |
| 20 | |
| 21 virtual void SetUp() OVERRIDE { | |
| 22 ASSERT_TRUE(test_server()->Start()); | |
| 23 ContentBrowserTest::SetUp(); | |
| 24 } | |
| 25 | |
| 26 virtual void TearDown() OVERRIDE { | |
|
jam
2012/12/03 15:55:54
ditto
phoglund_chromium
2012/12/03 17:34:51
Done.
| |
| 27 ContentBrowserTest::TearDown(); | |
| 28 ASSERT_TRUE(test_server()->Stop()); | |
| 29 } | |
| 30 protected: | |
| 31 bool ExecuteJavascript(const std::string& javascript) { | |
| 32 RenderViewHost* render_view_host = | |
| 33 shell()->web_contents()->GetRenderViewHost(); | |
| 34 | |
| 35 return ExecuteJavaScript(render_view_host, L"", ASCIIToWide(javascript)); | |
| 36 } | |
| 37 | |
| 38 void ExpectTitle(const std::string& expected_title) const { | |
| 39 string16 expected_title16(ASCIIToUTF16(expected_title)); | |
| 40 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); | |
| 41 EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle()); | |
| 42 } | |
| 43 }; | |
| 44 | |
| 45 IN_PROC_BROWSER_TEST_F(WebrtcPeerConnectionTest, CanSetupVideoCall) { | |
| 46 GURL url(test_server()->GetURL("files/media/peerconnection-call.html")); | |
| 47 NavigateToURL(shell(), url); | |
| 48 | |
| 49 EXPECT_TRUE(ExecuteJavascript("getUserMedia({video: true});")); | |
| 50 ExpectTitle("OK"); | |
| 51 } | |
| 52 | |
| 53 IN_PROC_BROWSER_TEST_F(WebrtcPeerConnectionTest, CanSetupAudioAndVideoCall) { | |
| 54 GURL url(test_server()->GetURL("files/media/peerconnection-call.html")); | |
| 55 NavigateToURL(shell(), url); | |
| 56 | |
| 57 EXPECT_TRUE(ExecuteJavascript("getUserMedia({video: true, audio: true});")); | |
| 58 ExpectTitle("OK"); | |
| 59 } | |
| 60 | |
| 61 } // namespace content | |
| OLD | NEW |