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

Side by Side Diff: content/browser/fileapi/obfuscated_file_util_unittest.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 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/files/file.h" 10 #include "base/files/file.h"
(...skipping 1766 matching lines...) Expand 10 before | Expand all | Expand 10 after
1777 1777
1778 TEST_F(ObfuscatedFileUtilTest, TestIncompleteDirectoryReading) { 1778 TEST_F(ObfuscatedFileUtilTest, TestIncompleteDirectoryReading) {
1779 const FileSystemURL kPath[] = { 1779 const FileSystemURL kPath[] = {
1780 CreateURLFromUTF8("foo"), 1780 CreateURLFromUTF8("foo"),
1781 CreateURLFromUTF8("bar"), 1781 CreateURLFromUTF8("bar"),
1782 CreateURLFromUTF8("baz") 1782 CreateURLFromUTF8("baz")
1783 }; 1783 };
1784 const FileSystemURL empty_path = CreateURL(base::FilePath()); 1784 const FileSystemURL empty_path = CreateURL(base::FilePath());
1785 scoped_ptr<FileSystemOperationContext> context; 1785 scoped_ptr<FileSystemOperationContext> context;
1786 1786
1787 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kPath); ++i) { 1787 for (size_t i = 0; i < arraysize(kPath); ++i) {
1788 bool created = false; 1788 bool created = false;
1789 context.reset(NewContext(NULL)); 1789 context.reset(NewContext(NULL));
1790 EXPECT_EQ(base::File::FILE_OK, 1790 EXPECT_EQ(base::File::FILE_OK,
1791 ofu()->EnsureFileExists(context.get(), kPath[i], &created)); 1791 ofu()->EnsureFileExists(context.get(), kPath[i], &created));
1792 EXPECT_TRUE(created); 1792 EXPECT_TRUE(created);
1793 } 1793 }
1794 1794
1795 std::vector<storage::DirectoryEntry> entries; 1795 std::vector<storage::DirectoryEntry> entries;
1796 EXPECT_EQ(base::File::FILE_OK, 1796 EXPECT_EQ(base::File::FILE_OK,
1797 AsyncFileTestHelper::ReadDirectory( 1797 AsyncFileTestHelper::ReadDirectory(
1798 file_system_context(), empty_path, &entries)); 1798 file_system_context(), empty_path, &entries));
1799 EXPECT_EQ(3u, entries.size()); 1799 EXPECT_EQ(3u, entries.size());
1800 1800
1801 base::FilePath local_path; 1801 base::FilePath local_path;
1802 EXPECT_EQ(base::File::FILE_OK, 1802 EXPECT_EQ(base::File::FILE_OK,
1803 ofu()->GetLocalFilePath(context.get(), kPath[0], &local_path)); 1803 ofu()->GetLocalFilePath(context.get(), kPath[0], &local_path));
1804 EXPECT_TRUE(base::DeleteFile(local_path, false)); 1804 EXPECT_TRUE(base::DeleteFile(local_path, false));
1805 1805
1806 entries.clear(); 1806 entries.clear();
1807 EXPECT_EQ(base::File::FILE_OK, 1807 EXPECT_EQ(base::File::FILE_OK,
1808 AsyncFileTestHelper::ReadDirectory( 1808 AsyncFileTestHelper::ReadDirectory(
1809 file_system_context(), empty_path, &entries)); 1809 file_system_context(), empty_path, &entries));
1810 EXPECT_EQ(ARRAYSIZE_UNSAFE(kPath) - 1, entries.size()); 1810 EXPECT_EQ(arraysize(kPath) - 1, entries.size());
1811 } 1811 }
1812 1812
1813 TEST_F(ObfuscatedFileUtilTest, TestDirectoryTimestampForCreation) { 1813 TEST_F(ObfuscatedFileUtilTest, TestDirectoryTimestampForCreation) {
1814 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL)); 1814 scoped_ptr<FileSystemOperationContext> context(NewContext(NULL));
1815 const FileSystemURL dir_url = CreateURLFromUTF8("foo_dir"); 1815 const FileSystemURL dir_url = CreateURLFromUTF8("foo_dir");
1816 1816
1817 // Create working directory. 1817 // Create working directory.
1818 EXPECT_EQ(base::File::FILE_OK, 1818 EXPECT_EQ(base::File::FILE_OK,
1819 ofu()->CreateDirectory(context.get(), dir_url, false, false)); 1819 ofu()->CreateDirectory(context.get(), dir_url, false, false));
1820 1820
(...skipping 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
2443 false /* exclusive */, 2443 false /* exclusive */,
2444 true /* recursive */)); 2444 true /* recursive */));
2445 ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY, 2445 ASSERT_EQ(base::File::FILE_ERROR_NOT_A_DIRECTORY,
2446 ofu()->CreateDirectory(UnlimitedContext().get(), 2446 ofu()->CreateDirectory(UnlimitedContext().get(),
2447 path_in_file_in_file, 2447 path_in_file_in_file,
2448 false /* exclusive */, 2448 false /* exclusive */,
2449 true /* recursive */)); 2449 true /* recursive */));
2450 } 2450 }
2451 2451
2452 } // namespace content 2452 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/fileapi/isolated_context_unittest.cc ('k') | content/browser/fileapi/sandbox_file_system_backend_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698