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

Side by Side Diff: base/file_util_unittest.cc

Issue 2756007: Mark FileUtilTest.CountFilesCreatedAfter as flaky (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 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 | « no previous file | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #if defined(OS_WIN) 7 #if defined(OS_WIN)
8 #include <windows.h> 8 #include <windows.h>
9 #include <winioctl.h> 9 #include <winioctl.h>
10 #include <shellapi.h> 10 #include <shellapi.h>
(...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 TEST_F(FileUtilTest, GetDirectoryFromPath) { 399 TEST_F(FileUtilTest, GetDirectoryFromPath) {
400 for (unsigned int i = 0; i < arraysize(dir_cases); ++i) { 400 for (unsigned int i = 0; i < arraysize(dir_cases); ++i) {
401 const dir_case& dir = dir_cases[i]; 401 const dir_case& dir = dir_cases[i];
402 const std::wstring parent = 402 const std::wstring parent =
403 file_util::GetDirectoryFromPath(dir.full_path); 403 file_util::GetDirectoryFromPath(dir.full_path);
404 EXPECT_EQ(dir.directory, parent); 404 EXPECT_EQ(dir.directory, parent);
405 } 405 }
406 } 406 }
407 #endif 407 #endif
408 408
409 TEST_F(FileUtilTest, CountFilesCreatedAfter) { 409 TEST_F(FileUtilTest, FLAKY_CountFilesCreatedAfter) {
410 // Create old file (that we don't want to count) 410 // Create old file (that we don't want to count)
411 FilePath old_file_name = test_dir_.Append(FILE_PATH_LITERAL("Old File.txt")); 411 FilePath old_file_name = test_dir_.Append(FILE_PATH_LITERAL("Old File.txt"));
412 CreateTextFile(old_file_name, L"Just call me Mr. Creakybits"); 412 CreateTextFile(old_file_name, L"Just call me Mr. Creakybits");
413 413
414 // Age to perfection 414 // Age to perfection
415 #if defined(OS_WIN) 415 #if defined(OS_WIN)
416 PlatformThread::Sleep(100); 416 PlatformThread::Sleep(100);
417 #elif defined(OS_POSIX) 417 #elif defined(OS_POSIX)
418 // We need to wait at least one second here because the precision of 418 // We need to wait at least one second here because the precision of
419 // file creation time is one second. 419 // file creation time is one second.
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 // Want a directory whose name is long enough to make the path to the file 524 // Want a directory whose name is long enough to make the path to the file
525 // inside just under MAX_PATH chars. This will be used to test that when 525 // inside just under MAX_PATH chars. This will be used to test that when
526 // a junction expands to a path over MAX_PATH chars in length, 526 // a junction expands to a path over MAX_PATH chars in length,
527 // NormalizeFilePath() fails without crashing. 527 // NormalizeFilePath() fails without crashing.
528 FilePath sub_long_rel(FPL("sub_long")); 528 FilePath sub_long_rel(FPL("sub_long"));
529 FilePath deep_txt(FPL("deep.txt")); 529 FilePath deep_txt(FPL("deep.txt"));
530 530
531 int target_length = MAX_PATH; 531 int target_length = MAX_PATH;
532 target_length -= (sub_a.value().length() + 1); // +1 for the sepperator '\'. 532 target_length -= (sub_a.value().length() + 1); // +1 for the sepperator '\'.
533 target_length -= (sub_long_rel.Append(deep_txt).value().length() + 1); 533 target_length -= (sub_long_rel.Append(deep_txt).value().length() + 1);
534 // Without making the path a bit shorter, CreateDirectory() fails. 534 // Without making the path a bit shorter, CreateDirectory() fails.
535 // the resulting path is still long enough to hit the failing case in 535 // the resulting path is still long enough to hit the failing case in
536 // NormalizePath(). 536 // NormalizePath().
537 const int kCreateDirLimit = 4; 537 const int kCreateDirLimit = 4;
538 target_length -= kCreateDirLimit; 538 target_length -= kCreateDirLimit;
539 FilePath::StringType long_name_str = FPL("long_name_"); 539 FilePath::StringType long_name_str = FPL("long_name_");
540 long_name_str.resize(target_length, '_'); 540 long_name_str.resize(target_length, '_');
541 541
542 FilePath long_name = sub_a.Append(FilePath(long_name_str)); 542 FilePath long_name = sub_a.Append(FilePath(long_name_str));
543 FilePath deep_file = long_name.Append(sub_long_rel).Append(deep_txt); 543 FilePath deep_file = long_name.Append(sub_long_rel).Append(deep_txt);
544 ASSERT_EQ(MAX_PATH - kCreateDirLimit, deep_file.value().length()); 544 ASSERT_EQ(MAX_PATH - kCreateDirLimit, deep_file.value().length());
(...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1841 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir)); 1841 EXPECT_TRUE(file_util::IsDirectoryEmpty(empty_dir));
1842 1842
1843 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt"))); 1843 FilePath foo(empty_dir.Append(FILE_PATH_LITERAL("foo.txt")));
1844 std::string bar("baz"); 1844 std::string bar("baz");
1845 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length())); 1845 ASSERT_TRUE(file_util::WriteFile(foo, bar.c_str(), bar.length()));
1846 1846
1847 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir)); 1847 EXPECT_FALSE(file_util::IsDirectoryEmpty(empty_dir));
1848 } 1848 }
1849 1849
1850 } // namespace 1850 } // namespace
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698