summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/browser/media/webrtc_audio_debug_recordings_browsertest.cc5
-rw-r--r--content/browser/media/webrtc_browsertest.cc80
-rw-r--r--content/browser/media/webrtc_getusermedia_browsertest.cc10
-rw-r--r--content/browser/media/webrtc_internals_browsertest.cc5
-rw-r--r--content/browser/media/webrtc_webcam_browsertest.cc2
-rw-r--r--content/browser/renderer_host/render_process_host_impl.cc3
-rw-r--r--content/public/common/content_switches.cc10
-rw-r--r--content/public/common/content_switches.h2
-rw-r--r--content/renderer/media/webrtc/peer_connection_dependency_factory.cc80
-rw-r--r--content/shell/browser/shell.cc9
-rw-r--r--content/shell/browser/shell_permission_manager.cc10
-rw-r--r--content/test/content_test_launcher.cc1
-rw-r--r--content/test/data/media/peerconnection-call.html63
-rw-r--r--content/test/ppapi/ppapi_test.cc2
-rw-r--r--content/test/webrtc_content_browsertest_base.cc19
-rw-r--r--content/test/webrtc_content_browsertest_base.h3
-rw-r--r--testing/android/native_test/java/src/org/chromium/native_test/NativeBrowserTestActivity.java5
17 files changed, 255 insertions, 54 deletions
diff --git a/content/browser/media/webrtc_audio_debug_recordings_browsertest.cc b/content/browser/media/webrtc_audio_debug_recordings_browsertest.cc
index d81d51a..d8ff098 100644
--- a/content/browser/media/webrtc_audio_debug_recordings_browsertest.cc
+++ b/content/browser/media/webrtc_audio_debug_recordings_browsertest.cc
@@ -65,7 +65,10 @@ namespace content {
class WebRtcAudioDebugRecordingsBrowserTest : public WebRtcContentBrowserTest {
public:
- WebRtcAudioDebugRecordingsBrowserTest() {}
+ WebRtcAudioDebugRecordingsBrowserTest() {
+ // Automatically grant device permission.
+ AppendUseFakeUIForMediaStreamFlag();
+ }
~WebRtcAudioDebugRecordingsBrowserTest() override {}
};
diff --git a/content/browser/media/webrtc_browsertest.cc b/content/browser/media/webrtc_browsertest.cc
index 25b0027..68b04b5 100644
--- a/content/browser/media/webrtc_browsertest.cc
+++ b/content/browser/media/webrtc_browsertest.cc
@@ -20,15 +20,32 @@ namespace content {
#if defined(OS_ANDROID) && defined(ADDRESS_SANITIZER)
// Renderer crashes under Android ASAN: https://crbug.com/408496.
#define MAYBE_WebRtcBrowserTest DISABLED_WebRtcBrowserTest
+#define MAYBE_WebRtcBrowserPermissionDeniedTest \
+ DISABLED_WebRtcBrowserPermissionDeniedTest
+#define MAYBE_WebRtcBrowserMultipleRoutesDisabledTest \
+ DISABLED_WebRtcBrowserMultipleRoutesDisabledTest
#else
#define MAYBE_WebRtcBrowserTest WebRtcBrowserTest
+#define MAYBE_WebRtcBrowserPermissionDeniedTest \
+ WebRtcBrowserPermissionDeniedTest
+#define MAYBE_WebRtcBrowserMultipleRoutesDisabledTest \
+ WebRtcBrowserMultipleRoutesDisabledTest
#endif
+// This class tests the scenario when permission to access mic or camera is
+// granted.
class MAYBE_WebRtcBrowserTest : public WebRtcContentBrowserTest {
public:
MAYBE_WebRtcBrowserTest() {}
~MAYBE_WebRtcBrowserTest() override {}
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ WebRtcContentBrowserTest::SetUpCommandLine(command_line);
+ // Automatically grant device permission.
+ AppendUseFakeUIForMediaStreamFlag();
+ }
+
+ protected:
// Convenience function since most peerconnection-call.html tests just load
// the page, kick off some javascript and wait for the title to change to OK.
void MakeTypicalPeerConnectionCall(const std::string& javascript) {
@@ -312,4 +329,67 @@ IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest, CallInsideIframe) {
MakeTypicalPeerConnectionCall("callInsideIframe({video: true, audio:true});");
}
+#if !defined(OS_ANDROID)
+// Test that when device permission is granted, we should have non-loopback
+// candidates.
+IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserTest,
+ GatherLocalCandidatesWithIceServersUndefined) {
+ MakeTypicalPeerConnectionCall("callWithDevicePermissionGranted();");
+}
+#endif
+
+// This class tests the scenario when permission to access mic or camera is
+// denied. This inherits from MAYBE_WebRtcBrowserTest but doesn't use the super
+// class's SetUpCommandLine.
+class MAYBE_WebRtcBrowserPermissionDeniedTest : public MAYBE_WebRtcBrowserTest {
+ public:
+ MAYBE_WebRtcBrowserPermissionDeniedTest() {}
+ ~MAYBE_WebRtcBrowserPermissionDeniedTest() override {}
+
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ WebRtcContentBrowserTest::SetUpCommandLine(command_line);
+ }
+};
+
+// Test that when device permission is denied, when passing empty array as
+// iceServers, no candidate will be gathered.
+IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserPermissionDeniedTest,
+ GatherLocalCandidatesWithEmptyArrayIceServers) {
+ MakeTypicalPeerConnectionCall(
+ "callWithDevicePermissionDeniedAndEmptyIceServers();");
+}
+
+// Test that when device permission is denied, when iceServers is undefined,
+// only loopback candidate will be gathered.
+IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserPermissionDeniedTest,
+ GatherLocalCandidatesWithIceServersUndefined) {
+ MakeTypicalPeerConnectionCall(
+ "callWithDevicePermissionDeniedAndUndefinedIceServers();");
+}
+
+// This class tests the scenario when multiple routes is not requested. This
+// inherits from MAYBE_WebRtcBrowserTest but doesn't use the super class's
+// SetUpCommandLine.
+class MAYBE_WebRtcBrowserMultipleRoutesDisabledTest
+ : public MAYBE_WebRtcBrowserTest {
+ public:
+ MAYBE_WebRtcBrowserMultipleRoutesDisabledTest() {}
+ ~MAYBE_WebRtcBrowserMultipleRoutesDisabledTest() override {}
+
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ WebRtcContentBrowserTest::SetUpCommandLine(command_line);
+ base::CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kDisableWebRtcMultipleRoutes);
+ }
+};
+
+// Test that when device permission is granted, but multiple routes is not
+// requested, with undefined iceServers, only loopback candidate will be
+// gathered.
+IN_PROC_BROWSER_TEST_F(MAYBE_WebRtcBrowserMultipleRoutesDisabledTest,
+ GatherLocalCandidatesWithIceServersUndefined) {
+ MakeTypicalPeerConnectionCall(
+ "callWithMultipleRoutesDisabledAndUndefinedIceServers();");
+}
+
} // namespace content
diff --git a/content/browser/media/webrtc_getusermedia_browsertest.cc b/content/browser/media/webrtc_getusermedia_browsertest.cc
index 15d9ca5..9d1bb51 100644
--- a/content/browser/media/webrtc_getusermedia_browsertest.cc
+++ b/content/browser/media/webrtc_getusermedia_browsertest.cc
@@ -77,7 +77,10 @@ namespace content {
class WebRtcGetUserMediaBrowserTest: public WebRtcContentBrowserTest {
public:
- WebRtcGetUserMediaBrowserTest() : trace_log_(NULL) {}
+ WebRtcGetUserMediaBrowserTest() : trace_log_(NULL) {
+ // Automatically grant device permission.
+ AppendUseFakeUIForMediaStreamFlag();
+ }
~WebRtcGetUserMediaBrowserTest() override {}
void StartTracing() {
@@ -743,7 +746,10 @@ class WebRtcConstraintsBrowserTest
: public WebRtcContentBrowserTest,
public testing::WithParamInterface<UserMediaSizes> {
public:
- WebRtcConstraintsBrowserTest() : user_media_(GetParam()) {}
+ WebRtcConstraintsBrowserTest() : user_media_(GetParam()) {
+ // Automatically grant device permission.
+ AppendUseFakeUIForMediaStreamFlag();
+ }
const UserMediaSizes& user_media() const { return user_media_; }
private:
diff --git a/content/browser/media/webrtc_internals_browsertest.cc b/content/browser/media/webrtc_internals_browsertest.cc
index b481559..a44fbe0 100644
--- a/content/browser/media/webrtc_internals_browsertest.cc
+++ b/content/browser/media/webrtc_internals_browsertest.cc
@@ -152,9 +152,8 @@ class MAYBE_WebRtcInternalsBrowserTest: public ContentBrowserTest {
~MAYBE_WebRtcInternalsBrowserTest() override {}
void SetUpOnMainThread() override {
- // Assume this is set by the content test launcher.
- ASSERT_TRUE(base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kUseFakeUIForMediaStream));
+ base::CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kUseFakeUIForMediaStream);
ASSERT_TRUE(base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kUseFakeDeviceForMediaStream));
}
diff --git a/content/browser/media/webrtc_webcam_browsertest.cc b/content/browser/media/webrtc_webcam_browsertest.cc
index 3c65ed9..5a7849c 100644
--- a/content/browser/media/webrtc_webcam_browsertest.cc
+++ b/content/browser/media/webrtc_webcam_browsertest.cc
@@ -47,7 +47,7 @@ class WebRtcWebcamBrowserTest: public ContentBrowserTest {
~WebRtcWebcamBrowserTest() override {}
void SetUpCommandLine(base::CommandLine* command_line) override {
- ASSERT_TRUE(command_line->HasSwitch(switches::kUseFakeUIForMediaStream));
+ command_line->AppendSwitch(switches::kUseFakeUIForMediaStream);
// The content_browsertests run with this flag by default, and this test is
// the only current exception to that rule, so just remove the flag
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index ae6be5c..8b96d45 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -1339,6 +1339,7 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
switches::kTouchTextSelectionStrategy,
switches::kTraceConfigFile,
switches::kTraceToConsole,
+ switches::kUseFakeUIForMediaStream,
// This flag needs to be propagated to the renderer process for
// --in-process-webgl.
switches::kUseGL,
@@ -1374,9 +1375,11 @@ void RenderProcessHostImpl::PropagateBrowserCommandLineToRenderer(
#if defined(ENABLE_WEBRTC)
switches::kDisableWebRtcHWDecoding,
switches::kDisableWebRtcHWEncoding,
+ switches::kDisableWebRtcMultipleRoutes,
switches::kEnableWebRtcDtls12,
switches::kEnableWebRtcHWH264Encoding,
switches::kEnableWebRtcStunOrigin,
+ switches::kEnforceWebRtcIPPermissionCheck,
switches::kWebRtcMaxCaptureFramerate,
#endif
switches::kEnableLowEndDeviceMode,
diff --git a/content/public/common/content_switches.cc b/content/public/common/content_switches.cc
index aa0cc6d..2a98bdb 100644
--- a/content/public/common/content_switches.cc
+++ b/content/public/common/content_switches.cc
@@ -840,6 +840,11 @@ const char kDisableWebRtcEncryption[] = "disable-webrtc-encryption";
// Disables HW encode acceleration for WebRTC.
const char kDisableWebRtcHWEncoding[] = "disable-webrtc-hw-encoding";
+// Disables Multiple routes option for WebRTC. The default behavior is always
+// requesting multiple routes. This is for test cases to mimic the behavior when
+// multiple routes is disabled from user preferences.
+const char kDisableWebRtcMultipleRoutes[] = "disable-webrtc-multiple-routes";
+
// Enables negotiation of DTLS 1.2 for WebRTC.
const char kEnableWebRtcDtls12[] = "enable-webrtc-dtls12";
@@ -849,6 +854,11 @@ const char kEnableWebRtcHWH264Encoding[] = "enable-webrtc-hw-h264-encoding";
// Enables Origin header in Stun messages for WebRTC.
const char kEnableWebRtcStunOrigin[] = "enable-webrtc-stun-origin";
+// Enforce IP Permission check. TODO(guoweis): Remove this once the feature is
+// not under finch and becomes the default.
+const char kEnforceWebRtcIPPermissionCheck[] =
+ "enforce-webrtc-ip-permission-check";
+
// Renderer process parameter for WebRTC Stun probe trial to determine the
// interval. Please see SetupStunProbeTrial in
// chrome_browser_field_trials_desktop.cc for more detail.
diff --git a/content/public/common/content_switches.h b/content/public/common/content_switches.h
index fe4a2fc..7812dc6 100644
--- a/content/public/common/content_switches.h
+++ b/content/public/common/content_switches.h
@@ -244,9 +244,11 @@ CONTENT_EXPORT extern const char kZygoteProcess[];
CONTENT_EXPORT extern const char kDisableWebRtcHWDecoding[];
CONTENT_EXPORT extern const char kDisableWebRtcEncryption[];
CONTENT_EXPORT extern const char kDisableWebRtcHWEncoding[];
+CONTENT_EXPORT extern const char kDisableWebRtcMultipleRoutes[];
CONTENT_EXPORT extern const char kEnableWebRtcDtls12[];
CONTENT_EXPORT extern const char kEnableWebRtcHWH264Encoding[];
CONTENT_EXPORT extern const char kEnableWebRtcStunOrigin[];
+CONTENT_EXPORT extern const char kEnforceWebRtcIPPermissionCheck[];
CONTENT_EXPORT extern const char kWebRtcStunProbeTrialParameter[];
extern const char kWebRtcMaxCaptureFramerate[];
#endif
diff --git a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
index b4f8c05..a4c1796 100644
--- a/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
+++ b/content/renderer/media/webrtc/peer_connection_dependency_factory.cc
@@ -8,6 +8,7 @@
#include "base/command_line.h"
#include "base/location.h"
+#include "base/logging.h"
#include "base/metrics/field_trial.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -431,25 +432,6 @@ PeerConnectionDependencyFactory::CreatePeerConnection(
// Copy the flag from Preference associated with this WebFrame.
P2PPortAllocator::Config port_config;
- if (web_frame && web_frame->view()) {
- RenderViewImpl* renderer_view_impl =
- RenderViewImpl::FromWebView(web_frame->view());
- if (renderer_view_impl) {
- // TODO(guoweis): |enable_multiple_routes| should be renamed to
- // |request_multiple_routes|. Whether local IP addresses could be
- // collected depends on if mic/camera permission is granted for this
- // origin.
- port_config.enable_multiple_routes =
- renderer_view_impl->renderer_preferences()
- .enable_webrtc_multiple_routes;
- port_config.enable_nonproxied_udp =
- renderer_view_impl->renderer_preferences()
- .enable_webrtc_nonproxied_udp;
- }
- }
-
- bool enforce_preferences =
- GetContentClient()->renderer()->ShouldEnforceWebRTCRoutingPreferences();
// |media_permission| will be called to check mic/camera permission. If at
// least one of them is granted, P2PPortAllocator is allowed to gather local
@@ -458,27 +440,51 @@ PeerConnectionDependencyFactory::CreatePeerConnection(
// case when either the experiment is not enabled or the preference is not
// enforced.
scoped_ptr<media::MediaPermission> media_permission;
- const std::string group_name =
- base::FieldTrialList::FindFullName("WebRTC-LocalIPPermissionCheck");
- if (enforce_preferences &&
- StartsWith(group_name, "Enabled", base::CompareCase::SENSITIVE) &&
- port_config.enable_multiple_routes) {
- RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(web_frame);
- if (render_frame) {
- media_permission = render_frame->CreateMediaPermissionProxy(
- chrome_worker_thread_.task_runner());
- DCHECK(media_permission);
- }
- }
-
- if (!enforce_preferences) {
- VLOG(3) << "WebRTC routing preferences will not be enforced";
+ if (!GetContentClient()
+ ->renderer()
+ ->ShouldEnforceWebRTCRoutingPreferences()) {
port_config.enable_multiple_routes = true;
port_config.enable_nonproxied_udp = true;
+ VLOG(3) << "WebRTC routing preferences will not be enforced";
} else {
- VLOG(3) << "WebRTC routing preferences: multiple_routes: "
- << port_config.enable_multiple_routes
- << ", nonproxied_udp: " << port_config.enable_nonproxied_udp;
+ if (web_frame && web_frame->view()) {
+ RenderViewImpl* renderer_view_impl =
+ RenderViewImpl::FromWebView(web_frame->view());
+ if (renderer_view_impl) {
+ // TODO(guoweis): |enable_multiple_routes| should be renamed to
+ // |request_multiple_routes|. Whether local IP addresses could be
+ // collected depends on if mic/camera permission is granted for this
+ // origin.
+ port_config.enable_multiple_routes =
+ renderer_view_impl->renderer_preferences()
+ .enable_webrtc_multiple_routes;
+ port_config.enable_nonproxied_udp =
+ renderer_view_impl->renderer_preferences()
+ .enable_webrtc_nonproxied_udp;
+ VLOG(3) << "WebRTC routing preferences: multiple_routes: "
+ << port_config.enable_multiple_routes
+ << ", nonproxied_udp: " << port_config.enable_nonproxied_udp;
+ }
+ }
+ if (port_config.enable_multiple_routes) {
+ bool create_media_permission =
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnforceWebRtcIPPermissionCheck);
+ create_media_permission =
+ create_media_permission ||
+ StartsWith(base::FieldTrialList::FindFullName(
+ "WebRTC-LocalIPPermissionCheck"),
+ "Enabled", base::CompareCase::SENSITIVE);
+ if (create_media_permission) {
+ content::RenderFrameImpl* render_frame =
+ content::RenderFrameImpl::FromWebFrame(web_frame);
+ if (render_frame) {
+ media_permission = render_frame->CreateMediaPermissionProxy(
+ chrome_worker_thread_.task_runner());
+ }
+ DCHECK(media_permission);
+ }
+ }
}
const GURL& requesting_origin =
diff --git a/content/shell/browser/shell.cc b/content/shell/browser/shell.cc
index b273931..8492827 100644
--- a/content/shell/browser/shell.cc
+++ b/content/shell/browser/shell.cc
@@ -19,6 +19,7 @@
#include "content/public/browser/render_view_host.h"
#include "content/public/browser/web_contents.h"
#include "content/public/browser/web_contents_observer.h"
+#include "content/public/common/content_switches.h"
#include "content/public/common/renderer_preferences.h"
#include "content/shell/browser/blink_test_controller.h"
#include "content/shell/browser/layout_test/layout_test_bluetooth_chooser_factory.h"
@@ -115,6 +116,14 @@ Shell* Shell::CreateShell(WebContents* web_contents,
web_contents->GetRenderViewHost()->SyncRendererPrefs();
}
+#if defined(ENABLE_WEBRTC)
+ if (base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kDisableWebRtcMultipleRoutes)) {
+ web_contents->GetMutableRendererPrefs()->enable_webrtc_multiple_routes =
+ false;
+ }
+#endif
+
return shell;
}
diff --git a/content/shell/browser/shell_permission_manager.cc b/content/shell/browser/shell_permission_manager.cc
index 7c591d8..e8e3e71 100644
--- a/content/shell/browser/shell_permission_manager.cc
+++ b/content/shell/browser/shell_permission_manager.cc
@@ -5,7 +5,10 @@
#include "content/shell/browser/shell_permission_manager.h"
#include "base/callback.h"
+#include "base/command_line.h"
#include "content/public/browser/permission_type.h"
+#include "content/public/common/content_switches.h"
+#include "media/base/media_switches.h"
namespace content {
@@ -40,6 +43,13 @@ PermissionStatus ShellPermissionManager::GetPermissionStatus(
PermissionType permission,
const GURL& requesting_origin,
const GURL& embedding_origin) {
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if ((permission == PermissionType::AUDIO_CAPTURE ||
+ permission == PermissionType::VIDEO_CAPTURE) &&
+ command_line->HasSwitch(switches::kUseFakeDeviceForMediaStream) &&
+ command_line->HasSwitch(switches::kUseFakeUIForMediaStream)) {
+ return PERMISSION_STATUS_GRANTED;
+ }
return PERMISSION_STATUS_DENIED;
}
diff --git a/content/test/content_test_launcher.cc b/content/test/content_test_launcher.cc
index 46e6392..bfe894a 100644
--- a/content/test/content_test_launcher.cc
+++ b/content/test/content_test_launcher.cc
@@ -109,7 +109,6 @@ class ContentTestLauncherDelegate : public TestLauncherDelegate {
command_line->AppendSwitchPath(switches::kContentShellDataPath,
temp_data_dir);
command_line->AppendSwitch(switches::kUseFakeDeviceForMediaStream);
- command_line->AppendSwitch(switches::kUseFakeUIForMediaStream);
return true;
}
diff --git a/content/test/data/media/peerconnection-call.html b/content/test/data/media/peerconnection-call.html
index fae3e9a..836f14d 100644
--- a/content/test/data/media/peerconnection-call.html
+++ b/content/test/data/media/peerconnection-call.html
@@ -810,6 +810,69 @@
});
}
+ function iceCandidateIsLoopback(candidate) {
+ return candidate.candidate.indexOf("127.0.0.1") > -1 ||
+ candidate.candidate.indexOf("::1") > -1;
+ }
+
+ // Helper function to invoke |callback| when gathering is completed.
+ function gatherIceCandidates(pc, callback) {
+ var candidates = [];
+ pc.createDataChannel("");
+ pc.onicecandidate = function(event) {
+ // null candidate indicates the gathering has completed.
+ if (event.candidate == null) {
+ callback(candidates);
+ } else {
+ candidates.push(event.candidate);
+ }
+ }
+ pc.createOffer(
+ function(offer) {
+ pc.setLocalDescription(offer);
+ },
+ function(error) { failTest(error); }
+ );
+ }
+
+ function callWithDevicePermissionGranted() {
+ var pc = new webkitRTCPeerConnection(null, null);
+ gatherIceCandidates(pc, function(candidates) {
+ assertEquals(candidates.length > 0, true);
+ for (i = 0; i < candidates.length; i++) {
+ assertEquals(iceCandidateIsLoopback(candidates[i]), false);
+ }
+ reportTestSuccess();
+ });
+ }
+
+ function callWithDevicePermissionDeniedAndEmptyIceServers() {
+ var pc = new webkitRTCPeerConnection({iceServers:[]}, null);
+ gatherIceCandidates(pc, function(candidates) {
+ assertEquals(candidates.length, 0);
+ reportTestSuccess();
+ });
+ }
+
+ function callAndExpectLoopbackCandidates() {
+ var pc = new webkitRTCPeerConnection(null, null);
+ gatherIceCandidates(pc, function(candidates) {
+ assertEquals(candidates.length > 0, true);
+ for (i = 0; i < candidates.length; i++) {
+ assertEquals(iceCandidateIsLoopback(candidates[i]), true);
+ }
+ reportTestSuccess();
+ });
+ }
+
+ function callWithDevicePermissionDeniedAndUndefinedIceServers() {
+ callAndExpectLoopbackCandidates();
+ }
+
+ function callWithMultipleRoutesDisabledAndUndefinedIceServers() {
+ callAndExpectLoopbackCandidates();
+ }
+
function onOfferCreated(offer, caller, callee) {
offer.sdp = transformSdp(offer.sdp);
console.log('Offer:\n' + offer.sdp);
diff --git a/content/test/ppapi/ppapi_test.cc b/content/test/ppapi/ppapi_test.cc
index 58da124..42644e4 100644
--- a/content/test/ppapi/ppapi_test.cc
+++ b/content/test/ppapi/ppapi_test.cc
@@ -53,6 +53,8 @@ void PPAPITestBase::SetUpCommandLine(base::CommandLine* command_line) {
// Allow manual garbage collection.
command_line->AppendSwitchASCII(switches::kJavaScriptFlags, "--expose_gc");
+
+ command_line->AppendSwitch(switches::kUseFakeUIForMediaStream);
}
GURL PPAPITestBase::GetTestFileUrl(const std::string& test_case) {
diff --git a/content/test/webrtc_content_browsertest_base.cc b/content/test/webrtc_content_browsertest_base.cc
index b01ac53..bcf7702 100644
--- a/content/test/webrtc_content_browsertest_base.cc
+++ b/content/test/webrtc_content_browsertest_base.cc
@@ -25,16 +25,18 @@ namespace content {
void WebRtcContentBrowserTest::SetUpCommandLine(
base::CommandLine* command_line) {
- // Assume this is set by the content test launcher.
- ASSERT_TRUE(base::CommandLine::ForCurrentProcess()->HasSwitch(
- switches::kUseFakeUIForMediaStream));
ASSERT_TRUE(base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kUseFakeDeviceForMediaStream));
- // Always include loopback interface in network list, in case the test device
- // doesn't have other interfaces available.
+ base::CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnforceWebRtcIPPermissionCheck);
+
+#if defined(OS_ANDROID)
+ // For OS_ANDROID, include loopback interface in network list, in case the
+ // test device doesn't have other interfaces available.
base::CommandLine::ForCurrentProcess()->AppendSwitch(
switches::kAllowLoopbackInPeerConnection);
+#endif
}
void WebRtcContentBrowserTest::SetUp() {
@@ -53,6 +55,13 @@ void WebRtcContentBrowserTest::TearDown() {
#endif
}
+void WebRtcContentBrowserTest::AppendUseFakeUIForMediaStreamFlag() {
+ ASSERT_FALSE(base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kUseFakeUIForMediaStream));
+ base::CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kUseFakeUIForMediaStream);
+}
+
// Executes |javascript|. The script is required to use
// window.domAutomationController.send to send a string value back to here.
std::string WebRtcContentBrowserTest::ExecuteJavascriptAndReturnResult(
diff --git a/content/test/webrtc_content_browsertest_base.h b/content/test/webrtc_content_browsertest_base.h
index b81ba52..2380cb7 100644
--- a/content/test/webrtc_content_browsertest_base.h
+++ b/content/test/webrtc_content_browsertest_base.h
@@ -18,6 +18,9 @@ class WebRtcContentBrowserTest: public ContentBrowserTest {
void TearDown() override;
protected:
+ // Helper function to append "--use-fake-ui-for-media-stream".
+ void AppendUseFakeUIForMediaStreamFlag();
+
// Executes |javascript|. The script is required to use
// window.domAutomationController.send to send a string value back to here.
std::string ExecuteJavascriptAndReturnResult(
diff --git a/testing/android/native_test/java/src/org/chromium/native_test/NativeBrowserTestActivity.java b/testing/android/native_test/java/src/org/chromium/native_test/NativeBrowserTestActivity.java
index 290888c..cc056c4 100644
--- a/testing/android/native_test/java/src/org/chromium/native_test/NativeBrowserTestActivity.java
+++ b/testing/android/native_test/java/src/org/chromium/native_test/NativeBrowserTestActivity.java
@@ -22,10 +22,7 @@ public abstract class NativeBrowserTestActivity extends NativeTestActivity {
"--single_process",
// switches::kUseFakeDeviceForMediaStream
- "--use-fake-device-for-media-stream",
-
- // switches::kUseFakeUIForMediaStream
- "--use-fake-ui-for-media-stream"
+ "--use-fake-device-for-media-stream"
};
@Override