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

Side by Side Diff: webkit/fileapi/syncable/local_file_sync_context_unittest.cc

Issue 14623008: [SyncFileSystem] Remove existing entry on LocalFileSyncContext::ApplyRemoteChange call. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comment Created 7 years, 7 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/syncable/local_file_sync_context.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 "webkit/fileapi/syncable/local_file_sync_context.h" 5 #include "webkit/fileapi/syncable/local_file_sync_context.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
569 change, kFilePath2, kFile2, 569 change, kFilePath2, kFile2,
570 SYNC_FILE_TYPE_UNKNOWN)); 570 SYNC_FILE_TYPE_UNKNOWN));
571 571
572 change = FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, 572 change = FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE,
573 SYNC_FILE_TYPE_DIRECTORY); 573 SYNC_FILE_TYPE_DIRECTORY);
574 EXPECT_EQ(SYNC_STATUS_OK, 574 EXPECT_EQ(SYNC_STATUS_OK,
575 ApplyRemoteChange(file_system.file_system_context(), 575 ApplyRemoteChange(file_system.file_system_context(),
576 change, base::FilePath(), kDir, 576 change, base::FilePath(), kDir,
577 SYNC_FILE_TYPE_UNKNOWN)); 577 SYNC_FILE_TYPE_UNKNOWN));
578 578
579 // This should not happen, but calling ApplyRemoteChange 579 // Calling ApplyRemoteChange with different file type should be handled as
580 // with wrong file type will result in error. 580 // overwrite.
581 change =
582 FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, SYNC_FILE_TYPE_FILE);
583 EXPECT_EQ(SYNC_STATUS_OK,
584 ApplyRemoteChange(file_system.file_system_context(),
585 change,
586 kFilePath1,
587 kDir,
588 SYNC_FILE_TYPE_DIRECTORY));
589 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kDir));
590
581 change = FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE, 591 change = FileChange(FileChange::FILE_CHANGE_ADD_OR_UPDATE,
582 SYNC_FILE_TYPE_FILE); 592 SYNC_FILE_TYPE_DIRECTORY);
583 EXPECT_NE(SYNC_STATUS_OK, 593 EXPECT_EQ(SYNC_STATUS_OK,
584 ApplyRemoteChange(file_system.file_system_context(), 594 ApplyRemoteChange(file_system.file_system_context(),
585 change, kFilePath1, kDir, 595 change,
586 SYNC_FILE_TYPE_DIRECTORY)); 596 kFilePath1,
597 kDir,
598 SYNC_FILE_TYPE_FILE));
587 599
588 // Creating a file/directory must have increased the usage more than 600 // Creating a file/directory must have increased the usage more than
589 // the size of kTestFileData2. 601 // the size of kTestFileData2.
590 new_usage = usage; 602 new_usage = usage;
591 EXPECT_EQ(quota::kQuotaStatusOk, 603 EXPECT_EQ(quota::kQuotaStatusOk,
592 file_system.GetUsageAndQuota(&new_usage, &quota)); 604 file_system.GetUsageAndQuota(&new_usage, &quota));
593 EXPECT_GT(new_usage, 605 EXPECT_GT(new_usage,
594 static_cast<int64>(usage + arraysize(kTestFileData2) - 1)); 606 static_cast<int64>(usage + arraysize(kTestFileData2) - 1));
595 607
596 // The changes applied by ApplyRemoteChange should not be recorded in 608 // The changes applied by ApplyRemoteChange should not be recorded in
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
653 665
654 // Make sure kDir and kFile are created by ApplyRemoteChange. 666 // Make sure kDir and kFile are created by ApplyRemoteChange.
655 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kFile)); 667 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.FileExists(kFile));
656 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.DirectoryExists(kDir)); 668 EXPECT_EQ(base::PLATFORM_FILE_OK, file_system.DirectoryExists(kDir));
657 669
658 sync_context_->ShutdownOnUIThread(); 670 sync_context_->ShutdownOnUIThread();
659 file_system.TearDown(); 671 file_system.TearDown();
660 } 672 }
661 673
662 } // namespace sync_file_system 674 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « webkit/fileapi/syncable/local_file_sync_context.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698