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

Side by Side Diff: chrome/browser/sync_file_system/drive_file_sync_service_unittest.cc

Issue 11665029: Sync FileSystem: Mark empty batch sync origin as incremental sync origin. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 12 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
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 "chrome/browser/sync_file_system/drive_file_sync_service.h" 5 #include "chrome/browser/sync_file_system/drive_file_sync_service.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 ACTION(InvokeDidDownloadFile) { 361 ACTION(InvokeDidDownloadFile) {
362 base::MessageLoopProxy::current()->PostTask( 362 base::MessageLoopProxy::current()->PostTask(
363 FROM_HERE, base::Bind(arg3, google_apis::HTTP_SUCCESS, arg1)); 363 FROM_HERE, base::Bind(arg3, google_apis::HTTP_SUCCESS, arg1));
364 } 364 }
365 365
366 ACTION(InvokeDidApplyRemoteChange) { 366 ACTION(InvokeDidApplyRemoteChange) {
367 base::MessageLoopProxy::current()->PostTask( 367 base::MessageLoopProxy::current()->PostTask(
368 FROM_HERE, base::Bind(arg3, fileapi::SYNC_STATUS_OK)); 368 FROM_HERE, base::Bind(arg3, fileapi::SYNC_STATUS_OK));
369 } 369 }
370 370
371 #if !defined(OS_ANDROID)
kinuko 2013/01/04 10:38:54 This change looks irrelevant?
tzik 2013/01/07 08:37:55 Reverted. It's not related to the change.
372
373 TEST_F(DriveFileSyncServiceTest, GetSyncRoot) { 371 TEST_F(DriveFileSyncServiceTest, GetSyncRoot) {
374 scoped_ptr<Value> sync_root_found_value(LoadJSONFile( 372 scoped_ptr<Value> sync_root_found_value(LoadJSONFile(
375 "sync_file_system/sync_root_found.json")); 373 "sync_file_system/sync_root_found.json"));
376 scoped_ptr<google_apis::ResourceList> sync_root_found( 374 scoped_ptr<google_apis::ResourceList> sync_root_found(
377 google_apis::ResourceList::ExtractAndParse(*sync_root_found_value)); 375 google_apis::ResourceList::ExtractAndParse(*sync_root_found_value));
378 std::string query = FormatTitleQuery(kSyncRootDirectoryName); 376 std::string query = FormatTitleQuery(kSyncRootDirectoryName);
379 EXPECT_CALL(*mock_drive_service(), 377 EXPECT_CALL(*mock_drive_service(),
380 GetResourceList(GURL(), 0, query, false, std::string(), _)) 378 GetResourceList(GURL(), 0, query, false, std::string(), _))
381 .WillOnce(InvokeGetResourceListCallback5( 379 .WillOnce(InvokeGetResourceListCallback5(
382 google_apis::HTTP_SUCCESS, 380 google_apis::HTTP_SUCCESS,
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 google_apis::HTTP_SUCCESS, 539 google_apis::HTTP_SUCCESS,
542 base::Passed(&listing_files_in_empty_directory))); 540 base::Passed(&listing_files_in_empty_directory)));
543 541
544 SetUpDriveSyncService(); 542 SetUpDriveSyncService();
545 bool done = false; 543 bool done = false;
546 sync_service()->RegisterOriginForTrackingChanges( 544 sync_service()->RegisterOriginForTrackingChanges(
547 kOrigin, base::Bind(&ExpectEqStatus, &done, fileapi::SYNC_STATUS_OK)); 545 kOrigin, base::Bind(&ExpectEqStatus, &done, fileapi::SYNC_STATUS_OK));
548 message_loop()->RunUntilIdle(); 546 message_loop()->RunUntilIdle();
549 EXPECT_TRUE(done); 547 EXPECT_TRUE(done);
550 548
551 EXPECT_EQ(1u, metadata_store()->batch_sync_origins().size()); 549 EXPECT_TRUE(metadata_store()->batch_sync_origins().empty());
552 EXPECT_TRUE(metadata_store()->incremental_sync_origins().empty()); 550 EXPECT_EQ(1u, metadata_store()->incremental_sync_origins().size());
553 EXPECT_TRUE(pending_changes().empty()); 551 EXPECT_TRUE(pending_changes().empty());
554 } 552 }
555 553
556 TEST_F(DriveFileSyncServiceTest, RegisterExistingOrigin) { 554 TEST_F(DriveFileSyncServiceTest, RegisterExistingOrigin) {
557 const GURL kOrigin("chrome-extension://example"); 555 const GURL kOrigin("chrome-extension://example");
558 const std::string kDirectoryResourceId("folder:origin_directory_resource_id"); 556 const std::string kDirectoryResourceId("folder:origin_directory_resource_id");
559 const std::string kSyncRootResourceId("folder:sync_root_resource_id"); 557 const std::string kSyncRootResourceId("folder:sync_root_resource_id");
560 558
561 metadata_store()->SetSyncRootDirectory(kSyncRootResourceId); 559 metadata_store()->SetSyncRootDirectory(kSyncRootResourceId);
562 560
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 SetUpDriveSyncService(); 930 SetUpDriveSyncService();
933 931
934 scoped_ptr<ResourceEntry> entry(ResourceEntry::ExtractAndParse( 932 scoped_ptr<ResourceEntry> entry(ResourceEntry::ExtractAndParse(
935 *LoadJSONFile("gdata/file_entry.json"))); 933 *LoadJSONFile("gdata/file_entry.json")));
936 AppendIncrementalRemoteChange(kOrigin, *entry, 12345); 934 AppendIncrementalRemoteChange(kOrigin, *entry, 12345);
937 ProcessRemoteChange(fileapi::SYNC_STATUS_OK, 935 ProcessRemoteChange(fileapi::SYNC_STATUS_OK,
938 CreateURL(kOrigin, kFileName), 936 CreateURL(kOrigin, kFileName),
939 fileapi::SYNC_OPERATION_UPDATED); 937 fileapi::SYNC_OPERATION_UPDATED);
940 } 938 }
941 939
942 #endif // !defined(OS_ANDROID)
943
944 } // namespace sync_file_system 940 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698