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

Side by Side Diff: content/child/webcrypto/test/test_helpers.cc

Issue 654403002: Convert ARRAYSIZE_UNSAFE -> arraysize in content/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months 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 "content/child/webcrypto/test/test_helpers.h" 5 #include "content/child/webcrypto/test/test_helpers.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 struct { 227 struct {
228 const char* name; 228 const char* name;
229 blink::WebCryptoAlgorithmId id; 229 blink::WebCryptoAlgorithmId id;
230 } kDigestNameToId[] = { 230 } kDigestNameToId[] = {
231 {"sha-1", blink::WebCryptoAlgorithmIdSha1}, 231 {"sha-1", blink::WebCryptoAlgorithmIdSha1},
232 {"sha-256", blink::WebCryptoAlgorithmIdSha256}, 232 {"sha-256", blink::WebCryptoAlgorithmIdSha256},
233 {"sha-384", blink::WebCryptoAlgorithmIdSha384}, 233 {"sha-384", blink::WebCryptoAlgorithmIdSha384},
234 {"sha-512", blink::WebCryptoAlgorithmIdSha512}, 234 {"sha-512", blink::WebCryptoAlgorithmIdSha512},
235 }; 235 };
236 236
237 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kDigestNameToId); ++i) { 237 for (size_t i = 0; i < arraysize(kDigestNameToId); ++i) {
238 if (kDigestNameToId[i].name == algorithm_name) 238 if (kDigestNameToId[i].name == algorithm_name)
239 return CreateAlgorithm(kDigestNameToId[i].id); 239 return CreateAlgorithm(kDigestNameToId[i].id);
240 } 240 }
241 241
242 return blink::WebCryptoAlgorithm::createNull(); 242 return blink::WebCryptoAlgorithm::createNull();
243 } 243 }
244 244
245 // Creates a comparator for |bufs| which operates on indices rather than values. 245 // Creates a comparator for |bufs| which operates on indices rather than values.
246 class CompareUsingIndex { 246 class CompareUsingIndex {
247 public: 247 public:
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
576 // Export the key in raw format and compare to the original. 576 // Export the key in raw format and compare to the original.
577 std::vector<uint8_t> key_raw_out; 577 std::vector<uint8_t> key_raw_out;
578 ASSERT_EQ(Status::Success(), 578 ASSERT_EQ(Status::Success(),
579 ExportKey(blink::WebCryptoKeyFormatRaw, key, &key_raw_out)); 579 ExportKey(blink::WebCryptoKeyFormatRaw, key, &key_raw_out));
580 EXPECT_BYTES_EQ_HEX(key_hex, key_raw_out); 580 EXPECT_BYTES_EQ_HEX(key_hex, key_raw_out);
581 } 581 }
582 582
583 } // namespace webcrypto 583 } // namespace webcrypto
584 584
585 } // namesapce content 585 } // namesapce content
OLDNEW
« no previous file with comments | « content/child/webcrypto/test/rsa_ssa_unittest.cc ('k') | content/common/android/address_parser_internal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698