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

Side by Side Diff: content/browser/media/webrtc_internals_browsertest.cc

Issue 15505003: GTTF: Convert most tests in content to use EmbeddedTestServer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: clang Created 7 years, 7 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/json/json_reader.h" 6 #include "base/json/json_reader.h"
7 #include "base/time.h" 7 #include "base/time.h"
8 #include "base/utf_string_conversions.h" 8 #include "base/utf_string_conversions.h"
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
11 #include "content/public/test/browser_test_utils.h" 11 #include "content/public/test/browser_test_utils.h"
12 #include "content/shell/shell.h" 12 #include "content/shell/shell.h"
13 #include "content/test/content_browser_test.h" 13 #include "content/test/content_browser_test.h"
14 #include "content/test/content_browser_test_utils.h" 14 #include "content/test/content_browser_test_utils.h"
15 #include "net/test/spawned_test_server/spawned_test_server.h" 15 #include "net/test/embedded_test_server/embedded_test_server.h"
16 16
17 using std::string; 17 using std::string;
18 namespace content { 18 namespace content {
19 19
20 struct SsrcEntry { 20 struct SsrcEntry {
21 string GetSsrcAttributeString() const { 21 string GetSsrcAttributeString() const {
22 std::stringstream ss; 22 std::stringstream ss;
23 ss << "a=ssrc:" << id; 23 ss << "a=ssrc:" << id;
24 std::map<string, string>::const_iterator iter; 24 std::map<string, string>::const_iterator iter;
25 for (iter = properties.begin(); iter != properties.end(); ++iter) { 25 for (iter = properties.begin(); iter != properties.end(); ++iter) {
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 class WebRTCInternalsBrowserTest: public ContentBrowserTest { 121 class WebRTCInternalsBrowserTest: public ContentBrowserTest {
122 public: 122 public:
123 WebRTCInternalsBrowserTest() {} 123 WebRTCInternalsBrowserTest() {}
124 virtual ~WebRTCInternalsBrowserTest() {} 124 virtual ~WebRTCInternalsBrowserTest() {}
125 125
126 virtual void SetUpOnMainThread() OVERRIDE { 126 virtual void SetUpOnMainThread() OVERRIDE {
127 // We need fake devices in this test since we want to run on naked VMs. We 127 // We need fake devices in this test since we want to run on naked VMs. We
128 // assume this switch is set by default in content_browsertests. 128 // assume this switch is set by default in content_browsertests.
129 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch( 129 ASSERT_TRUE(CommandLine::ForCurrentProcess()->HasSwitch(
130 switches::kUseFakeDeviceForMediaStream)); 130 switches::kUseFakeDeviceForMediaStream));
131
132 ASSERT_TRUE(test_server()->Start());
133 } 131 }
134 132
135 protected: 133 protected:
136 bool ExecuteJavascript(const string& javascript) { 134 bool ExecuteJavascript(const string& javascript) {
137 return ExecuteScript(shell()->web_contents(), javascript); 135 return ExecuteScript(shell()->web_contents(), javascript);
138 } 136 }
139 137
140 void ExpectTitle(const std::string& expected_title) const { 138 void ExpectTitle(const std::string& expected_title) const {
141 string16 expected_title16(ASCIIToUTF16(expected_title)); 139 string16 expected_title16(ASCIIToUTF16(expected_title));
142 TitleWatcher title_watcher(shell()->web_contents(), expected_title16); 140 TitleWatcher title_watcher(shell()->web_contents(), expected_title16);
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 // Timing out on ARM linux bot: http://crbug.com/238490 573 // Timing out on ARM linux bot: http://crbug.com/238490
576 #define MAYBE_WithRealPeerConnectionCall DISABLED_WithRealPeerConnectionCall 574 #define MAYBE_WithRealPeerConnectionCall DISABLED_WithRealPeerConnectionCall
577 #else 575 #else
578 #define MAYBE_WithRealPeerConnectionCall WithRealPeerConnectionCall 576 #define MAYBE_WithRealPeerConnectionCall WithRealPeerConnectionCall
579 #endif 577 #endif
580 578
581 // Sanity check of the page content under a real PeerConnection call. 579 // Sanity check of the page content under a real PeerConnection call.
582 IN_PROC_BROWSER_TEST_F(WebRTCInternalsBrowserTest, 580 IN_PROC_BROWSER_TEST_F(WebRTCInternalsBrowserTest,
583 MAYBE_WithRealPeerConnectionCall) { 581 MAYBE_WithRealPeerConnectionCall) {
584 // Start a peerconnection call in the first window. 582 // Start a peerconnection call in the first window.
585 GURL url(test_server()->GetURL("files/media/peerconnection-call.html")); 583 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
584 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
586 NavigateToURL(shell(), url); 585 NavigateToURL(shell(), url);
587 ASSERT_TRUE(ExecuteJavascript("call({video:true});")); 586 ASSERT_TRUE(ExecuteJavascript("call({video:true});"));
588 ExpectTitle("OK"); 587 ExpectTitle("OK");
589 588
590 // Open webrtc-internals in the second window. 589 // Open webrtc-internals in the second window.
591 GURL url2("chrome://webrtc-internals"); 590 GURL url2("chrome://webrtc-internals");
592 Shell* shell2 = CreateBrowser(); 591 Shell* shell2 = CreateBrowser();
593 NavigateToURL(shell2, url2); 592 NavigateToURL(shell2, url2);
594 593
595 const int NUMBER_OF_PEER_CONNECTIONS = 2; 594 const int NUMBER_OF_PEER_CONNECTIONS = 2;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 ASSERT_TRUE(ExecuteScriptAndExtractString( 699 ASSERT_TRUE(ExecuteScriptAndExtractString(
701 shell()->web_contents(), 700 shell()->web_contents(),
702 "window.domAutomationController.send(" 701 "window.domAutomationController.send("
703 "JSON.stringify(peerConnectionDataStore));", 702 "JSON.stringify(peerConnectionDataStore));",
704 &dump_json)); 703 &dump_json));
705 dump.reset(base::JSONReader::Read(dump_json)); 704 dump.reset(base::JSONReader::Read(dump_json));
706 VerifyStatsDump(dump.get(), pc_0, type, id, stats); 705 VerifyStatsDump(dump.get(), pc_0, type, id, stats);
707 } 706 }
708 707
709 } // namespace content 708 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/webrtc_browsertest.cc ('k') | content/browser/renderer_host/render_view_host_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698