0

Remove variable shadowing in Blink.

This makes changes a few places outside Blink where necessary.

Bug: 294205
Change-Id: Ie74fa4a1d1ce5565c8ecbd618130e42fdbc01327
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3094519
Reviewed-by: Ionel Popescu <iopopesc@microsoft.com>
Reviewed-by: Ken Rockot <rockot@google.com>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Ryan Sturm <ryansturm@chromium.org>
Reviewed-by: Eugene Zemtsov <eugene@chromium.org>
Reviewed-by: Victor Costan <pwnall@chromium.org>
Reviewed-by: Kent Tamura <tkent@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#912739}
This commit is contained in:
Peter Kasting
2021-08-17 21:03:43 +00:00
committed by Chromium LUCI CQ
parent e93b665ae5
commit 32a5ef91f5
54 changed files with 291 additions and 285 deletions
chrome/browser
content/browser/media
media/base
mojo/public
third_party/blink/renderer

@ -138,7 +138,7 @@ class LiteVideoBrowserTest : public InProcessBrowserTest {
segment_fetch_delay_before_end);
RunMediaTestPage(
has_subframe_video ? "multi_frame_mse_player.html" : "mse_player.html",
query_params, base::ASCIIToUTF16(media::kEnded));
query_params, base::ASCIIToUTF16(media::kEndedTitle));
}
// Runs a html page with a list of URL query parameters.

@ -182,7 +182,7 @@ class EncryptedMediaTestBase : public MediaBrowserTest {
void RunSimpleEncryptedMediaTest(const std::string& media_file,
const std::string& key_system,
SrcType src_type) {
std::string expected_title = media::kEnded;
std::string expected_title = media::kEndedTitle;
if (!IsPlayBackPossible(key_system)) {
expected_title = kEmeUpdateFailed;
}
@ -426,7 +426,7 @@ class ParameterizedEncryptedMediaTestBase : public EncryptedMediaTestBase {
RunEncryptedMediaTest(kDefaultEmePlayer, encrypted_media,
CurrentKeySystem(), CurrentSourceType(),
kNoSessionToLoad, false, PlayCount::TWICE,
media::kEnded);
media::kEndedTitle);
}
void RunInvalidResponseTest() {
@ -440,7 +440,7 @@ class ParameterizedEncryptedMediaTestBase : public EncryptedMediaTestBase {
RunEncryptedMediaTest("encrypted_frame_size_change.html",
"frame_size_change-av_enc-v.webm", CurrentKeySystem(),
CurrentSourceType(), kNoSessionToLoad, false,
PlayCount::ONCE, media::kEnded);
PlayCount::ONCE, media::kEndedTitle);
}
void TestConfigChange(ConfigChangeType config_change_type) {
@ -455,7 +455,7 @@ class ParameterizedEncryptedMediaTestBase : public EncryptedMediaTestBase {
"configChangeType",
base::NumberToString(static_cast<int>(config_change_type)));
RunEncryptedMediaTestPage("mse_config_change.html", CurrentKeySystem(),
query_params, media::kEnded);
query_params, media::kEndedTitle);
}
void TestPolicyCheck() {
@ -477,7 +477,7 @@ class ParameterizedEncryptedMediaTestBase : public EncryptedMediaTestBase {
const std::string& audio_media_file) {
DCHECK_EQ(CurrentSourceType(), SrcType::MSE);
RunEncryptedMediaMultipleFileTest(CurrentKeySystem(), video_media_file,
audio_media_file, media::kEnded);
audio_media_file, media::kEndedTitle);
}
void DisableEncryptedMedia() {
@ -707,7 +707,7 @@ IN_PROC_BROWSER_TEST_P(MseEncryptedMediaTest, MAYBE_RemoveTemporarySession) {
base::StringPairs query_params{{"keySystem", CurrentKeySystem()}};
RunEncryptedMediaTestPage("eme_remove_session_test.html", CurrentKeySystem(),
query_params, media::kEnded);
query_params, media::kEndedTitle);
}
// Only use MSE since this is independent to the demuxer.
@ -716,7 +716,7 @@ IN_PROC_BROWSER_TEST_P(MseEncryptedMediaTest, EncryptedMediaDisabled) {
// Clear Key key system is always supported.
std::string expected_title = media::IsClearKey(CurrentKeySystem())
? media::kEnded
? media::kEndedTitle
: kEmeNotSupportedError;
RunEncryptedMediaTest(kDefaultEmePlayer, "bear-a_enc-a.webm",
@ -812,7 +812,7 @@ IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, PlatformVerificationTest) {
#endif
IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, MAYBE_MessageTypeTest) {
TestPlaybackCase(kExternalClearKeyMessageTypeTestKeySystem, kNoSessionToLoad,
media::kEnded);
media::kEndedTitle);
int num_received_message_types = 0;
EXPECT_TRUE(content::ExecuteScriptAndExtractInt(
@ -828,7 +828,7 @@ IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, MAYBE_MessageTypeTest) {
IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, LoadPersistentLicense) {
TestPlaybackCase(kExternalClearKeyKeySystem, kPersistentLicense,
media::kEnded);
media::kEndedTitle);
}
IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, LoadUnknownSession) {
@ -840,7 +840,7 @@ IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, LoadSessionAfterClose) {
base::StringPairs query_params{{"keySystem", kExternalClearKeyKeySystem}};
RunEncryptedMediaTestPage("eme_load_session_after_close_test.html",
kExternalClearKeyKeySystem, query_params,
media::kEnded);
media::kEndedTitle);
}
const char kExternalClearKeyDecryptOnlyKeySystem[] =
@ -864,7 +864,7 @@ IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, DecryptOnly_VideoOnly_MP4_CBCS) {
// 'cbcs' decryption is only supported on CDM 10 or later as long as
// the appropriate buildflag is enabled.
std::string expected_result =
GetCdmInterfaceVersion() >= 10 ? media::kEnded : media::kError;
GetCdmInterfaceVersion() >= 10 ? media::kEndedTitle : media::kErrorTitle;
RunEncryptedMediaTest(kDefaultEmePlayer, "bear-640x360-v_frag-cbcs.mp4",
kExternalClearKeyDecryptOnlyKeySystem, SrcType::MSE,
kNoSessionToLoad, false, PlayCount::ONCE,
@ -876,26 +876,26 @@ IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, DecryptOnly_VideoOnly_MP4_CBCS) {
IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, Playback_Encryption_CENC) {
RunEncryptedMediaMultipleFileTest(
kExternalClearKeyKeySystem, "bear-640x360-v_frag-cenc.mp4",
"bear-640x360-a_frag-cenc.mp4", media::kEnded);
"bear-640x360-a_frag-cenc.mp4", media::kEndedTitle);
}
IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, Playback_Encryption_CBC1) {
RunEncryptedMediaMultipleFileTest(kExternalClearKeyKeySystem,
"bear-640x360-v_frag-cbc1.mp4",
std::string(), media::kError);
std::string(), media::kErrorTitle);
}
IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, Playback_Encryption_CENS) {
RunEncryptedMediaMultipleFileTest(kExternalClearKeyKeySystem,
"bear-640x360-v_frag-cens.mp4",
std::string(), media::kError);
std::string(), media::kErrorTitle);
}
IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, Playback_Encryption_CBCS) {
// 'cbcs' decryption is only supported on CDM 10 or later as long as
// the appropriate buildflag is enabled.
std::string expected_result =
GetCdmInterfaceVersion() >= 10 ? media::kEnded : media::kError;
GetCdmInterfaceVersion() >= 10 ? media::kEndedTitle : media::kErrorTitle;
RunEncryptedMediaMultipleFileTest(
kExternalClearKeyKeySystem, "bear-640x360-v_frag-cbcs.mp4",
"bear-640x360-a_frag-cbcs.mp4", expected_result);
@ -924,8 +924,8 @@ IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, StorageIdTest) {
IN_PROC_BROWSER_TEST_P(ECKEncryptedMediaTest, MAYBE_MultipleCdmTypes) {
base::StringPairs empty_query_params;
RunMediaTestPage("multiple_cdm_types.html", empty_query_params, media::kEnded,
true);
RunMediaTestPage("multiple_cdm_types.html", empty_query_params,
media::kEndedTitle, true);
}
// Output Protection Tests. Run with different capture inputs. "monitor"
@ -967,6 +967,6 @@ IN_PROC_BROWSER_TEST_F(ECKIncognitoEncryptedMediaTest, LoadSessionAfterClose) {
base::StringPairs query_params{{"keySystem", kExternalClearKeyKeySystem}};
RunEncryptedMediaTestPage("eme_load_session_after_close_test.html",
kExternalClearKeyKeySystem, query_params,
media::kEnded);
media::kEndedTitle);
}
#endif // BUILDFLAG(ENABLE_LIBRARY_CDMS)

