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

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

Issue 5357009: Revert 67385 - On windows filepaths need \\?\ prefix to allow extended file p... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 10 years 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
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 "webkit/fileapi/file_system_operation.h" 5 #include "webkit/fileapi/file_system_operation.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/scoped_ptr.h" 9 #include "base/scoped_ptr.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 ASSERT_TRUE(dir.CreateUniqueTempDir()); 456 ASSERT_TRUE(dir.CreateUniqueTempDir());
457 FilePath file; 457 FilePath file;
458 458
459 file_util::CreateTemporaryFileInDir(dir.path(), &file); 459 file_util::CreateTemporaryFileInDir(dir.path(), &file);
460 operation()->CreateFile(file, true); 460 operation()->CreateFile(file, true);
461 MessageLoop::current()->RunAllPending(); 461 MessageLoop::current()->RunAllPending();
462 EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, mock_dispatcher_->status()); 462 EXPECT_EQ(base::PLATFORM_FILE_ERROR_EXISTS, mock_dispatcher_->status());
463 EXPECT_EQ(request_id_, mock_dispatcher_->request_id()); 463 EXPECT_EQ(request_id_, mock_dispatcher_->request_id());
464 } 464 }
465 465
466 TEST_F(FileSystemOperationTest, TestCreateVeryLongName) {
467 ScopedTempDir dir;
468 ASSERT_TRUE(dir.CreateUniqueTempDir());
469
470 #if defined(OS_WIN)
471 FilePath dir_path(FILE_PATH_LITERAL("\\\\?\\") + dir.path().value());
472 #else
473 FilePath dir_path = dir.path();
474 #endif
475
476 // TODO(kkanetkar): Once each platform's limitations have been enforced
477 // consider that in this test. Currently this test is for
478 // windows primarily.
479 FilePath dir1 = dir_path.AppendASCII(
480 "012345678901234567890123456789012345678901234567890123456789"
481 "012345678901234567890123456789012345678901234567890123456789"
482 "0123456789012345678901234567890123456789");
483 FilePath file = dir1.AppendASCII(
484 "012345678901234567890123456789012345678901234567890123456789"
485 "012345678901234567890123456789012345678901234567890123456789"
486 "0123456789012345678901234567890123456789");
487 operation()->CreateDirectory(dir1, false, true);
488 MessageLoop::current()->RunAllPending();
489 operation()->CreateFile(file, true);
490 MessageLoop::current()->RunAllPending();
491 EXPECT_TRUE(file_util::PathExists(file));
492 }
493
494 TEST_F(FileSystemOperationTest, TestCreateFileSuccessFileExists) { 466 TEST_F(FileSystemOperationTest, TestCreateFileSuccessFileExists) {
495 // Already existing file and exclusive false. 467 // Already existing file and exclusive false.
496 ScopedTempDir dir; 468 ScopedTempDir dir;
497 ASSERT_TRUE(dir.CreateUniqueTempDir()); 469 ASSERT_TRUE(dir.CreateUniqueTempDir());
498 FilePath file; 470 FilePath file;
499 file_util::CreateTemporaryFileInDir(dir.path(), &file); 471 file_util::CreateTemporaryFileInDir(dir.path(), &file);
500 472
501 operation()->CreateFile(file, false); 473 operation()->CreateFile(file, false);
502 MessageLoop::current()->RunAllPending(); 474 MessageLoop::current()->RunAllPending();
503 EXPECT_EQ(kFileOperationSucceeded, mock_dispatcher_->status()); 475 EXPECT_EQ(kFileOperationSucceeded, mock_dispatcher_->status());
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 781
810 // Check that its length is now 3 and that it contains only bits of test data. 782 // Check that its length is now 3 and that it contains only bits of test data.
811 EXPECT_TRUE(file_util::GetFileInfo(file, &info)); 783 EXPECT_TRUE(file_util::GetFileInfo(file, &info));
812 EXPECT_EQ(length, info.size); 784 EXPECT_EQ(length, info.size);
813 EXPECT_EQ(length, file_util::ReadFile(file, data, length)); 785 EXPECT_EQ(length, file_util::ReadFile(file, data, length));
814 for (int i = 0; i < length; ++i) 786 for (int i = 0; i < length; ++i)
815 EXPECT_EQ(test_data[i], data[i]); 787 EXPECT_EQ(test_data[i], data[i]);
816 } 788 }
817 789
818 } // namespace fileapi 790 } // namespace fileapi
OLDNEW
« no previous file with comments | « chrome/browser/renderer_host/browser_render_process_host.cc ('k') | webkit/fileapi/file_system_path_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698