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

Side by Side Diff: webkit/fileapi/isolated_file_util_unittest.cc

Issue 13850004: Ignore symlinks in Drag-and-drop'ed folder (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « webkit/fileapi/isolated_file_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <map> 5 #include <map>
6 #include <queue> 6 #include <queue>
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 continue; 363 continue;
364 364
365 SCOPED_TRACE(testing::Message() << "Testing RegularTestCases " << i 365 SCOPED_TRACE(testing::Message() << "Testing RegularTestCases " << i
366 << ": " << test_case.path); 366 << ": " << test_case.path);
367 367
368 // Read entries in the directory to construct the expected results map. 368 // Read entries in the directory to construct the expected results map.
369 typedef std::map<base::FilePath::StringType, 369 typedef std::map<base::FilePath::StringType,
370 base::FileUtilProxy::Entry> EntryMap; 370 base::FileUtilProxy::Entry> EntryMap;
371 EntryMap expected_entry_map; 371 EntryMap expected_entry_map;
372 372
373 base::FilePath dir_path = GetTestCasePlatformPath(test_case.path);
373 FileEnumerator file_enum( 374 FileEnumerator file_enum(
374 GetTestCasePlatformPath(test_case.path), false /* not recursive */, 375 dir_path, false /* not recursive */,
375 FileEnumerator::FILES | FileEnumerator::DIRECTORIES); 376 FileEnumerator::FILES | FileEnumerator::DIRECTORIES);
376 base::FilePath current; 377 base::FilePath current;
377 while (!(current = file_enum.Next()).empty()) { 378 while (!(current = file_enum.Next()).empty()) {
378 FileEnumerator::FindInfo file_info; 379 FileEnumerator::FindInfo file_info;
379 file_enum.GetFindInfo(&file_info); 380 file_enum.GetFindInfo(&file_info);
380 base::FileUtilProxy::Entry entry; 381 base::FileUtilProxy::Entry entry;
381 entry.is_directory = FileEnumerator::IsDirectory(file_info); 382 entry.is_directory = FileEnumerator::IsDirectory(file_info);
382 entry.name = current.BaseName().value(); 383 entry.name = current.BaseName().value();
383 entry.size = FileEnumerator::GetFilesize(file_info); 384 entry.size = FileEnumerator::GetFilesize(file_info);
384 entry.last_modified_time = FileEnumerator::GetLastModifiedTime(file_info); 385 entry.last_modified_time = FileEnumerator::GetLastModifiedTime(file_info);
385 expected_entry_map[entry.name] = entry; 386 expected_entry_map[entry.name] = entry;
387
388 // Creates a symlink for each file/directory.
389 // They should be ignored by ReadDirectory, so we don't add them
390 // to expected_entry_map.
391 file_util::CreateSymbolicLink(
tzik 2013/04/10 13:10:22 Add #ifdef for windows, (as we chatted)
kinuko 2013/04/10 13:12:13 Done.
392 current,
393 dir_path.Append(current.BaseName().AddExtension(
394 FILE_PATH_LITERAL("link"))));
386 } 395 }
387 396
388 // Perform ReadDirectory in the isolated filesystem. 397 // Perform ReadDirectory in the isolated filesystem.
389 FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path)); 398 FileSystemURL url = GetFileSystemURL(base::FilePath(test_case.path));
390 FileEntryList entries; 399 FileEntryList entries;
391 ASSERT_EQ(base::PLATFORM_FILE_OK, 400 ASSERT_EQ(base::PLATFORM_FILE_OK,
392 AsyncFileTestHelper::ReadDirectory( 401 AsyncFileTestHelper::ReadDirectory(
393 file_system_context(), url, &entries)); 402 file_system_context(), url, &entries));
394 403
395 EXPECT_EQ(expected_entry_map.size(), entries.size()); 404 EXPECT_EQ(expected_entry_map.size(), entries.size());
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
540 EXPECT_EQ(base::PLATFORM_FILE_OK, 549 EXPECT_EQ(base::PLATFORM_FILE_OK,
541 file_util()->Truncate(GetOperationContext().get(), url, 999)); 550 file_util()->Truncate(GetOperationContext().get(), url, 999));
542 ASSERT_EQ(base::PLATFORM_FILE_OK, 551 ASSERT_EQ(base::PLATFORM_FILE_OK,
543 file_util()->GetFileInfo(GetOperationContext().get(), url, 552 file_util()->GetFileInfo(GetOperationContext().get(), url,
544 &info, &platform_path)); 553 &info, &platform_path));
545 EXPECT_EQ(999, info.size); 554 EXPECT_EQ(999, info.size);
546 } 555 }
547 } 556 }
548 557
549 } // namespace fileapi 558 } // namespace fileapi
OLDNEW
« no previous file with comments | « webkit/fileapi/isolated_file_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698