Commit 60658b24 authored by evliu's avatar evliu Committed by Commit Bot

Add command line switch to enable the Live Caption pref

This CL adds a command line switch that enables the kLiveCaptionEnabled
preference which will make it easier to add Swarming tests.

Bug: 1122784
Change-Id: I27f0f4ae4a0b19b97f454336f1ca5f372b1e50cc
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2382961Reviewed-by: default avatarDominic Mazzoni <dmazzoni@chromium.org>
Reviewed-by: default avatarBecca Hughes <beccahughes@chromium.org>
Commit-Queue: Evan Liu <evliu@google.com>
Cr-Commit-Position: refs/heads/master@{#803205}
parent 7c122bf9
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include <string> #include <string>
#include "base/bind.h" #include "base/bind.h"
#include "base/command_line.h"
#include "base/feature_list.h" #include "base/feature_list.h"
#include "base/metrics/histogram_functions.h" #include "base/metrics/histogram_functions.h"
#include "chrome/browser/accessibility/caption_util.h" #include "chrome/browser/accessibility/caption_util.h"
...@@ -66,6 +67,12 @@ void CaptionController::Init() { ...@@ -66,6 +67,12 @@ void CaptionController::Init() {
pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>(); pref_change_registrar_ = std::make_unique<PrefChangeRegistrar>();
pref_change_registrar_->Init(profile_->GetPrefs()); pref_change_registrar_->Init(profile_->GetPrefs());
auto* command_line = base::CommandLine::ForCurrentProcess();
if (command_line &&
command_line->HasSwitch(switches::kEnableLiveCaptionPrefForTesting)) {
profile_->GetPrefs()->SetBoolean(prefs::kLiveCaptionEnabled, true);
}
pref_change_registrar_->Add( pref_change_registrar_->Add(
prefs::kLiveCaptionEnabled, prefs::kLiveCaptionEnabled,
base::BindRepeating(&CaptionController::OnLiveCaptionEnabledChanged, base::BindRepeating(&CaptionController::OnLiveCaptionEnabledChanged,
......
...@@ -183,6 +183,10 @@ const char kOverrideEnabledCdmInterfaceVersion[] = ...@@ -183,6 +183,10 @@ const char kOverrideEnabledCdmInterfaceVersion[] =
const char kOverrideHardwareSecureCodecsForTesting[] = const char kOverrideHardwareSecureCodecsForTesting[] =
"override-hardware-secure-codecs-for-testing"; "override-hardware-secure-codecs-for-testing";
// Sets the default value for the kLiveCaptionEnabled preference to true.
const char kEnableLiveCaptionPrefForTesting[] =
"enable-live-caption-pref-for-testing";
#if defined(OS_CHROMEOS) #if defined(OS_CHROMEOS)
// ChromeOS uses one of two VideoDecoder implementations based on SoC/board // ChromeOS uses one of two VideoDecoder implementations based on SoC/board
// specific configurations that are signalled via this command line flag. // specific configurations that are signalled via this command line flag.
......
...@@ -85,6 +85,7 @@ MEDIA_EXPORT extern const char kMSEVideoBufferSizeLimitMb[]; ...@@ -85,6 +85,7 @@ MEDIA_EXPORT extern const char kMSEVideoBufferSizeLimitMb[];
MEDIA_EXPORT extern const char kClearKeyCdmPathForTesting[]; MEDIA_EXPORT extern const char kClearKeyCdmPathForTesting[];
MEDIA_EXPORT extern const char kOverrideEnabledCdmInterfaceVersion[]; MEDIA_EXPORT extern const char kOverrideEnabledCdmInterfaceVersion[];
MEDIA_EXPORT extern const char kOverrideHardwareSecureCodecsForTesting[]; MEDIA_EXPORT extern const char kOverrideHardwareSecureCodecsForTesting[];
MEDIA_EXPORT extern const char kEnableLiveCaptionPrefForTesting[];
namespace autoplay { namespace autoplay {
......
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