@ -91,7 +91,7 @@ std::string MediaBrowserTest::RunTest(const GURL& gurl,
}
void MediaBrowserTest::AddWaitForTitles(content::TitleWatcher* title_watcher) {
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kEnded));
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kError));
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kFailed));
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kEndedTitle));
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kErrorTitle));
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kFailedTitle));
}

@ -104,7 +104,7 @@ class EncryptedMediaTest
void TestFrameSizeChange() {
RunTest("encrypted_frame_size_change.html",
"frame_size_change-av_enc-v.webm", CurrentKeySystem(),
CurrentSourceType(), media::kEnded);
CurrentSourceType(), media::kEndedTitle);
}
void TestConfigChange(ConfigChangeType config_change_type) {
@ -119,7 +119,7 @@ class EncryptedMediaTest
query_params.emplace_back(
"configChangeType",
base::NumberToString(static_cast<int>(config_change_type)));
RunMediaTestPage("mse_config_change.html", query_params, media::kEnded,
RunMediaTestPage("mse_config_change.html", query_params, media::kEndedTitle,
true);
}
@ -141,7 +141,8 @@ class EncryptedMediaTest
void RunSimplePlaybackTest(const std::string& media_file,
const std::string& key_system,
SrcType src_type) {
RunTest(kDefaultEmePlayer, media_file, key_system, src_type, media::kEnded);
RunTest(kDefaultEmePlayer, media_file, key_system, src_type,
media::kEndedTitle);
}
void RunMultipleFileTest(const std::string& video_file,
@ -281,7 +282,7 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoClearAudio_WebM_Opus) {
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4_FLAC) {
RunMultipleFileTest(std::string(), "bear-flac-cenc.mp4", media::kEnded);
RunMultipleFileTest(std::string(), "bear-flac-cenc.mp4", media::kEndedTitle);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4_OPUS) {
@ -289,7 +290,7 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_AudioOnly_MP4_OPUS) {
if (!media::MediaCodecUtil::IsOpusDecoderAvailable())
GTEST_SKIP() << "Opus decoder not available";
#endif
RunMultipleFileTest(std::string(), "bear-opus-cenc.mp4", media::kEnded);
RunMultipleFileTest(std::string(), "bear-opus-cenc.mp4", media::kEndedTitle);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_VideoOnly_MP4_VP9) {
@ -392,34 +393,34 @@ IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, MAYBE_FrameSizeChangeVideo) {
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CENC) {
RunMultipleFileTest("bear-640x360-v_frag-cenc.mp4",
"bear-640x360-a_frag-cenc.mp4", media::kEnded);
"bear-640x360-a_frag-cenc.mp4", media::kEndedTitle);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CBC1) {
RunMultipleFileTest("bear-640x360-v_frag-cbc1.mp4", std::string(),
media::kError);
media::kErrorTitle);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CENS) {
RunMultipleFileTest("bear-640x360-v_frag-cens.mp4", std::string(),
media::kError);
media::kErrorTitle);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest, Playback_Encryption_CBCS) {
RunMultipleFileTest("bear-640x360-v_frag-cbcs.mp4",
"bear-640x360-a_frag-cbcs.mp4", media::kEnded);
"bear-640x360-a_frag-cbcs.mp4", media::kEndedTitle);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest,
Playback_Encryption_CBCS_Video_CENC_Audio) {
RunMultipleFileTest("bear-640x360-v_frag-cbcs.mp4",
"bear-640x360-a_frag-cenc.mp4", media::kEnded);
"bear-640x360-a_frag-cenc.mp4", media::kEndedTitle);
}
IN_PROC_BROWSER_TEST_P(EncryptedMediaTest,
Playback_Encryption_CENC_Video_CBCS_Audio) {
RunMultipleFileTest("bear-640x360-v_frag-cenc.mp4",
"bear-640x360-a_frag-cbcs.mp4", media::kEnded);
"bear-640x360-a_frag-cbcs.mp4", media::kEndedTitle);
}
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)

@ -121,10 +121,10 @@ std::string MediaBrowserTest::EncodeErrorMessage(
}
void MediaBrowserTest::AddTitlesToAwait(content::TitleWatcher* title_watcher) {
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kEnded));
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kError));
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kErrorEvent));
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kFailed));
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kEndedTitle));
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kErrorTitle));
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kErrorEventTitle));
title_watcher->AlsoWaitForTitle(base::ASCIIToUTF16(media::kFailedTitle));
}
// Tests playback and seeking of an audio or video file over file or http based
@ -149,7 +149,7 @@ class MediaTest : public testing::WithParamInterface<bool>,
bool http) {
base::StringPairs query_params;
query_params.emplace_back(tag, media_file);
RunMediaTestPage("player.html", query_params, media::kEnded, http);
RunMediaTestPage("player.html", query_params, media::kEndedTitle, http);
}
void RunErrorMessageTest(const std::string& tag,
@ -160,11 +160,12 @@ class MediaTest : public testing::WithParamInterface<bool>,
query_params.emplace_back(tag, media_file);
query_params.emplace_back("error_substr",
EncodeErrorMessage(expected_error_substring));
RunMediaTestPage("player.html", query_params, media::kErrorEvent, http);
RunMediaTestPage("player.html", query_params, media::kErrorEventTitle,
http);
}
void RunVideoSizeTest(const char* media_file, int width, int height) {
std::string expected_title = std::string(media::kEnded) + " " +
std::string expected_title = std::string(media::kEndedTitle) + " " +
base::NumberToString(width) + " " +
base::NumberToString(height);
base::StringPairs query_params;
@ -303,7 +304,8 @@ IN_PROC_BROWSER_TEST_P(MediaTest, VideoBearHighBitDepthMp4) {
#endif
IN_PROC_BROWSER_TEST_F(MediaTest, MAYBE_LoadManyVideos) {
base::StringPairs query_params;
RunMediaTestPage("load_many_videos.html", query_params, media::kEnded, true);
RunMediaTestPage("load_many_videos.html", query_params, media::kEndedTitle,
true);
}
#endif // !defined(OS_ANDROID)

@ -31,8 +31,8 @@ class MediaColorTest : public MediaBrowserTest {
replacements.SetQueryStr(video_file);
GURL test_url = base_url.ReplaceComponents(replacements);
std::string final_title = RunTest(test_url, media::kEnded);
EXPECT_EQ(media::kEnded, final_title);
std::string final_title = RunTest(test_url, media::kEndedTitle);
EXPECT_EQ(media::kEndedTitle, final_title);
}
void SetUp() override {
EnablePixelOutput();

@ -36,7 +36,7 @@ class MediaRedirectTest : public MediaBrowserTest {
http_test_server->StartAcceptingConnections();
// Run the normal media playback test.
EXPECT_EQ(media::kEnded, RunTest(player_url, media::kEnded));
EXPECT_EQ(media::kEndedTitle, RunTest(player_url, media::kEndedTitle));
}
std::unique_ptr<net::test_server::HttpResponse> RedirectResponseHandler(

@ -47,11 +47,11 @@ class MediaSourceTest : public MediaBrowserTest {
};
IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_VideoAudio_WebM) {
TestSimplePlayback("bear-320x240.webm", media::kEnded);
TestSimplePlayback("bear-320x240.webm", media::kEndedTitle);
}
IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_VideoOnly_WebM) {
TestSimplePlayback("bear-320x240-video-only.webm", media::kEnded);
TestSimplePlayback("bear-320x240-video-only.webm", media::kEndedTitle);
}
// TODO(servolk): Android is supposed to support AAC in ADTS container with
@ -59,23 +59,23 @@ IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_VideoOnly_WebM) {
// some issue in OMX AAC decoder (crbug.com/528361)
#if BUILDFLAG(USE_PROPRIETARY_CODECS) && !defined(OS_ANDROID)
IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_AAC_ADTS) {
TestSimplePlayback("sfx.adts", media::kEnded);
TestSimplePlayback("sfx.adts", media::kEndedTitle);
}
#endif
// Opus is not supported in Android as of now.
#if !defined(OS_ANDROID)
IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_Opus_WebM) {
TestSimplePlayback("bear-opus.webm", media::kEnded);
TestSimplePlayback("bear-opus.webm", media::kEndedTitle);
}
#endif
IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_WebM) {
TestSimplePlayback("bear-320x240-audio-only.webm", media::kEnded);
TestSimplePlayback("bear-320x240-audio-only.webm", media::kEndedTitle);
}
IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_MP3) {
TestSimplePlayback("sfx.mp3", media::kEnded);
TestSimplePlayback("sfx.mp3", media::kEndedTitle);
}
IN_PROC_BROWSER_TEST_F(
@ -85,21 +85,22 @@ IN_PROC_BROWSER_TEST_F(
// includes a codecs parameter that is valid for progressive but invalid for
// MSE type support.
DCHECK_EQ(media::GetMimeTypeForFile("sfx.mp3"), "audio/mpeg");
TestSimplePlayback("sfx.mp3", "audio/mpeg; codecs=\"mp3\"", media::kFailed);
TestSimplePlayback("sfx.mp3", "audio/mpeg; codecs=\"mp3\"",
media::kFailedTitle);
}
// Test the case where test file and mime type mismatch.
IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Type_Error) {
const char kWebMAudioOnly[] = "audio/webm; codecs=\"vorbis\"";
TestSimplePlayback("bear-320x240-video-only.webm", kWebMAudioOnly,
media::kErrorEvent);
media::kErrorEventTitle);
}
// Flaky test crbug.com/246308
// Test changed to skip checks resulting in flakiness. Proper fix still needed.
IN_PROC_BROWSER_TEST_F(MediaSourceTest, ConfigChangeVideo) {
RunMediaTestPage("mse_config_change.html", base::StringPairs(), media::kEnded,
true);
RunMediaTestPage("mse_config_change.html", base::StringPairs(),
media::kEndedTitle, true);
}
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
@ -107,33 +108,33 @@ IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Video_MP4_Audio_WEBM) {
auto query_params = GetAudioVideoQueryParams("bear-320x240-audio-only.webm",
"bear-640x360-v_frag.mp4");
RunMediaTestPage("mse_different_containers.html", std::move(query_params),
media::kEnded, true);
media::kEndedTitle, true);
}
IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_Video_WEBM_Audio_MP4) {
auto query_params = GetAudioVideoQueryParams("bear-640x360-a_frag.mp4",
"bear-320x240-video-only.webm");
RunMediaTestPage("mse_different_containers.html", std::move(query_params),
media::kEnded, true);
media::kEndedTitle, true);
}
#endif // BUILDFLAG(USE_PROPRIETARY_CODECS)
IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_FLAC_MP4) {
TestSimplePlayback("bear-flac_frag.mp4", media::kEnded);
TestSimplePlayback("bear-flac_frag.mp4", media::kEndedTitle);
}
IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioOnly_XHE_AAC_MP4) {
if (media::IsSupportedAudioType(
{media::AudioCodec::kAAC, media::AudioCodecProfile::kXHE_AAC})) {
TestSimplePlayback("noise-xhe-aac.mp4", media::kEnded);
TestSimplePlayback("noise-xhe-aac.mp4", media::kEndedTitle);
}
}
#if BUILDFLAG(USE_PROPRIETARY_CODECS)
#if BUILDFLAG(ENABLE_MSE_MPEG2TS_STREAM_PARSER)
IN_PROC_BROWSER_TEST_F(MediaSourceTest, Playback_AudioVideo_Mp2t) {
TestSimplePlayback("bear-1280x720.ts", media::kEnded);
TestSimplePlayback("bear-1280x720.ts", media::kEndedTitle);
}
#endif
#endif

