Commit c1cf87d1 authored by Takumi Fujimoto's avatar Takumi Fujimoto Committed by Commit Bot

Add DialMediaRouteProvider and MirroringService to field trial test config

Enable the features in tests in waterfall. Disable DialMediaRouteProvider
in unrelated tests that fail because of it.

Bug: 956609,956621
Change-Id: I930296900b4f452652785892e73d9860814aff88
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1620548Reviewed-by: default avatarmark a. foltz <mfoltz@chromium.org>
Reviewed-by: default avatarNik Bhagat <nikunjb@chromium.org>
Reviewed-by: default avatarRebekah Potter <rbpotter@chromium.org>
Commit-Queue: Takumi Fujimoto <takumif@chromium.org>
Cr-Commit-Position: refs/heads/master@{#666335}
parent 374e16d6
......@@ -42,6 +42,8 @@ const base::Feature kEnableCastDiscovery{"EnableCastDiscovery",
const base::Feature kCastMediaRouteProvider{"CastMediaRouteProvider",
base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kCastAllowAllIPsFeature{"CastAllowAllIPs",
base::FEATURE_DISABLED_BY_DEFAULT};
#endif
#if defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
......@@ -67,7 +69,7 @@ bool MediaRouterEnabled(content::BrowserContext* context) {
// The component extension cannot be loaded in guest sessions.
// TODO(crbug.com/756243): Figure out why.
return !Profile::FromBrowserContext(context)->IsGuestSession();
#else // !(defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS))
#else // !(defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS))
return false;
#endif // defined(OS_ANDROID) || BUILDFLAG(ENABLE_EXTENSIONS)
}
......@@ -84,9 +86,6 @@ void RegisterProfilePrefs(PrefRegistrySimple* registry) {
PrefRegistry::PUBLIC);
}
const base::Feature kCastAllowAllIPsFeature{"CastAllowAllIPs",
base::FEATURE_DISABLED_BY_DEFAULT};
bool GetCastAllowAllIPsPref(PrefService* pref_service) {
auto* pref = pref_service->FindPreference(prefs::kMediaRouterCastAllowAllIPs);
......
......@@ -21,6 +21,16 @@ bool MediaRouterEnabled(content::BrowserContext* context);
#if !defined(OS_ANDROID)
extern const base::Feature kDialMediaRouteProvider;
// TODO(crbug.com/969091): This feature is now enabled by default, and the flag
// should be removed.
extern const base::Feature kEnableCastDiscovery;
extern const base::Feature kCastMediaRouteProvider;
// If enabled, allows Media Router to connect to Cast devices on all IP
// addresses, not just RFC1918/RFC4193 private addresses. Workaround for
// https://crbug.com/813974.
extern const base::Feature kCastAllowAllIPsFeature;
namespace prefs {
// Pref name for the enterprise policy for allowing Cast devices on all IPs.
constexpr char kMediaRouterCastAllowAllIPs[] =
......@@ -37,11 +47,6 @@ void RegisterLocalStatePrefs(PrefRegistrySimple* registry);
// Registers Media Router related preferences with per-profile pref |registry|.
void RegisterProfilePrefs(PrefRegistrySimple* registry);
// If enabled, allows Media Router to connect to Cast devices on all IP
// addresses, not just RFC1918/RFC4193 private addresses. Workaround for
// https://crbug.com/813974.
extern const base::Feature kCastAllowAllIPsFeature;
// Returns true if CastMediaSinkService can connect to Cast devices on
// all IPs, as determined by local state |pref_service| / feature flag.
bool GetCastAllowAllIPsPref(PrefService* pref_service);
......@@ -51,10 +56,6 @@ bool GetCastAllowAllIPsPref(PrefService* pref_service);
// randomly generated string and stored in |pref_service|.
std::string GetReceiverIdHashToken(PrefService* pref_service);
extern const base::Feature kEnableDialSinkQuery;
extern const base::Feature kEnableCastDiscovery;
extern const base::Feature kCastMediaRouteProvider;
// Returns true if browser side DIAL Media Route Provider is enabled.
bool DialMediaRouteProviderEnabled();
......@@ -67,6 +68,8 @@ bool CastMediaRouteProviderEnabled();
// Returns true if the Views implementation of the Cast dialog should be used.
// Returns false if the WebUI implementation should be used.
// TODO(crbug.com/969098): The feature is now enabled by default. Remove this
// function.
bool ShouldUseViewsDialog();
// Returns true if Mirroring Service should be used for mirroring.
......
......@@ -17,9 +17,11 @@
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
#include "base/test/bind_test_util.h"
#include "base/test/scoped_feature_list.h"
#include "base/threading/thread_task_runner_handle.h"
#include "build/build_config.h"
#include "chrome/browser/local_discovery/test_service_discovery_client.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/media/router/providers/cast/dual_media_sink_service.h"
#include "chrome/browser/media/router/test/noop_dual_media_sink_service.h"
#include "chrome/browser/profiles/profile.h"
......@@ -347,6 +349,7 @@ class LocalDiscoveryUITest : public WebUIBrowserTest {
// a DCHECK during TestServiceDiscoveryClient construction.
media_router::DualMediaSinkService::SetInstanceForTest(
new media_router::NoopDualMediaSinkService());
feature_list_.InitAndDisableFeature(media_router::kDialMediaRouteProvider);
WebUIBrowserTest::SetUp();
}
......@@ -444,6 +447,7 @@ class LocalDiscoveryUITest : public WebUIBrowserTest {
network::TestURLLoaderFactory test_url_loader_factory_;
local_discovery::LocalDiscoveryUIHandler::SetURLLoaderFactoryForTesting
set_url_loader_factory_;
base::test::ScopedFeatureList feature_list_;
DISALLOW_COPY_AND_ASSIGN(LocalDiscoveryUITest);
};
......
......@@ -9,10 +9,12 @@
#include "base/files/file_path.h"
#include "base/memory/ptr_util.h"
#include "base/task/post_task.h"
#include "base/test/scoped_feature_list.h"
#include "base/timer/mock_timer.h"
#include "build/build_config.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/media/router/media_router_feature.h"
#include "chrome/browser/media/router/providers/cast/dual_media_sink_service.h"
#include "chrome/browser/media/router/test/noop_dual_media_sink_service.h"
#include "chrome/browser/ui/browser.h"
......@@ -46,21 +48,21 @@ using ::cast_channel::Logger;
using ::cast_channel::MockCastSocket;
using ::cast_channel::MockCastTransport;
using ::cast_channel::ReadyState;
using extensions::Extension;
using extensions::api::cast_channel::ErrorInfo;
using extensions::api::cast_channel::MessageInfo;
using extensions::Extension;
namespace utils = extension_function_test_utils;
using ::testing::_;
using ::testing::A;
using ::testing::DoAll;
using ::testing::Invoke;
using ::testing::InSequence;
using ::testing::Invoke;
using ::testing::NotNull;
using ::testing::Return;
using ::testing::ReturnRef;
using ::testing::ReturnPointee;
using ::testing::ReturnRef;
using ::testing::SaveArg;
using ::testing::WithArgs;
......@@ -99,6 +101,7 @@ class CastChannelAPITest : public extensions::ExtensionApiTest {
// Stub out DualMediaSinkService so it does not interfere with the test.
media_router::DualMediaSinkService::SetInstanceForTest(
new media_router::NoopDualMediaSinkService());
feature_list_.InitAndDisableFeature(media_router::kDialMediaRouteProvider);
extensions::ExtensionApiTest::SetUp();
}
......@@ -233,7 +236,7 @@ class CastChannelAPITest : public extensions::ExtensionApiTest {
extensions::CastChannelOpenFunction* CreateOpenFunction(
scoped_refptr<const Extension> extension) {
extensions::CastChannelOpenFunction* cast_channel_open_function =
new extensions::CastChannelOpenFunction;
new extensions::CastChannelOpenFunction;
cast_channel_open_function->set_extension(extension.get());
return cast_channel_open_function;
}
......@@ -241,7 +244,7 @@ class CastChannelAPITest : public extensions::ExtensionApiTest {
extensions::CastChannelSendFunction* CreateSendFunction(
scoped_refptr<const Extension> extension) {
extensions::CastChannelSendFunction* cast_channel_send_function =
new extensions::CastChannelSendFunction;
new extensions::CastChannelSendFunction;
cast_channel_send_function->set_extension(extension.get());
return cast_channel_send_function;
}
......@@ -252,6 +255,7 @@ class CastChannelAPITest : public extensions::ExtensionApiTest {
CastSocket::Observer* message_observer_;
net::TestNetLog capturing_net_log_;
int channel_id_;
base::test::ScopedFeatureList feature_list_;
};
ACTION_P2(InvokeObserverOnError, api_test, cast_socket_service) {
......@@ -274,8 +278,8 @@ ACTION_P2(InvokeObserverOnError, api_test, cast_socket_service) {
IN_PROC_BROWSER_TEST_F(CastChannelAPITest, MAYBE_TestOpenSendClose) {
SetUpOpenSendClose();
EXPECT_TRUE(RunExtensionSubtest("cast_channel/api",
"test_open_send_close.html"));
EXPECT_TRUE(
RunExtensionSubtest("cast_channel/api", "test_open_send_close.html"));
}
// TODO(kmarshall): Win Dbg has a workaround that makes RunExtensionSubtest
......@@ -371,8 +375,8 @@ IN_PROC_BROWSER_TEST_F(CastChannelAPITest, MAYBE_TestOpenReceiveClose) {
.WillOnce(Return(ReadyState::CLOSED));
}
EXPECT_TRUE(RunExtensionSubtest("cast_channel/api",
"test_open_receive_close.html"));
EXPECT_TRUE(
RunExtensionSubtest("cast_channel/api", "test_open_receive_close.html"));
extensions::ResultCatcher catcher;
CallOnMessage("some-message");
......@@ -405,8 +409,7 @@ IN_PROC_BROWSER_TEST_F(CastChannelAPITest, MAYBE_TestOpenError) {
EXPECT_CALL(*mock_cast_socket_, Close(_))
.WillOnce(InvokeCompletionCallback<0>(net::OK));
EXPECT_TRUE(RunExtensionSubtest("cast_channel/api",
"test_open_error.html"));
EXPECT_TRUE(RunExtensionSubtest("cast_channel/api", "test_open_error.html"));
}
IN_PROC_BROWSER_TEST_F(CastChannelAPITest, TestOpenInvalidConnectInfo) {
......
......@@ -1766,6 +1766,24 @@
]
}
],
"DialMediaRouteProvider": [
{
"platforms": [
"chromeos",
"linux",
"mac",
"windows"
],
"experiments": [
{
"name": "Enabled",
"enable_features": [
"DialMediaRouteProvider"
]
}
]
}
],
"DirectCompositionGpuVSync": [
{
"platforms": [
......@@ -3027,6 +3045,24 @@
]
}
],
"MirroringService": [
{
"platforms": [
"chromeos",
"linux",
"mac",
"windows"
],
"experiments": [
{
"name": "Enabled",
"enable_features": [
"MirroringService"
]
}
]
}
],
"ModernMediaControls": [
{
"platforms": [
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment