Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(966)

Side by Side Diff: third_party/WebKit/Source/core/frame/SubresourceIntegrityTest.cpp

Issue 1406183010: Replace ARRAY_SIZE with WTF_ARRAY_LENGTH (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "config.h" 5 #include "config.h"
6 #include "core/frame/SubresourceIntegrity.h" 6 #include "core/frame/SubresourceIntegrity.h"
7 7
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/dom/Document.h" 9 #include "core/dom/Document.h"
10 #include "core/fetch/IntegrityMetadata.h" 10 #include "core/fetch/IntegrityMetadata.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 expectParseMultipleHashes("", 0, 0); 309 expectParseMultipleHashes("", 0, 0);
310 expectParseMultipleHashes(" ", 0, 0); 310 expectParseMultipleHashes(" ", 0, 0);
311 311
312 const IntegrityMetadata kValidSha384AndSha512[] = { 312 const IntegrityMetadata kValidSha384AndSha512[] = {
313 {"XVVXBGoYw6AJOh9J+Z8pBDMVVPfkBpngexkA7JqZu8d5GENND6TEIup/tA1v5GPr", Has hAlgorithmSha384}, 313 {"XVVXBGoYw6AJOh9J+Z8pBDMVVPfkBpngexkA7JqZu8d5GENND6TEIup/tA1v5GPr", Has hAlgorithmSha384},
314 {"tbUPioKbVBplr0b1ucnWB57SJWt4x9dOE0Vy2mzCXvH3FepqDZ+07yMK81ytlg0MPaIrPA jcHqba5csorDWtKg==", HashAlgorithmSha512} 314 {"tbUPioKbVBplr0b1ucnWB57SJWt4x9dOE0Vy2mzCXvH3FepqDZ+07yMK81ytlg0MPaIrPA jcHqba5csorDWtKg==", HashAlgorithmSha512}
315 }; 315 };
316 expectParseMultipleHashes( 316 expectParseMultipleHashes(
317 "sha384-XVVXBGoYw6AJOh9J+Z8pBDMVVPfkBpngexkA7JqZu8d5GENND6TEIup/tA1v5GPr sha512-tbUPioKbVBplr0b1ucnWB57SJWt4x9dOE0Vy2mzCXvH3FepqDZ+07yMK81ytlg0MPaIrPAjc Hqba5csorDWtKg==", 317 "sha384-XVVXBGoYw6AJOh9J+Z8pBDMVVPfkBpngexkA7JqZu8d5GENND6TEIup/tA1v5GPr sha512-tbUPioKbVBplr0b1ucnWB57SJWt4x9dOE0Vy2mzCXvH3FepqDZ+07yMK81ytlg0MPaIrPAjc Hqba5csorDWtKg==",
318 kValidSha384AndSha512, 318 kValidSha384AndSha512,
319 ARRAY_SIZE(kValidSha384AndSha512)); 319 WTF_ARRAY_LENGTH(kValidSha384AndSha512));
320 320
321 const IntegrityMetadata kValidSha256AndSha256[] = { 321 const IntegrityMetadata kValidSha256AndSha256[] = {
322 {"BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", HashAlgorithmSha256}, 322 {"BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", HashAlgorithmSha256},
323 {"deadbeef", HashAlgorithmSha256} 323 {"deadbeef", HashAlgorithmSha256}
324 }; 324 };
325 expectParseMultipleHashes( 325 expectParseMultipleHashes(
326 "sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE= sha256-deadbeef", 326 "sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE= sha256-deadbeef",
327 kValidSha256AndSha256, 327 kValidSha256AndSha256,
328 ARRAY_SIZE(kValidSha256AndSha256)); 328 WTF_ARRAY_LENGTH(kValidSha256AndSha256));
329 329
330 const IntegrityMetadata kValidSha256AndInvalidSha256[] = { 330 const IntegrityMetadata kValidSha256AndInvalidSha256[] = {
331 {"BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", HashAlgorithmSha256} 331 {"BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", HashAlgorithmSha256}
332 }; 332 };
333 expectParseMultipleHashes( 333 expectParseMultipleHashes(
334 "sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE= sha256-!!!!", 334 "sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE= sha256-!!!!",
335 kValidSha256AndInvalidSha256, 335 kValidSha256AndInvalidSha256,
336 ARRAY_SIZE(kValidSha256AndInvalidSha256)); 336 WTF_ARRAY_LENGTH(kValidSha256AndInvalidSha256));
337 337
338 const IntegrityMetadata kInvalidSha256AndValidSha256[] = { 338 const IntegrityMetadata kInvalidSha256AndValidSha256[] = {
339 {"BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", HashAlgorithmSha256} 339 {"BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", HashAlgorithmSha256}
340 }; 340 };
341 expectParseMultipleHashes( 341 expectParseMultipleHashes(
342 "sha256-!!! sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", 342 "sha256-!!! sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=",
343 kInvalidSha256AndValidSha256, 343 kInvalidSha256AndValidSha256,
344 ARRAY_SIZE(kInvalidSha256AndValidSha256)); 344 WTF_ARRAY_LENGTH(kInvalidSha256AndValidSha256));
345 345
346 expectParse( 346 expectParse(
347 "sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=?foo=bar", 347 "sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=?foo=bar",
348 "BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", 348 "BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=",
349 HashAlgorithmSha256); 349 HashAlgorithmSha256);
350 350
351 expectParse( 351 expectParse(
352 "sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=?foo=bar?baz=foz", 352 "sha256-BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=?foo=bar?baz=foz",
353 "BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=", 353 "BpfBw7ivV8q2jLiT13fxDYAe2tJllusRSZ273h2nFSE=",
354 HashAlgorithmSha256); 354 HashAlgorithmSha256);
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
435 expectIntegrity(kUnsupportedHashFunctionIntegrity, kBasicScript, strlen(kBas icScript), secureURL, insecureURL); 435 expectIntegrity(kUnsupportedHashFunctionIntegrity, kBasicScript, strlen(kBas icScript), secureURL, insecureURL);
436 436
437 expectIntegrity(kSha256AndSha384Integrities, kBasicScript, strlen(kBasicScri pt), secureURL, insecureURL); 437 expectIntegrity(kSha256AndSha384Integrities, kBasicScript, strlen(kBasicScri pt), secureURL, insecureURL);
438 expectIntegrity(kBadSha256AndGoodSha384Integrities, kBasicScript, strlen(kBa sicScript), secureURL, insecureURL); 438 expectIntegrity(kBadSha256AndGoodSha384Integrities, kBasicScript, strlen(kBa sicScript), secureURL, insecureURL);
439 439
440 expectIntegrityFailure(kSha256Integrity, kBasicScript, strlen(kBasicScript), secureURL, insecureURL, NoCors); 440 expectIntegrityFailure(kSha256Integrity, kBasicScript, strlen(kBasicScript), secureURL, insecureURL, NoCors);
441 expectIntegrityFailure(kGoodSha256AndBadSha384Integrities, kBasicScript, str len(kBasicScript), secureURL, insecureURL); 441 expectIntegrityFailure(kGoodSha256AndBadSha384Integrities, kBasicScript, str len(kBasicScript), secureURL, insecureURL);
442 } 442 }
443 443
444 } // namespace blink 444 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698