@ -32,7 +32,7 @@ class MediaSuspendTest : public MediaBrowserTest {
media::GetTestDataFilePath("media_suspend_test.html"),
media::GetURLQueryString(query_params));
const std::u16string kError = base::ASCIIToUTF16(media::kError);
const std::u16string kError = base::ASCIIToUTF16(media::kErrorTitle);
{
VLOG(0) << "Waiting for test URL: " << gurl << ", to load.";
@ -61,7 +61,7 @@ class MediaSuspendTest : public MediaBrowserTest {
{
VLOG(0) << "Waiting for playback to resume.";
const std::u16string kEnded = base::ASCIIToUTF16(media::kEnded);
const std::u16string kEnded = base::ASCIIToUTF16(media::kEndedTitle);
TitleWatcher title_watcher(shell()->web_contents(), kEnded);
title_watcher.AlsoWaitForTitle(kError);
ASSERT_TRUE(ExecJs(shell(), "video.play();"));

@ -167,14 +167,14 @@ const uint8_t kKeyId[] = {0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
// See http://crbug.com/592067
// Common test results.
const char kFailed[] = "FAILED";
const char kFailedTitle[] = "FAILED";
// Upper case event name set by Utils.installTitleEventHandler().
const char kEnded[] = "ENDED";
const char kErrorEvent[] = "ERROR";
const char kEndedTitle[] = "ENDED";
const char kErrorEventTitle[] = "ERROR";
// Lower case event name as set by Utils.failTest().
const char kError[] = "error";
const char kErrorTitle[] = "error";
const base::FilePath::CharType kTestDataPath[] =
FILE_PATH_LITERAL("media/test/data");

@ -18,10 +18,10 @@ namespace media {
class DecoderBuffer;
// Common test results.
extern const char kFailed[];
extern const char kEnded[];
extern const char kErrorEvent[];
extern const char kError[];
extern const char kFailedTitle[];
extern const char kEndedTitle[];
extern const char kErrorEventTitle[];
extern const char kErrorTitle[];
// Returns a file path for a file in the media/test/data directory.
base::FilePath GetTestDataFilePath(const std::string& name);

@ -394,22 +394,22 @@ TEST_F(AssociatedInterfaceTest, MultiThreadAccess) {
run_loop.Run();
for (size_t i = 0; i < 4; ++i) {
base::RunLoop run_loop;
base::RunLoop run_loop2;
senders[i].task_runner()->PostTaskAndReply(
FROM_HERE,
base::BindOnce(&TestSender::TearDown, base::Unretained(&senders[i])),
run_loop.QuitClosure());
run_loop.Run();
run_loop2.QuitClosure());
run_loop2.Run();
}
for (size_t i = 0; i < 2; ++i) {
base::RunLoop run_loop;
base::RunLoop run_loop2;
receivers[i].task_runner()->PostTaskAndReply(
FROM_HERE,
base::BindOnce(&TestReceiver::TearDown,
base::Unretained(&receivers[i])),
run_loop.QuitClosure());
run_loop.Run();
run_loop2.QuitClosure());
run_loop2.Run();
}
EXPECT_EQ(static_cast<size_t>(kMaxValue / 2), receivers[0].values().size());
@ -475,22 +475,22 @@ TEST_F(AssociatedInterfaceTest, FIFO) {
run_loop.Run();
for (size_t i = 0; i < 4; ++i) {
base::RunLoop run_loop;
base::RunLoop run_loop2;
senders[i].task_runner()->PostTaskAndReply(
FROM_HERE,
base::BindOnce(&TestSender::TearDown, base::Unretained(&senders[i])),
run_loop.QuitClosure());
run_loop.Run();
run_loop2.QuitClosure());
run_loop2.Run();
}
for (size_t i = 0; i < 2; ++i) {
base::RunLoop run_loop;
base::RunLoop run_loop2;
receivers[i].task_runner()->PostTaskAndReply(
FROM_HERE,
base::BindOnce(&TestReceiver::TearDown,
base::Unretained(&receivers[i])),
run_loop.QuitClosure());
run_loop.Run();
run_loop2.QuitClosure());
run_loop2.Run();
}
EXPECT_EQ(static_cast<size_t>(kMaxValue / 2), receivers[0].values().size());

@ -530,11 +530,11 @@ TEST(StrongConnectorTest, Math) {
{
MathCalculatorUI calculator_ui(std::move(calc));
base::RunLoop run_loop, run_loop2;
calculator_ui.Add(2.0, run_loop.QuitClosure());
calculator_ui.Multiply(5.0, run_loop2.QuitClosure());
run_loop.Run();
base::RunLoop run_loop2, run_loop3;
calculator_ui.Add(2.0, run_loop2.QuitClosure());
calculator_ui.Multiply(5.0, run_loop3.QuitClosure());
run_loop2.Run();
run_loop3.Run();
EXPECT_EQ(10.0, calculator_ui.GetOutput());
EXPECT_FALSE(disconnected);
@ -602,11 +602,11 @@ TEST(WeakConnectorTest, Math) {
MathCalculatorUI calculator_ui(
PendingRemote<math::Calculator>(std::move(pipe.handle1), 0u));
base::RunLoop run_loop, run_loop2;
calculator_ui.Add(2.0, run_loop.QuitClosure());
calculator_ui.Multiply(5.0, run_loop2.QuitClosure());
run_loop.Run();
base::RunLoop run_loop2, run_loop3;
calculator_ui.Add(2.0, run_loop2.QuitClosure());
calculator_ui.Multiply(5.0, run_loop3.QuitClosure());
run_loop2.Run();
run_loop3.Run();
EXPECT_EQ(10.0, calculator_ui.GetOutput());
EXPECT_FALSE(disconnected);

@ -135,7 +135,7 @@ class {{export_attribute}} {{struct.name}} {
{%- endfor %}
// Serialise this struct into a trace.
void WriteIntoTrace(perfetto::TracedValue context) const;
void WriteIntoTrace(perfetto::TracedValue traced_context) const;
private:
static bool Validate(const void* data,

@ -32,8 +32,9 @@ size_t {{struct.name}}::Hash(size_t seed) const {
}
{%- endif %}
void {{struct.name}}::WriteIntoTrace(perfetto::TracedValue context) const {
auto dict = std::move(context).WriteDictionary();
void {{struct.name}}::WriteIntoTrace(
perfetto::TracedValue traced_context) const {
auto dict = std::move(traced_context).WriteDictionary();
{%- for field in struct.fields %}
perfetto::WriteIntoTracedValueWithFallback(
dict.AddItem(

@ -55,6 +55,8 @@ config("inside_blink") {
cflags += [ "-Wno-enum-float-conversion" ]
}
}
configs = [ "//build/config/compiler:noshadowing" ]
}
# blink_pch --------------------------------------------------------------------
@ -140,4 +142,6 @@ config("non_test_config") {
if (is_clang) {
cflags += [ "-Wglobal-constructors" ]
}
configs = [ "//build/config/compiler:noshadowing" ]
}

@ -87,7 +87,7 @@ TEST(NativeValueTraitsImplTest, IDLRecord) {
}
{
// Exceptions are being thrown in this test, so we need another scope.
V8TestingScope scope;
V8TestingScope scope2;
v8::Local<v8::Object> original_object = EvaluateScriptForObject(
scope, "(self.originalObject = {foo: 34, bar: 42})");

@ -471,7 +471,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, Reset) {
size_t n_new_reject_calls = 0;
{
ScriptState::Scope scope(MainScriptState());
ScriptState::Scope scope2(MainScriptState());
GetProperty()->Resolve(old_value);
old_promise = GetProperty()->Promise(MainWorld());
old_promise.Then(
@ -482,7 +482,7 @@ TEST_F(ScriptPromisePropertyGarbageCollectedTest, Reset) {
GetProperty()->Reset();
{
ScriptState::Scope scope(MainScriptState());
ScriptState::Scope scope2(MainScriptState());
new_promise = GetProperty()->Promise(MainWorld());
new_promise.Then(
NotReached(CurrentScriptState()),

@ -218,12 +218,12 @@ bool KeyUsagesFromWireFormat(uint32_t raw_usages,
CryptoKey* V8ScriptValueDeserializerForModules::ReadCryptoKey() {
// Read params.
uint8_t raw_key_type;
if (!ReadOneByte(&raw_key_type))
uint8_t raw_key_byte;
if (!ReadOneByte(&raw_key_byte))
return nullptr;
WebCryptoKeyAlgorithm algorithm;
WebCryptoKeyType key_type = kWebCryptoKeyTypeSecret;
switch (raw_key_type) {
switch (raw_key_byte) {
case kAesKeyTag: {
uint32_t raw_id;
WebCryptoAlgorithmId id;

@ -3221,10 +3221,10 @@ if (does_exist) {
TextNode("""\
if (${return_value} == NamedPropertyDeleterResult::kDidNotDelete) {
if (${info}.ShouldThrowOnError()) {
ExceptionState exception_state(${info}.GetIsolate(),
ExceptionState::kNamedDeletionContext,
"${interface.identifier}");
exception_state.ThrowTypeError("Failed to delete a property.");
ExceptionState deletion_exception_state(
${info}.GetIsolate(), ExceptionState::kNamedDeletionContext,
"${interface.identifier}");
deletion_exception_state.ThrowTypeError("Failed to delete a property.");
}
return;
}"""),

@ -224,20 +224,20 @@ class AnimationAnimationTestNoCompositing : public PaintTestConfigurations,
GetPage().Animator().ServiceScriptedAnimations(new_time);
}
bool StartTimeIsSet(Animation* animation) {
return animation->startTime();
bool StartTimeIsSet(Animation* for_animation) {
return for_animation->startTime();
}
bool CurrentTimeIsSet(Animation* animation) {
return animation->currentTime();
bool CurrentTimeIsSet(Animation* for_animation) {
return for_animation->currentTime();
}
double GetStartTimeMs(Animation* animation) {
return animation->startTime()->GetAsDouble();
double GetStartTimeMs(Animation* for_animation) {
return for_animation->startTime()->GetAsDouble();
}
double GetCurrentTimeMs(Animation* animation) {
return animation->currentTime()->GetAsDouble();
double GetCurrentTimeMs(Animation* for_animation) {
return for_animation->currentTime()->GetAsDouble();
}
#define EXPECT_TIME(expected, observed) \

@ -155,22 +155,22 @@ TEST_F(DocumentAnimationsTest, AllowAnimationUpdatesScope) {
EXPECT_FALSE(allowed());
{
AllowAnimationUpdatesScope scope(document_animations, true);
AllowAnimationUpdatesScope scope_on(document_animations, true);
EXPECT_TRUE(allowed());
{
AllowAnimationUpdatesScope scope(document_animations, true);
AllowAnimationUpdatesScope scope_on2(document_animations, true);
EXPECT_TRUE(allowed());
}
{
// Disallow explicitly:
AllowAnimationUpdatesScope scope(document_animations, false);
AllowAnimationUpdatesScope scope_off(document_animations, false);
EXPECT_FALSE(allowed());
{
// Allowing while explicitly disallowed has no effect:
AllowAnimationUpdatesScope scope(document_animations, true);
AllowAnimationUpdatesScope scope_on2(document_animations, true);
EXPECT_FALSE(allowed());
}

@ -62,10 +62,10 @@ Timing AnimationTimingInputTest::ApplyTimingInputNumber(
return Timing();
}
auto* timing_input =
auto* options =
MakeGarbageCollected<V8UnionKeyframeEffectOptionsOrUnrestrictedDouble>(
timing_input_dictionary);
result = TimingInput::Convert(timing_input, GetDocument(), exception_state);
result = TimingInput::Convert(options, GetDocument(), exception_state);
if (exception_state.HadException())
return Timing();
} else {
@ -75,10 +75,10 @@ Timing AnimationTimingInputTest::ApplyTimingInputNumber(
if (exception_state.HadException())
return Timing();
auto* timing_input = MakeGarbageCollected<
auto* options = MakeGarbageCollected<
V8UnionKeyframeAnimationOptionsOrUnrestrictedDouble>(
timing_input_dictionary);
result = TimingInput::Convert(timing_input, GetDocument(), exception_state);
result = TimingInput::Convert(options, GetDocument(), exception_state);
if (exception_state.HadException())
return Timing();
}
@ -106,10 +106,10 @@ Timing AnimationTimingInputTest::ApplyTimingInputString(
if (exception_state.HadException())
return Timing();
auto* timing_input =
auto* options =
MakeGarbageCollected<V8UnionKeyframeEffectOptionsOrUnrestrictedDouble>(
timing_input_dictionary);
result = TimingInput::Convert(timing_input, GetDocument(), exception_state);
result = TimingInput::Convert(options, GetDocument(), exception_state);
if (exception_state.HadException())
return Timing();
} else {
@ -119,10 +119,10 @@ Timing AnimationTimingInputTest::ApplyTimingInputString(
if (exception_state.HadException())
return Timing();
auto* timing_input = MakeGarbageCollected<
auto* options = MakeGarbageCollected<
V8UnionKeyframeAnimationOptionsOrUnrestrictedDouble>(
timing_input_dictionary);
result = TimingInput::Convert(timing_input, GetDocument(), exception_state);
result = TimingInput::Convert(options, GetDocument(), exception_state);
if (exception_state.HadException())
return Timing();
}

@ -472,12 +472,14 @@ TEST(MediaQueryEvaluatorTest, CachedForcedColors) {
ScopedForcedColorsForTest scoped_feature(true);
MediaValuesCached::MediaValuesCachedData data;
data.forced_colors = ForcedColors::kNone;
MediaValues* media_values = MakeGarbageCollected<MediaValuesCached>(data);
// Forced colors - none.
MediaQueryEvaluator media_query_evaluator(*media_values);
TestMQEvaluator(g_forcedcolors_none_cases, media_query_evaluator);
{
data.forced_colors = ForcedColors::kNone;
MediaValues* media_values = MakeGarbageCollected<MediaValuesCached>(data);
MediaQueryEvaluator media_query_evaluator(*media_values);
TestMQEvaluator(g_forcedcolors_none_cases, media_query_evaluator);
}
// Forced colors - active.
{
@ -494,12 +496,15 @@ TEST(MediaQueryEvaluatorTest, CachedPrefersContrast) {
MediaValuesCached::MediaValuesCachedData data;
data.forced_colors = ForcedColors::kNone;
data.preferred_contrast = mojom::blink::PreferredContrast::kNoPreference;
MediaValues* media_values = MakeGarbageCollected<MediaValuesCached>(data);
// Prefers-contrast - no-preference.
MediaQueryEvaluator media_query_evaluator(*media_values);
TestMQEvaluator(g_preferscontrast_nopreference_cases, media_query_evaluator);
{
data.preferred_contrast = mojom::blink::PreferredContrast::kNoPreference;
MediaValues* media_values = MakeGarbageCollected<MediaValuesCached>(data);
MediaQueryEvaluator media_query_evaluator(*media_values);
TestMQEvaluator(g_preferscontrast_nopreference_cases,
media_query_evaluator);
}
// Prefers-contrast - more.
{

@ -33,7 +33,7 @@ TEST(CascadePriorityTest, EncodeOriginImportance) {
}
TEST(CascadePriorityTest, OriginOperators) {
std::vector<CascadePriority> priority = {
std::vector<CascadePriority> priorities = {
CascadePriority(CascadeOrigin::kTransition, false, 0, 0),
CascadePriority(CascadeOrigin::kAnimation, false, 0, 0),
CascadePriority(CascadeOrigin::kAuthor, false, 0, 0),
@ -41,34 +41,34 @@ TEST(CascadePriorityTest, OriginOperators) {
CascadePriority(CascadeOrigin::kUserAgent, false, 0, 0),
CascadePriority(CascadeOrigin::kNone, false, 0, 0)};
for (size_t i = 0; i < priority.size(); ++i) {
for (size_t j = i; j < priority.size(); ++j) {
EXPECT_GE(priority[i], priority[j]);
EXPECT_FALSE(priority[i] < priority[j]);
for (size_t i = 0; i < priorities.size(); ++i) {
for (size_t j = i; j < priorities.size(); ++j) {
EXPECT_GE(priorities[i], priorities[j]);
EXPECT_FALSE(priorities[i] < priorities[j]);
}
}
for (size_t i = 0; i < priority.size(); ++i) {
for (size_t j = i + 1; j < priority.size(); ++j) {
EXPECT_LT(priority[j], priority[i]);
EXPECT_FALSE(priority[j] >= priority[i]);
for (size_t i = 0; i < priorities.size(); ++i) {
for (size_t j = i + 1; j < priorities.size(); ++j) {
EXPECT_LT(priorities[j], priorities[i]);
EXPECT_FALSE(priorities[j] >= priorities[i]);
}
}
for (CascadePriority priority : priority)
for (CascadePriority priority : priorities)
EXPECT_EQ(priority, priority);
for (size_t i = 0; i < priority.size(); ++i) {
for (size_t j = 0; j < priority.size(); ++j) {
for (size_t i = 0; i < priorities.size(); ++i) {
for (size_t j = 0; j < priorities.size(); ++j) {
if (i == j)
continue;
EXPECT_NE(priority[i], priority[j]);
EXPECT_NE(priorities[i], priorities[j]);
}
}
}
TEST(CascadePriorityTest, OriginImportance) {
std::vector<CascadePriority> priority = {
std::vector<CascadePriority> priorities = {
CascadePriority(CascadeOrigin::kTransition, false, 0, 0),
CascadePriority(CascadeOrigin::kUserAgent, true, 0, 0),
CascadePriority(CascadeOrigin::kUser, true, 0, 0),
@ -79,9 +79,9 @@ TEST(CascadePriorityTest, OriginImportance) {
CascadePriority(CascadeOrigin::kUserAgent, false, 0, 0),
CascadePriority(CascadeOrigin::kNone, false, 0, 0)};
for (size_t i = 0; i < priority.size(); ++i) {
for (size_t j = i; j < priority.size(); ++j)
EXPECT_GE(priority[i], priority[j]);
for (size_t i = 0; i < priorities.size(); ++i) {
for (size_t j = i; j < priorities.size(); ++j)
EXPECT_GE(priorities[i], priorities[j]);
}
}

@ -659,13 +659,13 @@ TEST_F(StyleCascadeTest, ResolverDetectCycle) {
CustomProperty c("--c", GetDocument());
{
TestCascadeAutoLock lock(a, resolver);
TestCascadeAutoLock lock_a(a, resolver);
EXPECT_FALSE(resolver.InCycle());
{
TestCascadeAutoLock lock(b, resolver);
TestCascadeAutoLock lock_b(b, resolver);
EXPECT_FALSE(resolver.InCycle());
{
TestCascadeAutoLock lock(c, resolver);
TestCascadeAutoLock lock_c(c, resolver);
EXPECT_FALSE(resolver.InCycle());
EXPECT_TRUE(resolver.DetectCycle(a));
@ -688,13 +688,13 @@ TEST_F(StyleCascadeTest, ResolverDetectNoCycle) {
CustomProperty x("--x", GetDocument());
{
TestCascadeAutoLock lock(a, resolver);
TestCascadeAutoLock lock_a(a, resolver);
EXPECT_FALSE(resolver.InCycle());
{
TestCascadeAutoLock lock(b, resolver);
TestCascadeAutoLock lock_b(b, resolver);
EXPECT_FALSE(resolver.InCycle());
{
TestCascadeAutoLock lock(c, resolver);
TestCascadeAutoLock lock_c(c, resolver);
EXPECT_FALSE(resolver.InCycle());
EXPECT_FALSE(resolver.DetectCycle(x));
@ -735,16 +735,16 @@ TEST_F(StyleCascadeTest, ResolverDetectMultiCycle) {
CustomProperty d("--d", GetDocument());
{
AutoLock lock(a, resolver);
AutoLock lock_a(a, resolver);
EXPECT_FALSE(resolver.InCycle());
{
AutoLock lock(b, resolver);
AutoLock lock_b(b, resolver);
EXPECT_FALSE(resolver.InCycle());
{
AutoLock lock(c, resolver);
AutoLock lock_c(c, resolver);
EXPECT_FALSE(resolver.InCycle());
{
AutoLock lock(d, resolver);
AutoLock lock_d(d, resolver);
EXPECT_FALSE(resolver.InCycle());
// Cycle 1 (big cycle):
@ -777,16 +777,16 @@ TEST_F(StyleCascadeTest, ResolverDetectMultiCycleReverse) {
CustomProperty d("--d", GetDocument());
{
AutoLock lock(a, resolver);
AutoLock lock_a(a, resolver);
EXPECT_FALSE(resolver.InCycle());
{
AutoLock lock(b, resolver);
AutoLock lock_b(b, resolver);
EXPECT_FALSE(resolver.InCycle());
{
AutoLock lock(c, resolver);
AutoLock lock_c(c, resolver);
EXPECT_FALSE(resolver.InCycle());
{
AutoLock lock(d, resolver);
AutoLock lock_d(d, resolver);
EXPECT_FALSE(resolver.InCycle());
// Cycle 1 (small cycle):
@ -819,13 +819,13 @@ TEST_F(StyleCascadeTest, CurrentProperty) {
EXPECT_FALSE(resolver.CurrentProperty());
{
AutoLock lock(a, resolver);
AutoLock lock_a(a, resolver);
EXPECT_EQ(&a, resolver.CurrentProperty());
{
AutoLock lock(b, resolver);
AutoLock lock_b(b, resolver);
EXPECT_EQ(&b, resolver.CurrentProperty());
{
AutoLock lock(c, resolver);
AutoLock lock_c(c, resolver);
EXPECT_EQ(&c, resolver.CurrentProperty());
}
EXPECT_EQ(&b, resolver.CurrentProperty());
@ -847,14 +847,14 @@ TEST_F(StyleCascadeTest, CycleWithExtraEdge) {
CustomProperty d("--d", GetDocument());
{
AutoLock lock(a, resolver);
AutoLock lock_a(a, resolver);
EXPECT_FALSE(resolver.InCycle());
{
AutoLock lock(b, resolver);
AutoLock lock_b(b, resolver);
EXPECT_FALSE(resolver.InCycle());
{
AutoLock lock(c, resolver);
AutoLock lock_c(c, resolver);
EXPECT_FALSE(resolver.InCycle());
// Cycle:
@ -870,7 +870,7 @@ TEST_F(StyleCascadeTest, CycleWithExtraEdge) {
{
// We should not be in a cycle when locking a new property ...
AutoLock lock(d, resolver);
AutoLock lock_d(d, resolver);
EXPECT_FALSE(resolver.InCycle());
// AutoLock ctor does not affect in-cycle range:
EXPECT_EQ(1u, resolver.CycleStart());

@ -18,12 +18,12 @@ class StyleRuleTest : public PageTestBase {};
// Note that this test can be removed when the CSSScrollTimeline flag is
// removed.
TEST_F(StyleRuleTest, StyleRuleScrollTimelineGettersWithoutFeature) {
ScopedCSSScrollTimelineForTest scoped_feature(false);
ScopedCSSScrollTimelineForTest scoped_disable_feature(false);
StyleRuleBase* base_rule = nullptr;
{
ScopedCSSScrollTimelineForTest scoped_feature(true);
ScopedCSSScrollTimelineForTest scoped_enable_feature(true);
base_rule = css_test_helpers::ParseRule(GetDocument(), R"CSS(
@scroll-timeline timeline {
source: selector(#foo);

@ -321,14 +321,12 @@ TEST_F(SourceListDirectiveTest, AllowAllInline) {
CSPSourceListAllowAllInline(CSPDirectiveName::StyleSrc, *style_src));
for (const auto& test : cases) {
network::mojom::blink::CSPSourceListPtr script_src =
ParseSourceList("script-src", test.sources);
script_src = ParseSourceList("script-src", test.sources);
EXPECT_EQ(
CSPSourceListAllowAllInline(CSPDirectiveName::ScriptSrc, *script_src),
test.expected);
network::mojom::blink::CSPSourceListPtr style_src =
ParseSourceList("style-src", test.sources);
style_src = ParseSourceList("style-src", test.sources);
EXPECT_EQ(
CSPSourceListAllowAllInline(CSPDirectiveName::StyleSrc, *style_src),
test.expected);

@ -39,7 +39,7 @@ TEST(ScopedAllowFullscreenTest, DestructResetsState) {
TEST(ScopedAllowFullscreenTest, DestructResetsStateToPrevious) {
ScopedAllowFullscreen scope(ScopedAllowFullscreen::kOrientationChange);
{ ScopedAllowFullscreen scope(ScopedAllowFullscreen::kOrientationChange); }
{ ScopedAllowFullscreen scope2(ScopedAllowFullscreen::kOrientationChange); }
EXPECT_EQ(ScopedAllowFullscreen::kOrientationChange,
ScopedAllowFullscreen::FullscreenAllowedReason().value());

@ -268,9 +268,11 @@ TEST_F(ImageBitmapTest, AvoidGPUReadback) {
EXPECT_TRUE(image_bitmap->BitmapImage()->IsTextureBacked());
IntRect image_bitmap_rect(25, 25, 50, 50);
ImageBitmapOptions* image_bitmap_options = ImageBitmapOptions::Create();
TestImageBitmapTextureBacked(bitmap, image_bitmap_rect, image_bitmap_options,
true);
{
ImageBitmapOptions* image_bitmap_options = ImageBitmapOptions::Create();
TestImageBitmapTextureBacked(bitmap, image_bitmap_rect,
image_bitmap_options, true);
}
std::list<String> image_orientations = {"none", "flipY"};
std::list<String> premultiply_alphas = {"none", "premultiply", "default"};

@ -30,7 +30,7 @@ class LayoutTableSectionTest : public RenderingTest {
for (unsigned i = 0; i < rows; ++i) {
auto* row = GetDocument().CreateRawElement(html_names::kTrTag);
section->appendChild(row);
for (unsigned i = 0; i < columns; ++i)
for (unsigned column = 0; column < columns; ++column)
row->appendChild(GetDocument().CreateRawElement(html_names::kTdTag));
}
UpdateAllLifecyclePhasesForTest();

@ -28,7 +28,7 @@ class ImageElementTimingTest : public testing::Test,
web_view_helper_.Initialize();
frame_test_helpers::LoadFrame(
web_view_helper_.GetWebView()->MainFrameImpl(), "about:blank");
WebURL base_url_ = url_test_helpers::ToKURL("http://www.test.com/");
base_url_ = url_test_helpers::ToKURL("http://www.test.com/");
// Enable compositing on the page.
web_view_helper_.GetWebView()
->GetPage()

@ -5121,8 +5121,8 @@ String AXNodeObject::Description(
description = TextFromElements(true, visited, elements_from_attribute,
related_objects);
for (auto& element : elements_from_attribute)
ids.push_back(element->GetIdAttribute());
for (auto& member_element : elements_from_attribute)
ids.push_back(member_element->GetIdAttribute());
TokenVectorFromAttribute(element, ids, html_names::kAriaDescribedbyAttr);
AXObjectCache().UpdateReverseRelations(this, ids);

@ -49,7 +49,7 @@ ScriptPromise EyeDropper::open(ScriptState* script_state,
return ScriptPromise();
}
auto* resolver_ = MakeGarbageCollected<ScriptPromiseResolver>(script_state);
resolver_ = MakeGarbageCollected<ScriptPromiseResolver>(script_state);
ScriptPromise promise = resolver_->Promise();
auto* frame = window->GetFrame();
@ -60,7 +60,7 @@ ScriptPromise EyeDropper::open(ScriptState* script_state,
WTF::Bind(&EyeDropper::EndChooser, WrapWeakPersistent(this)));
eye_dropper_chooser_->Choose(WTF::Bind(&EyeDropper::EyeDropperResponseHandler,
WrapPersistent(this),
WrapPersistent(resolver_)));
WrapPersistent(resolver_.Get())));
return promise;
}

@ -483,8 +483,8 @@ static std::unique_ptr<IDBKey> IdbKeyFromInspectorObject(
IDBKey::KeyArray key_array;
auto* array = key->getArray(nullptr);
if (array) {
for (const std::unique_ptr<protocol::IndexedDB::Key>& key : *array)
key_array.emplace_back(IdbKeyFromInspectorObject(key.get()));
for (const std::unique_ptr<protocol::IndexedDB::Key>& elem : *array)
key_array.emplace_back(IdbKeyFromInspectorObject(elem.get()));
}
idb_key = IDBKey::CreateArray(std::move(key_array));
} else {

@ -314,9 +314,9 @@ MediaStream* HTMLMediaElementCapture::captureStream(
// If |element| is actually playing a MediaStream, just clone it.
if (element.GetLoadType() == WebMediaPlayer::kLoadTypeMediaStream) {
MediaStreamDescriptor* const descriptor = element.GetSrcObject();
DCHECK(descriptor);
return MediaStream::Create(context, descriptor);
MediaStreamDescriptor* const element_descriptor = element.GetSrcObject();
DCHECK(element_descriptor);
return MediaStream::Create(context, element_descriptor);
}
LocalFrame* frame = ToLocalFrameIfNotDetached(script_state->GetContext());

@ -123,9 +123,10 @@ class MediaStreamAudioProcessorTest : public ::testing::Test {
const bool is_aec_enabled = ap && ap->GetConfig().echo_canceller.enabled;
if (is_aec_enabled) {
if (has_keyboard_mic) {
for (int i = 0; i < data_bus_playout->channels(); ++i) {
for (int channel = 0; channel < data_bus_playout->channels();
++channel) {
data_bus_playout->SetChannelData(
i, const_cast<float*>(data_bus->channel(i)));
channel, const_cast<float*>(data_bus->channel(channel)));
}
}
audio_processor->OnPlayoutData(data_bus_playout_to_use,

@ -1957,7 +1957,7 @@ TEST_P(MediaStreamConstraintsUtilAudioTest, SourceWithAudioProcessing) {
constraint_factory_.Reset();
(constraint_factory_.basic().*kAudioBrowserConstraints[i])
.SetExact(use_defaults);
auto result = SelectSettingsAudioCapture(
result = SelectSettingsAudioCapture(
source.get(), constraint_factory_.CreateMediaConstraints());
EXPECT_TRUE(result.HasValue());

@ -535,11 +535,11 @@ TEST_F(MediaStreamConstraintsUtilTest, VideoTrackAdapterSettingsConstrained) {
// Source frame rate.
{
DoubleRangeSet frame_rate_set(kMinFrameRate, kSourceFrameRate);
DoubleRangeSet source_frame_rate_set(kMinFrameRate, kSourceFrameRate);
MockConstraintFactory constraint_factory;
auto result =
SelectTrackSettings(constraint_factory.CreateMediaConstraints().Basic(),
resolution_set, frame_rate_set);
resolution_set, source_frame_rate_set);
EXPECT_EQ(kSourceHeight, result.target_height());
EXPECT_EQ(kSourceWidth, result.target_width());
EXPECT_EQ(kMinAspectRatio, result.min_aspect_ratio());
@ -550,13 +550,13 @@ TEST_F(MediaStreamConstraintsUtilTest, VideoTrackAdapterSettingsConstrained) {
// High frame rate.
{
constexpr double kHighFrameRate = 400.0; // Greater than source.
DoubleRangeSet frame_rate_set(kMinFrameRate, kHighFrameRate);
DoubleRangeSet high_frame_rate_set(kMinFrameRate, kHighFrameRate);
static_assert(kHighFrameRate > kSourceFrameRate,
"kIdealFrameRate must be greater than kSourceFrameRate");
MockConstraintFactory constraint_factory;
auto result =
SelectTrackSettings(constraint_factory.CreateMediaConstraints().Basic(),
resolution_set, frame_rate_set);
resolution_set, high_frame_rate_set);
EXPECT_EQ(kSourceHeight, result.target_height());
EXPECT_EQ(kSourceWidth, result.target_width());
EXPECT_EQ(kMinAspectRatio, result.min_aspect_ratio());

@ -1595,7 +1595,6 @@ ScriptPromise RTCPeerConnection::setRemoteDescription(
NoteCallSetupStateEventPending(SetSdpOperationType::kSetRemoteDescription,
*session_description_init);
if (ContainsLegacyRtpDataChannel(session_description_init->sdp())) {
ExecutionContext* context = ExecutionContext::From(script_state);
UseCounter::Count(context, WebFeature::kRTCLegacyRtpDataChannelNegotiated);
}

@ -22,12 +22,6 @@ class ExecutionContext;
class SanitizerConfig;
class ScriptState;
enum ElementKind {
kCustom,
kUnknown,
kRegular,
};
class MODULES_EXPORT Sanitizer final : public ScriptWrappable {
DEFINE_WRAPPERTYPEINFO();

@ -159,11 +159,9 @@ void ConvolverHandler::SetBuffer(AudioBuffer* buffer,
// length of 0, it was transferred.
bool any_buffer_detached = false;
for (unsigned i = 0; i < number_of_channels; ++i) {
for (unsigned i = 0; i < number_of_channels; ++i) {
if (buffer->getChannelData(i)->length() == 0) {
any_buffer_detached = true;
break;
}
if (buffer->getChannelData(i)->length() == 0) {
any_buffer_detached = true;
break;
}
}

@ -114,12 +114,12 @@ TEST_F(AudioDataTest, ConstructFromMediaBuffer) {
const int channels = ChannelLayoutToChannelCount(channel_layout);
constexpr base::TimeDelta timestamp =
base::TimeDelta::FromMicroseconds(kTimestampInMicroSeconds);
constexpr int kStart = 1;
constexpr int kIncrement = 1;
constexpr int kValueStart = 1;
constexpr int kValueIncrement = 1;
scoped_refptr<media::AudioBuffer> media_buffer =
media::MakeAudioBuffer<int16_t>(media::SampleFormat::kSampleFormatS16,
channel_layout, channels, kSampleRate,
kStart, kIncrement, kFrames, timestamp);
media::MakeAudioBuffer<int16_t>(
media::SampleFormat::kSampleFormatS16, channel_layout, channels,
kSampleRate, kValueStart, kValueIncrement, kFrames, timestamp);
auto* frame = MakeGarbageCollected<AudioData>(media_buffer);

@ -247,7 +247,6 @@ void DatabaseTracker::CloseOneDatabaseImmediately(const String& origin_string,
DatabaseNameMap* name_map = open_database_map_it->value;
DCHECK(name_map);
String name = database->StringIdentifier();
auto name_map_it = name_map->find(name);
if (name_map_it == name_map->end())
return;

@ -223,32 +223,32 @@ TEST_F(ParkableStringTest, Simple) {
TEST_F(ParkableStringTest, Park) {
{
ParkableString parkable(MakeLargeString('a').ReleaseImpl());
EXPECT_TRUE(parkable.may_be_parked());
EXPECT_FALSE(parkable.Impl()->is_parked());
EXPECT_TRUE(ParkAndWait(parkable));
EXPECT_TRUE(parkable.Impl()->is_parked());
ParkableString parkable_a(MakeLargeString('a').ReleaseImpl());
EXPECT_TRUE(parkable_a.may_be_parked());
EXPECT_FALSE(parkable_a.Impl()->is_parked());
EXPECT_TRUE(ParkAndWait(parkable_a));
EXPECT_TRUE(parkable_a.Impl()->is_parked());
}
String large_string = MakeLargeString('b');
ParkableString parkable(large_string.Impl());
EXPECT_TRUE(parkable.may_be_parked());
ParkableString parkable_b(large_string.Impl());
EXPECT_TRUE(parkable_b.may_be_parked());
// Not the only one to have a reference to the string.
EXPECT_FALSE(ParkAndWait(parkable));
EXPECT_FALSE(ParkAndWait(parkable_b));
large_string = String();
EXPECT_TRUE(ParkAndWait(parkable));
EXPECT_TRUE(ParkAndWait(parkable_b));
{
ParkableString parkable(MakeLargeString('c').ReleaseImpl());
EXPECT_TRUE(parkable.may_be_parked());
EXPECT_FALSE(parkable.Impl()->is_parked());
ParkableString parkable_c(MakeLargeString('c').ReleaseImpl());
EXPECT_TRUE(parkable_c.may_be_parked());
EXPECT_FALSE(parkable_c.Impl()->is_parked());
EXPECT_TRUE(
parkable.Impl()->Park(ParkableStringImpl::ParkingMode::kCompress));
parkable_c.Impl()->Park(ParkableStringImpl::ParkingMode::kCompress));
// Should not crash, it is allowed to call |Park()| twice in a row.
EXPECT_TRUE(
parkable.Impl()->Park(ParkableStringImpl::ParkingMode::kCompress));
parkable = ParkableString(); // Release the reference.
RunPostedTasks(); // Should not crash.
parkable_c.Impl()->Park(ParkableStringImpl::ParkingMode::kCompress));
parkable_c = ParkableString(); // Release the reference.
RunPostedTasks(); // Should not crash.
}
}

@ -1653,10 +1653,10 @@ TEST_P(ShapeParameterTest, CopyRangeNoRuns) {
result->CopyRanges(ranges.data(), ranges.size());
for (unsigned i = 0; i < ranges.size(); i++) {
const ShapeResult::ShapeRange& range = ranges[i];
const ShapeResult& result = *range_results[i];
EXPECT_EQ(result.StartIndex(), range.start);
EXPECT_EQ(result.EndIndex(), range.end);
EXPECT_EQ(result.NumCharacters(), range.end - range.start);
const ShapeResult& range_result = *range_results[i];
EXPECT_EQ(range_result.StartIndex(), range.start);
EXPECT_EQ(range_result.EndIndex(), range.end);
EXPECT_EQ(range_result.NumCharacters(), range.end - range.start);
}
}

@ -64,8 +64,8 @@ namespace {
for (int y = 0; y < bitmap.height(); ++y) \
for (int x = 0; x < bitmap.width(); ++x) { \
int alpha = *bitmap.getAddr32(x, y) >> 24; \
bool opaque = opaqueRect.Contains(x, y); \
EXPECT_EQ(opaque, alpha == 255); \
bool is_opaque = opaqueRect.Contains(x, y); \
EXPECT_EQ(is_opaque, alpha == 255); \
} \
}

@ -30,14 +30,14 @@ class GeometryMapperTest : public testing::Test,
}
void LocalToAncestorVisualRectInternal(
const PropertyTreeState& local_state,
const PropertyTreeState& ancestor_state,
const PropertyTreeState& internal_local_state,
const PropertyTreeState& internal_ancestor_state,
FloatClipRect& mapping_rect,
bool& success) {
GeometryMapper::LocalToAncestorVisualRectInternal(
local_state, ancestor_state, mapping_rect, kIgnoreOverlayScrollbarSize,
kNonInclusiveIntersect, kDontExpandVisualRectForCompositingOverlap,
success);
internal_local_state, internal_ancestor_state, mapping_rect,
kIgnoreOverlayScrollbarSize, kNonInclusiveIntersect,
kDontExpandVisualRectForCompositingOverlap, success);
}
void CheckMappings();

@ -1209,7 +1209,7 @@ TEST_P(PaintControllerTest, CachedNestedSubsequenceUpdate) {
IntRect(100, 100, 100, 100));
{
SubsequenceRecorder r(context, content1);
SubsequenceRecorder inner_r(context, content1);
GetPaintController().UpdateCurrentPaintChunkProperties(
&content1_id, content1_properties);
DrawRect(context, content1, kBackgroundType,
@ -1229,7 +1229,7 @@ TEST_P(PaintControllerTest, CachedNestedSubsequenceUpdate) {
DrawRect(context, container2, kBackgroundType,
IntRect(100, 200, 100, 100));
{
SubsequenceRecorder r(context, content2);
SubsequenceRecorder inner_r(context, content2);
GetPaintController().UpdateCurrentPaintChunkProperties(
&content2_id, content2_properties);
DrawRect(context, content2, kBackgroundType,
@ -1293,7 +1293,7 @@ TEST_P(PaintControllerTest, CachedNestedSubsequenceUpdate) {
// expected to create the same painting as in the previous paint.
EXPECT_FALSE(SubsequenceRecorder::UseCachedSubsequenceIfPossible(
context, content1));
SubsequenceRecorder r(context, content1);
SubsequenceRecorder inner_r(context, content1);
GetPaintController().UpdateCurrentPaintChunkProperties(
&content1_id, content1_properties);
DrawRect(context, content1, kBackgroundType,
@ -1368,12 +1368,12 @@ TEST_P(PaintControllerTest, CachedNestedSubsequenceKeepingDescendants) {
DrawRect(context, container1, kBackgroundType,
IntRect(100, 100, 100, 100));
{
SubsequenceRecorder r(context, content1a);
SubsequenceRecorder inner_r(context, content1a);
DrawRect(context, content1a, kBackgroundType,
IntRect(100, 100, 50, 200));
}
{
SubsequenceRecorder r(context, content1b);
SubsequenceRecorder inner_r(context, content1b);
DrawRect(context, content1b, kForegroundType,
IntRect(100, 100, 50, 200));
}
@ -1385,12 +1385,12 @@ TEST_P(PaintControllerTest, CachedNestedSubsequenceKeepingDescendants) {
DrawRect(context, container2, kBackgroundType,
IntRect(100, 200, 100, 100));
{
SubsequenceRecorder r(context, content2a);
SubsequenceRecorder inner_r(context, content2a);
DrawRect(context, content2a, kBackgroundType,
IntRect(100, 200, 50, 200));
}
{
SubsequenceRecorder r(context, content2b);
SubsequenceRecorder inner_r(context, content2b);
DrawRect(context, content2b, kForegroundType,
IntRect(100, 200, 50, 200));
}

@ -560,10 +560,10 @@ TEST_F(MultiBufferTest, RandomTest) {
if (!writers.empty())
Advance();
} else {
size_t j = rnd_.Rand() % read_helpers.size();
size_t k = rnd_.Rand() % read_helpers.size();
if (rnd_.Rand() % 100 < 3)
read_helpers[j]->Seek();
read_helpers[j]->StartRead();
read_helpers[k]->Seek();
read_helpers[k]->StartRead();
}
}
multibuffer_.CheckLRUState();
@ -591,10 +591,10 @@ TEST_F(MultiBufferTest, RandomTest_RangeSupported) {
if (!writers.empty())
Advance();
} else {
size_t j = rnd_.Rand() % read_helpers.size();
size_t k = rnd_.Rand() % read_helpers.size();
if (rnd_.Rand() % 100 < 3)
read_helpers[j]->Seek();
read_helpers[j]->StartRead();
read_helpers[k]->Seek();
read_helpers[k]->StartRead();
}
}
multibuffer_.CheckLRUState();

@ -661,8 +661,7 @@ TEST_P(WatchTimeReporterTest, WatchTimeReporter) {
wtr_->OnPlaying();
EXPECT_EQ(!has_video_, IsMonitoring());
constexpr gfx::Size kSizeTooSmall = gfx::Size(100, 100);
Initialize(true, true, kSizeTooSmall);
Initialize(true, true, gfx::Size(100, 100));
wtr_->OnPlaying();
EXPECT_EQ(!has_video_, IsMonitoring());

@ -470,15 +470,17 @@ TEST_F(MainThreadEventQueueTest, NonBlockingTouch) {
EXPECT_TRUE(Equal(kEvents[1], *coalesced_touch_event));
}
EXPECT_EQ(kEvents[2].GetType(),
handled_tasks_.at(2)->taskAsEvent()->Event().GetType());
last_touch_event = static_cast<const WebTouchEvent*>(
handled_tasks_.at(2)->taskAsEvent()->EventPointer());
WebTouchEvent coalesced_event = kEvents[2];
coalesced_event.Coalesce(kEvents[3]);
coalesced_event.dispatch_type =
WebInputEvent::DispatchType::kListenersNonBlockingPassive;
EXPECT_TRUE(Equal(coalesced_event, *last_touch_event));
{
EXPECT_EQ(kEvents[2].GetType(),
handled_tasks_.at(2)->taskAsEvent()->Event().GetType());
last_touch_event = static_cast<const WebTouchEvent*>(
handled_tasks_.at(2)->taskAsEvent()->EventPointer());
WebTouchEvent coalesced_event = kEvents[2];
coalesced_event.Coalesce(kEvents[3]);
coalesced_event.dispatch_type =
WebInputEvent::DispatchType::kListenersNonBlockingPassive;
EXPECT_TRUE(Equal(coalesced_event, *last_touch_event));
}
{
EXPECT_EQ(2u, handled_tasks_[2]->taskAsEvent()->CoalescedEventSize());

@ -197,9 +197,9 @@ TEST(HashSetTest, HashSetOwnPtr) {
deleted1 = false;
deleted2 = false;
{
OwnPtrSet set;
set.insert(std::make_unique<Dummy>(deleted1));
set.insert(std::make_unique<Dummy>(deleted2));
OwnPtrSet inner_set;
inner_set.insert(std::make_unique<Dummy>(deleted1));
inner_set.insert(std::make_unique<Dummy>(deleted2));
}
EXPECT_TRUE(deleted1);
EXPECT_TRUE(deleted2);
@ -211,13 +211,13 @@ TEST(HashSetTest, HashSetOwnPtr) {
ptr1 = new Dummy(deleted1);
ptr2 = new Dummy(deleted2);
{
OwnPtrSet set;
set.insert(base::WrapUnique(ptr1));
set.insert(base::WrapUnique(ptr2));
own_ptr1 = set.Take(ptr1);
EXPECT_EQ(1UL, set.size());
own_ptr2 = set.TakeAny();
EXPECT_TRUE(set.IsEmpty());
OwnPtrSet inner_set;
inner_set.insert(base::WrapUnique(ptr1));
inner_set.insert(base::WrapUnique(ptr2));
own_ptr1 = inner_set.Take(ptr1);
EXPECT_EQ(1UL, inner_set.size());
own_ptr2 = inner_set.TakeAny();
EXPECT_TRUE(inner_set.IsEmpty());
}
EXPECT_FALSE(deleted1);
EXPECT_FALSE(deleted2);

@ -556,9 +556,9 @@ TEST(ListHashSetTest, WithOwnPtr) {
deleted1 = false;
deleted2 = false;
{
OwnPtrSet set;
set.insert(std::make_unique<Dummy>(deleted1));
set.insert(std::make_unique<Dummy>(deleted2));
OwnPtrSet inner_set;
inner_set.insert(std::make_unique<Dummy>(deleted1));
inner_set.insert(std::make_unique<Dummy>(deleted2));
}
EXPECT_TRUE(deleted1);
EXPECT_TRUE(deleted2);
@ -570,13 +570,13 @@ TEST(ListHashSetTest, WithOwnPtr) {
ptr1 = new Dummy(deleted1);
ptr2 = new Dummy(deleted2);
{
OwnPtrSet set;
set.insert(base::WrapUnique(ptr1));
set.insert(base::WrapUnique(ptr2));
own_ptr1 = set.TakeFirst();
EXPECT_EQ(1UL, set.size());
own_ptr2 = set.Take(ptr2);
EXPECT_TRUE(set.IsEmpty());
OwnPtrSet inner_set;
inner_set.insert(base::WrapUnique(ptr1));
inner_set.insert(base::WrapUnique(ptr2));
own_ptr1 = inner_set.TakeFirst();
EXPECT_EQ(1UL, inner_set.size());
own_ptr2 = inner_set.Take(ptr2);
EXPECT_TRUE(inner_set.IsEmpty());
}
EXPECT_FALSE(deleted1);
EXPECT_FALSE(deleted2);