Commit ad8113c4 authored by Luke Halliwell's avatar Luke Halliwell Committed by Commit Bot

[Chromecast] Reconcile chromecast/ with local branch.

Bits of code have snuck into the local branch without making it
upstream. Add all of those bits here.

Bug: None
Test: Cast CQ
Change-Id: I6e042ae5dd83653e3f3656fcc9559e7b71a77c9c
Reviewed-on: https://chromium-review.googlesource.com/c/1300613Reviewed-by: default avatarLuke Halliwell <halliwell@chromium.org>
Reviewed-by: default avatarSimeon Anfinrud <sanfin@chromium.org>
Reviewed-by: default avatarYuchen Liu <yucliu@chromium.org>
Reviewed-by: default avatarSergey Volk <servolk@chromium.org>
Commit-Queue: Luke Halliwell <halliwell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#603192}
parent b4f12f9a
......@@ -135,6 +135,15 @@ cast_test_group("cast_tests") {
"--enable-local-file-accesses",
"--test-launcher-jobs=1",
]
gtest_excludes = []
# TODO(b/112440248): This test was failing:
# * On v1 and Cast Audio devices since 2017-03-15.
# * On desktop builds since 2018-08-22
# Also see: b/36238710, b/36239051, hotlist/461351
gtest_excludes += [ "RendererPrelauncherTest.ReusedRenderer" ]
if (!is_cast_desktop_build) {
args += [ "--use-gpu-in-tests" ]
......@@ -142,19 +151,10 @@ cast_test_group("cast_tests") {
# Once all of the CastMediaBlockerTest.* have been un-DISABLEd and
# are running successfully, revisit these tests and see if they pass
# on devices. (crbug/665118, internal b/32023194)
gtest_excludes = [
gtest_excludes += [
"CastMediaBlockerBrowserTest.Video_BlockUnblock",
"CastMediaBlockerBrowserTest.Audio_BlockUnblock",
]
# TODO(mbjorge): The ReusedRenderer test is failing on v1 and cast audio
# devices. Temporarily disable them as part of an effort_to re-green
# the unittests. Current failures (2017-03-15) are being disabled to get
# back to a green state. Re-enable once the tests have been fixed.
# Limitations in the build mean this unfortunately is getting disabled
# across all devices, even though it is only failing on some.
# b/36238710, b/36239051, hotlist/461351
gtest_excludes += [ "RendererPrelauncherTest.ReusedRenderer" ]
}
if (!is_cast_desktop_build && !is_cast_audio_only && !enable_assistant) {
......@@ -202,11 +202,8 @@ cast_test_group("cast_tests") {
gtest_excludes = []
if (target_os == "linux") {
if (is_cast_desktop_build) {
# Disable PartitionAllocDeathTest.Repeated*ReturnNullDirect (b/67975693)
gtest_excludes += [
"PartitionAllocDeathTest.RepeatedAllocReturnNullDirect",
"PartitionAllocDeathTest.RepeatedReallocReturnNullDirect",
]
# Disable PartitionAllocDeathTest.* (b/67975693)
gtest_excludes += [ "PartitionAllocDeathTest.*" ]
} else {
# Disable ProcessMetricsTest.GetNumberOfThreads (b/15610509)
# Disable ProcessUtilTest.* (need to define OS_ANDROID)
......@@ -235,11 +232,15 @@ cast_test_group("cast_tests") {
cc_unittests_filter = {
test_name = "cc_unittests"
# Temporarily disable all test cases (b/113324890)
gtest_excludes = [ "*" ]
if (!is_cast_desktop_build) {
#Disable ToColorSpace/ColorTransformPixelTest* (b/64346790)
#Disable ImageBackgroundFilter* (b/64346875)
#Disable LayerTreeHostTilesTestPartialInvalidation* (b/65844132)
gtest_excludes = [
gtest_excludes += [
"ToColorSpace/ColorTransformPixelTest.*",
"ImageBackgroundFilter.*",
"LayerTreeHostTilesTestPartialInvalidation.*",
......
......@@ -62,7 +62,7 @@ std::vector<std::string> CastSysInfo::GetFactoryLocaleList() {
#if BUILDFLAG(IS_ANDROID_THINGS_NON_PUBLIC)
JNIEnv* env = base::android::AttachCurrentThread();
base::android::AppendJavaStringArrayToStringVector(
env, Java_CastSysInfoAndroidThings_getFactoryLocaleList(env).obj(),
env, Java_CastSysInfoAndroidThings_getFactoryLocaleList(env),
&locale_list);
#endif
return locale_list;
......
......@@ -149,7 +149,7 @@ void CreateMediaDrmStorage(content::RenderFrameHost* render_frame_host,
PrefService* pref_service = CastBrowserProcess::GetInstance()->pref_service();
DCHECK(pref_service);
if (render_frame_host->GetLastCommittedOrigin().unique()) {
if (render_frame_host->GetLastCommittedOrigin().opaque()) {
DVLOG(1) << __func__ << ": Unique origin.";
return;
}
......
......@@ -54,10 +54,11 @@ class CastMediaBlockerBrowserTest : public CastBrowserTest {
// Changing states is not instant, but should be timely (< 0.5s).
for (size_t i = 0; i < 5; i++) {
LOG(INFO) << "Checking media blocking, re-try = " << i;
base::RunLoop run_loop(base::RunLoop::Type::kNestableTasksAllowed);
base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
FROM_HERE, run_loop.QuitClosure(),
base::TimeDelta::FromMilliseconds(50));
base::TimeDelta::FromMilliseconds(100));
run_loop.Run();
const std::string command =
......
......@@ -27,20 +27,22 @@ NetworkContextManager::NetworkContextManager(
network_service_for_test_(std::move(network_service)),
weak_factory_(this) {
DCHECK(url_request_context_getter_);
weak_ptr_ = weak_factory_.GetWeakPtr();
// The NetworkContext must be initialized on the browser's IO thread. Posting
// this task from the constructor ensures that |network_context_| will
// be initialized for subsequent calls to BindRequestOnIOThread().
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::IO},
base::BindOnce(&NetworkContextManager::InitializeOnIoThread,
weak_factory_.GetWeakPtr()));
base::BindOnce(&NetworkContextManager::InitializeOnIOThread,
GetWeakPtr()));
}
NetworkContextManager::~NetworkContextManager() {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
}
void NetworkContextManager::InitializeOnIoThread() {
void NetworkContextManager::InitializeOnIOThread() {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
network::NetworkService* network_service =
......@@ -62,17 +64,31 @@ void NetworkContextManager::BindRequestOnIOThread(
std::move(request), std::move(url_loader_factory_params));
}
void NetworkContextManager::GetProxyResolvingSocketFactoryOnIOThread(
network::mojom::ProxyResolvingSocketFactoryRequest request) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
network_context_->CreateProxyResolvingSocketFactory(std::move(request));
}
network::mojom::URLLoaderFactoryPtr
NetworkContextManager::GetURLLoaderFactory() {
network::mojom::URLLoaderFactoryPtr loader_factory;
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::IO},
base::BindOnce(&NetworkContextManager::BindRequestOnIOThread,
weak_factory_.GetWeakPtr(),
mojo::MakeRequest(&loader_factory)));
GetWeakPtr(), mojo::MakeRequest(&loader_factory)));
return loader_factory;
}
void NetworkContextManager::GetProxyResolvingSocketFactory(
network::mojom::ProxyResolvingSocketFactoryRequest request) {
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::IO},
base::BindOnce(
&NetworkContextManager::GetProxyResolvingSocketFactoryOnIOThread,
GetWeakPtr(), std::move(request)));
}
// static
NetworkContextManager* NetworkContextManager::CreateForTest(
scoped_refptr<net::URLRequestContextGetter> url_request_context_getter,
......
......@@ -53,6 +53,14 @@ class NetworkContextManager {
// calling thread. The caller owns the returned interface pointer.
network::mojom::URLLoaderFactoryPtr GetURLLoaderFactory();
// Creates a ProxyResolvingSocketFactory asynchronously on the IO thread, and
// binds it to |request|. This may be called from any thread.
void GetProxyResolvingSocketFactory(
network::mojom::ProxyResolvingSocketFactoryRequest request);
// Get a WeakPtr to this object.
base::WeakPtr<NetworkContextManager> GetWeakPtr() { return weak_ptr_; }
// Creates a NetworkContextManager for testing, so that a fake NetworkService
// can be created on the IO thread and injected into this class. Caller owns
// the returned instance. Returns the object unwrapped so that it can be
......@@ -70,12 +78,18 @@ class NetworkContextManager {
std::unique_ptr<network::NetworkService> network_service);
// Initializes the NetworkContext. Posted to the IO thread from the ctor.
void InitializeOnIoThread();
void InitializeOnIOThread();
// Posted to the IO thread whenever GetURLLoaderFactoryPtr() is called.
// Guaranteed to be called after InitializeOnIoThread().
void BindRequestOnIOThread(network::mojom::URLLoaderFactoryRequest request);
// Create a proxy-resolving socket factory using the |network_context_| on the
// IO thread. Posted from RequestProxyResolvingSocketFactory(). Guaranteed to
// be called after InitializeOnIoThread().
void GetProxyResolvingSocketFactoryOnIOThread(
network::mojom::ProxyResolvingSocketFactoryRequest request);
// The underlying URLRequestContextGetter. The reference may only be released
// after the NetworkContext has been destroyed.
const scoped_refptr<net::URLRequestContextGetter> url_request_context_getter_;
......@@ -89,6 +103,7 @@ class NetworkContextManager {
std::unique_ptr<network::NetworkContext> network_context_;
network::mojom::NetworkContextPtr network_context_ptr_;
base::WeakPtr<NetworkContextManager> weak_ptr_;
base::WeakPtrFactory<NetworkContextManager> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(NetworkContextManager);
......
......@@ -28,7 +28,7 @@ public final class VolumeMap {
private static final int DEVICE_TYPE = AudioDeviceInfo.TYPE_BUILTIN_SPEAKER;
private static AudioManager sAudioManager = null;
private static AudioManager sAudioManager;
// Mapping from Android's stream_type to Cast's AudioContentType (used for callback).
private static final SparseIntArray ANDROID_TYPE_TO_CAST_TYPE_MAP = new SparseIntArray(4) {
......
......@@ -61,13 +61,13 @@ class PostProcessingPipelineImpl : public PostProcessingPipeline {
void UpdateCastVolume(float multiplier);
std::string name_;
int sample_rate_;
int sample_rate_ = 0;
int ringing_time_in_frames_ = 0;
int silence_frames_processed_ = 0;
int total_delay_frames_ = 0;
float current_multiplier_;
float cast_volume_;
float current_dbfs_;
float current_multiplier_ = 0.0;
float cast_volume_ = 0.0;
float current_dbfs_ = 0.0;
int num_output_channels_ = 0;
float* output_buffer_ = nullptr;
......
......@@ -47,5 +47,6 @@ cast_source_set("base") {
"//chromecast/media/base:media_codec_support",
"//media",
"//media:shared_memory_support",
"//ui/gfx",
]
}
......@@ -84,7 +84,7 @@ class PlayReadyKeySystemProperties : public ::media::KeySystemProperties {
: EmeSessionTypeSupport::NOT_SUPPORTED;
}
EmeSessionTypeSupport GetPersistentReleaseMessageSessionSupport()
EmeSessionTypeSupport GetPersistentUsageRecordSessionSupport()
const override {
return EmeSessionTypeSupport::NOT_SUPPORTED;
}
......@@ -96,9 +96,11 @@ class PlayReadyKeySystemProperties : public ::media::KeySystemProperties {
return EmeFeatureSupport::ALWAYS_ENABLED;
}
bool IsEncryptionSchemeSupported(
EmeConfigRule GetEncryptionSchemeConfigRule(
::media::EncryptionMode encryption_mode) const override {
return encryption_mode == ::media::EncryptionMode::kCenc;
if (encryption_mode == ::media::EncryptionMode::kCenc)
return EmeConfigRule::SUPPORTED;
return EmeConfigRule::NOT_SUPPORTED;
}
private:
......
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