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

Unified Diff: content/browser/webrtc_peerconnection_browsertest.cc

Issue 11428136: Added a basic WebRTC peerconnection browser test with video verification. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/webrtc_peerconnection_browsertest.cc
diff --git a/content/browser/webrtc_peerconnection_browsertest.cc b/content/browser/webrtc_peerconnection_browsertest.cc
new file mode 100644
index 0000000000000000000000000000000000000000..cc8e15595936a35a1b6632fc37084514c99a9af5
--- /dev/null
+++ b/content/browser/webrtc_peerconnection_browsertest.cc
@@ -0,0 +1,61 @@
+// 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
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/utf_string_conversions.h"
+#include "content/browser/web_contents/web_contents_impl.h"
+#include "content/public/test/browser_test_utils.h"
+#include "content/shell/shell.h"
+#include "content/test/content_browser_test.h"
+#include "content/test/content_browser_test_utils.h"
+#include "net/test/test_server.h"
+
+namespace content {
+
+// 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.
+// default in content_browsertests).
+class WebrtcPeerConnectionTest: public ContentBrowserTest {
+ public:
+ WebrtcPeerConnectionTest() {}
+
+ virtual void SetUp() OVERRIDE {
+ ASSERT_TRUE(test_server()->Start());
+ ContentBrowserTest::SetUp();
+ }
+
+ virtual void TearDown() OVERRIDE {
jam 2012/12/03 15:55:54 ditto
phoglund_chromium 2012/12/03 17:34:51 Done.
+ ContentBrowserTest::TearDown();
+ ASSERT_TRUE(test_server()->Stop());
+ }
+ protected:
+ bool ExecuteJavascript(const std::string& javascript) {
+ RenderViewHost* render_view_host =
+ shell()->web_contents()->GetRenderViewHost();
+
+ return ExecuteJavaScript(render_view_host, L"", ASCIIToWide(javascript));
+ }
+
+ void ExpectTitle(const std::string& expected_title) const {
+ string16 expected_title16(ASCIIToUTF16(expected_title));
+ TitleWatcher title_watcher(shell()->web_contents(), expected_title16);
+ EXPECT_EQ(expected_title16, title_watcher.WaitAndGetTitle());
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(WebrtcPeerConnectionTest, CanSetupVideoCall) {
+ GURL url(test_server()->GetURL("files/media/peerconnection-call.html"));
+ NavigateToURL(shell(), url);
+
+ EXPECT_TRUE(ExecuteJavascript("getUserMedia({video: true});"));
+ ExpectTitle("OK");
+}
+
+IN_PROC_BROWSER_TEST_F(WebrtcPeerConnectionTest, CanSetupAudioAndVideoCall) {
+ GURL url(test_server()->GetURL("files/media/peerconnection-call.html"));
+ NavigateToURL(shell(), url);
+
+ EXPECT_TRUE(ExecuteJavascript("getUserMedia({video: true, audio: true});"));
+ ExpectTitle("OK");
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698