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

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

Issue 5259003: On windows filepaths need \\?\ prefix to allow extended file path names. Fix ... (Closed) Base URL: svn://chrome-svn/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 FilePath dir_path(FILE_PATH_LITERAL("\\\\?\\") + dir.path().value());
ericu 2010/11/25 04:18:35 I don't see anything forcing this test only to run
471 FilePath dir1 = dir_path.AppendASCII(
472 "012345678901234567890123456789012345678901234567890123456789"
473 "012345678901234567890123456789012345678901234567890123456789"
474 "0123456789012345678901234567890123456789");
475 FilePath file = dir1.AppendASCII(
476 "012345678901234567890123456789012345678901234567890123456789"
477 "012345678901234567890123456789012345678901234567890123456789"
478 "0123456789012345678901234567890123456789");
479 operation()->CreateDirectory(dir1, false, true);
480 MessageLoop::current()->RunAllPending();
481 operation()->CreateFile(file, true);
482 MessageLoop::current()->RunAllPending();
483 EXPECT_TRUE(file_util::PathExists(file));
484 }
485
466 TEST_F(FileSystemOperationTest, TestCreateFileSuccessFileExists) { 486 TEST_F(FileSystemOperationTest, TestCreateFileSuccessFileExists) {
467 // Already existing file and exclusive false. 487 // Already existing file and exclusive false.
468 ScopedTempDir dir; 488 ScopedTempDir dir;
469 ASSERT_TRUE(dir.CreateUniqueTempDir()); 489 ASSERT_TRUE(dir.CreateUniqueTempDir());
470 FilePath file; 490 FilePath file;
471 file_util::CreateTemporaryFileInDir(dir.path(), &file); 491 file_util::CreateTemporaryFileInDir(dir.path(), &file);
472 492
473 operation()->CreateFile(file, false); 493 operation()->CreateFile(file, false);
474 MessageLoop::current()->RunAllPending(); 494 MessageLoop::current()->RunAllPending();
475 EXPECT_EQ(kFileOperationSucceeded, mock_dispatcher_->status()); 495 EXPECT_EQ(kFileOperationSucceeded, mock_dispatcher_->status());
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
781 801
782 // Check that its length is now 3 and that it contains only bits of test data. 802 // Check that its length is now 3 and that it contains only bits of test data.
783 EXPECT_TRUE(file_util::GetFileInfo(file, &info)); 803 EXPECT_TRUE(file_util::GetFileInfo(file, &info));
784 EXPECT_EQ(length, info.size); 804 EXPECT_EQ(length, info.size);
785 EXPECT_EQ(length, file_util::ReadFile(file, data, length)); 805 EXPECT_EQ(length, file_util::ReadFile(file, data, length));
786 for (int i = 0; i < length; ++i) 806 for (int i = 0; i < length; ++i)
787 EXPECT_EQ(test_data[i], data[i]); 807 EXPECT_EQ(test_data[i], data[i]);
788 } 808 }
789 809
790 } // namespace fileapi 810 } // namespace fileapi
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698