Commit 799e0bc8 authored by haraken's avatar haraken Committed by Commit bot

Replace ARRAY_SIZE with WTF_ARRAY_LENGTH

These two macros do the same thing.

BUG=548217

Review URL: https://codereview.chromium.org/1406183010

Cr-Commit-Position: refs/heads/master@{#361276}
parent 7e10653a
......@@ -83,11 +83,11 @@ HashAlgorithm SubresourceIntegrity::getPrioritizedHashFunction(HashAlgorithm alg
break;
case HashAlgorithmSha384:
weakerAlgorithms = weakerThanSha384;
length = ARRAY_SIZE(weakerThanSha384);
length = WTF_ARRAY_LENGTH(weakerThanSha384);
break;
case HashAlgorithmSha512:
weakerAlgorithms = weakerThanSha512;
length = ARRAY_SIZE(weakerThanSha512);
length = WTF_ARRAY_LENGTH(weakerThanSha512);
break;
default:
ASSERT_NOT_REACHED();
......
......@@ -316,7 +316,7 @@ TEST_F(SubresourceIntegrityTest, Parsing)
expectParseMultipleHashes(
"sha384-XVVXBGoYw6AJOh9J+Z8pBDMVVPfkBpngexkA7JqZu8d5GENND6TEIup/tA1v5GPr sha512-tbUPioKbVBplr0b1ucnWB57SJWt4x9dOE0Vy2mzCXvH3FepqDZ+07yMK81ytlg0MPaIrPAjcHqba5csorDWtKg==",
kValidSha384AndSha512,
ARRAY_SIZE(kValidSha384AndSha512));
WTF_ARRAY_LENGTH(kValidSha384AndSha512));
const IntegrityMetadata kValidSha256AndSha256[] = {
{"BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", HashAlgorithmSha256},
......@@ -325,7 +325,7 @@ TEST_F(SubresourceIntegrityTest, Parsing)
expectParseMultipleHashes(
"sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE= sha256-deadbeef",
kValidSha256AndSha256,
ARRAY_SIZE(kValidSha256AndSha256));
WTF_ARRAY_LENGTH(kValidSha256AndSha256));
const IntegrityMetadata kValidSha256AndInvalidSha256[] = {
{"BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", HashAlgorithmSha256}
......@@ -333,7 +333,7 @@ TEST_F(SubresourceIntegrityTest, Parsing)
expectParseMultipleHashes(
"sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE= sha256-!!!!",
kValidSha256AndInvalidSha256,
ARRAY_SIZE(kValidSha256AndInvalidSha256));
WTF_ARRAY_LENGTH(kValidSha256AndInvalidSha256));
const IntegrityMetadata kInvalidSha256AndValidSha256[] = {
{"BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", HashAlgorithmSha256}
......@@ -341,7 +341,7 @@ TEST_F(SubresourceIntegrityTest, Parsing)
expectParseMultipleHashes(
"sha256-!!! sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=",
kInvalidSha256AndValidSha256,
ARRAY_SIZE(kInvalidSha256AndValidSha256));
WTF_ARRAY_LENGTH(kInvalidSha256AndValidSha256));
expectParse(
"sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=?foo=bar",
......
......@@ -297,7 +297,7 @@ TEST(AnimatedWebPTests, verifyAnimationParametersTransparentImage)
{ 2, 2, 7, 16, ImageFrame::DisposeKeep, ImageFrame::BlendAtopPreviousFrame, 1000u, true },
};
for (size_t i = 0; i < ARRAY_SIZE(frameParameters); ++i) {
for (size_t i = 0; i < WTF_ARRAY_LENGTH(frameParameters); ++i) {
const ImageFrame* const frame = decoder->frameBufferAtIndex(i);
EXPECT_EQ(ImageFrame::FrameComplete, frame->status());
EXPECT_EQ(canvasWidth, frame->getSkBitmap().width());
......@@ -312,7 +312,7 @@ TEST(AnimatedWebPTests, verifyAnimationParametersTransparentImage)
EXPECT_EQ(frameParameters[i].hasAlpha, frame->hasAlpha());
}
EXPECT_EQ(ARRAY_SIZE(frameParameters), decoder->frameCount());
EXPECT_EQ(WTF_ARRAY_LENGTH(frameParameters), decoder->frameCount());
EXPECT_EQ(cAnimationLoopInfinite, decoder->repetitionCount());
}
......@@ -340,7 +340,7 @@ TEST(AnimatedWebPTests, verifyAnimationParametersOpaqueFramesTransparentBackgrou
{ 10, 54, 32, 33, ImageFrame::DisposeOverwriteBgcolor, ImageFrame::BlendAtopPreviousFrame, 1000u, true },
};
for (size_t i = 0; i < ARRAY_SIZE(frameParameters); ++i) {
for (size_t i = 0; i < WTF_ARRAY_LENGTH(frameParameters); ++i) {
const ImageFrame* const frame = decoder->frameBufferAtIndex(i);
EXPECT_EQ(ImageFrame::FrameComplete, frame->status());
EXPECT_EQ(canvasWidth, frame->getSkBitmap().width());
......@@ -355,7 +355,7 @@ TEST(AnimatedWebPTests, verifyAnimationParametersOpaqueFramesTransparentBackgrou
EXPECT_EQ(frameParameters[i].hasAlpha, frame->hasAlpha());
}
EXPECT_EQ(ARRAY_SIZE(frameParameters), decoder->frameCount());
EXPECT_EQ(WTF_ARRAY_LENGTH(frameParameters), decoder->frameCount());
EXPECT_EQ(cAnimationLoopInfinite, decoder->repetitionCount());
}
......@@ -383,7 +383,7 @@ TEST(AnimatedWebPTests, verifyAnimationParametersBlendOverwrite)
{ 10, 54, 32, 33, ImageFrame::DisposeOverwriteBgcolor, ImageFrame::BlendAtopBgcolor, 1000u, true },
};
for (size_t i = 0; i < ARRAY_SIZE(frameParameters); ++i) {
for (size_t i = 0; i < WTF_ARRAY_LENGTH(frameParameters); ++i) {
const ImageFrame* const frame = decoder->frameBufferAtIndex(i);
EXPECT_EQ(ImageFrame::FrameComplete, frame->status());
EXPECT_EQ(canvasWidth, frame->getSkBitmap().width());
......@@ -398,7 +398,7 @@ TEST(AnimatedWebPTests, verifyAnimationParametersBlendOverwrite)
EXPECT_EQ(frameParameters[i].hasAlpha, frame->hasAlpha());
}
EXPECT_EQ(ARRAY_SIZE(frameParameters), decoder->frameCount());
EXPECT_EQ(WTF_ARRAY_LENGTH(frameParameters), decoder->frameCount());
EXPECT_EQ(cAnimationLoopInfinite, decoder->repetitionCount());
}
......
......@@ -1394,7 +1394,7 @@ TEST_P(ParameterizedWebFrameTest, SmallPermanentInitialPageScaleFactorIsClobbere
"viewport-target-densitydpi-device-and-fixed-width.html"
};
float pageScaleFactors[] = { 0.5f, 1.0f };
for (size_t i = 0; i < ARRAY_SIZE(pages); ++i)
for (size_t i = 0; i < WTF_ARRAY_LENGTH(pages); ++i)
registerMockedHttpURLLoad(pages[i]);
FixedLayoutTestWebViewClient client;
......@@ -1403,7 +1403,7 @@ TEST_P(ParameterizedWebFrameTest, SmallPermanentInitialPageScaleFactorIsClobbere
int viewportHeight = 300;
float enforcedPageScaleFactor = 0.75f;
for (size_t i = 0; i < ARRAY_SIZE(pages); ++i) {
for (size_t i = 0; i < WTF_ARRAY_LENGTH(pages); ++i) {
for (int quirkEnabled = 0; quirkEnabled <= 1; ++quirkEnabled) {
FrameTestHelpers::WebViewHelper webViewHelper(this);
webViewHelper.initializeAndLoad(m_baseURL + pages[i], true, 0, &client, enableViewportSettings);
......@@ -1412,7 +1412,7 @@ TEST_P(ParameterizedWebFrameTest, SmallPermanentInitialPageScaleFactorIsClobbere
webViewHelper.webView()->setInitialPageScaleOverride(enforcedPageScaleFactor);
webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
float expectedPageScaleFactor = quirkEnabled && i < ARRAY_SIZE(pageScaleFactors) ? pageScaleFactors[i] : enforcedPageScaleFactor;
float expectedPageScaleFactor = quirkEnabled && i < WTF_ARRAY_LENGTH(pageScaleFactors) ? pageScaleFactors[i] : enforcedPageScaleFactor;
EXPECT_EQ(expectedPageScaleFactor, webViewHelper.webView()->pageScaleFactor());
}
}
......@@ -2049,7 +2049,7 @@ TEST_P(ParameterizedWebFrameTest, targetDensityDpiHigh)
int viewportWidth = 640;
int viewportHeight = 480;
for (size_t i = 0; i < ARRAY_SIZE(deviceScaleFactors); ++i) {
for (size_t i = 0; i < WTF_ARRAY_LENGTH(deviceScaleFactors); ++i) {
float deviceScaleFactor = deviceScaleFactors[i];
float deviceDpi = deviceScaleFactor * 160.0f;
client.m_screenInfo.deviceScaleFactor = deviceScaleFactor;
......@@ -2079,7 +2079,7 @@ TEST_P(ParameterizedWebFrameTest, targetDensityDpiDevice)
int viewportWidth = 640;
int viewportHeight = 480;
for (size_t i = 0; i < ARRAY_SIZE(deviceScaleFactors); ++i) {
for (size_t i = 0; i < WTF_ARRAY_LENGTH(deviceScaleFactors); ++i) {
client.m_screenInfo.deviceScaleFactor = deviceScaleFactors[i];
FrameTestHelpers::WebViewHelper webViewHelper(this);
......@@ -2104,7 +2104,7 @@ TEST_P(ParameterizedWebFrameTest, targetDensityDpiDeviceAndFixedWidth)
int viewportWidth = 640;
int viewportHeight = 480;
for (size_t i = 0; i < ARRAY_SIZE(deviceScaleFactors); ++i) {
for (size_t i = 0; i < WTF_ARRAY_LENGTH(deviceScaleFactors); ++i) {
client.m_screenInfo.deviceScaleFactor = deviceScaleFactors[i];
FrameTestHelpers::WebViewHelper webViewHelper(this);
......
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