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

Side by Side Diff: extensions/common/file_util_unittest.cc

Issue 660703002: Convert ARRAYSIZE_UNSAFE -> arraysize in extensions/. (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
« no previous file with comments | « no previous file | extensions/common/permissions/extensions_api_permissions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "extensions/common/file_util.h" 5 #include "extensions/common/file_util.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/json/json_string_value_serializer.h" 10 #include "base/json/json_string_value_serializer.h"
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 "simple.html" }, 415 "simple.html" },
416 { URL_PREFIX "/simple.html", 416 { URL_PREFIX "/simple.html",
417 "simple.html" }, 417 "simple.html" },
418 { URL_PREFIX "\\simple.html", 418 { URL_PREFIX "\\simple.html",
419 "simple.html" }, 419 "simple.html" },
420 { URL_PREFIX "\\\\foo\\simple.html", 420 { URL_PREFIX "\\\\foo\\simple.html",
421 "foo/simple.html" }, 421 "foo/simple.html" },
422 }; 422 };
423 #undef URL_PREFIX 423 #undef URL_PREFIX
424 424
425 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { 425 for (size_t i = 0; i < arraysize(test_cases); ++i) {
426 GURL url(test_cases[i].url); 426 GURL url(test_cases[i].url);
427 base::FilePath expected_path = 427 base::FilePath expected_path =
428 base::FilePath::FromUTF8Unsafe(test_cases[i].expected_relative_path); 428 base::FilePath::FromUTF8Unsafe(test_cases[i].expected_relative_path);
429 base::FilePath actual_path = 429 base::FilePath actual_path =
430 extensions::file_util::ExtensionURLToRelativeFilePath(url); 430 extensions::file_util::ExtensionURLToRelativeFilePath(url);
431 EXPECT_FALSE(actual_path.IsAbsolute()) << 431 EXPECT_FALSE(actual_path.IsAbsolute()) <<
432 " For the path " << actual_path.value(); 432 " For the path " << actual_path.value();
433 EXPECT_EQ(expected_path.value(), actual_path.value()) << 433 EXPECT_EQ(expected_path.value(), actual_path.value()) <<
434 " For the path " << url; 434 " For the path " << url;
435 } 435 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 { URL_PREFIX "apiname/..%2F../test.js", 480 { URL_PREFIX "apiname/..%2F../test.js",
481 NULL }, 481 NULL },
482 { URL_PREFIX "apiname/f/../../../test.js", 482 { URL_PREFIX "apiname/f/../../../test.js",
483 FILE_PATH_LITERAL("test.js") }, 483 FILE_PATH_LITERAL("test.js") },
484 { URL_PREFIX "apiname/f%2F..%2F..%2F../test.js", 484 { URL_PREFIX "apiname/f%2F..%2F..%2F../test.js",
485 NULL }, 485 NULL },
486 }; 486 };
487 #undef SEP 487 #undef SEP
488 #undef URL_PREFIX 488 #undef URL_PREFIX
489 489
490 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_cases); ++i) { 490 for (size_t i = 0; i < arraysize(test_cases); ++i) {
491 GURL url(test_cases[i].url); 491 GURL url(test_cases[i].url);
492 base::FilePath expected_path; 492 base::FilePath expected_path;
493 if (test_cases[i].expected_path) 493 if (test_cases[i].expected_path)
494 expected_path = root_path.Append(FILE_PATH_LITERAL("apiname")).Append( 494 expected_path = root_path.Append(FILE_PATH_LITERAL("apiname")).Append(
495 test_cases[i].expected_path); 495 test_cases[i].expected_path);
496 base::FilePath actual_path = 496 base::FilePath actual_path =
497 extensions::file_util::ExtensionResourceURLToFilePath(url, root_path); 497 extensions::file_util::ExtensionResourceURLToFilePath(url, root_path);
498 EXPECT_EQ(expected_path.value(), actual_path.value()) << 498 EXPECT_EQ(expected_path.value(), actual_path.value()) <<
499 " For the path " << url; 499 " For the path " << url;
500 } 500 }
501 // Remove temp files. 501 // Remove temp files.
502 ASSERT_TRUE(base::DeleteFile(root_path, true)); 502 ASSERT_TRUE(base::DeleteFile(root_path, true));
503 } 503 }
504 504
505 } // namespace extensions 505 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | extensions/common/permissions/extensions_api_permissions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698