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

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

Issue 13866037: Ports XMPP Invalidation code from drive_file_sync_service in /sync_file_system to /google_apis/driv… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix DriveFileSyncServiceMockTest.RegisterNewOrigin test Created 7 years, 8 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 | « chrome/browser/sync_file_system/drive_file_sync_service.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 "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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 ACTION(InvokeDidDownloadFile) { 191 ACTION(InvokeDidDownloadFile) {
192 base::MessageLoopProxy::current()->PostTask( 192 base::MessageLoopProxy::current()->PostTask(
193 FROM_HERE, base::Bind(arg3, google_apis::HTTP_SUCCESS, arg1)); 193 FROM_HERE, base::Bind(arg3, google_apis::HTTP_SUCCESS, arg1));
194 } 194 }
195 195
196 ACTION(InvokeDidApplyRemoteChange) { 196 ACTION(InvokeDidApplyRemoteChange) {
197 base::MessageLoopProxy::current()->PostTask( 197 base::MessageLoopProxy::current()->PostTask(
198 FROM_HERE, base::Bind(arg3, SYNC_STATUS_OK)); 198 FROM_HERE, base::Bind(arg3, SYNC_STATUS_OK));
199 } 199 }
200 200
201 ACTION(InvokeGetChangeListWithEmptyChange) {
202 scoped_ptr<google_apis::ResourceList> resource_list(
203 new google_apis::ResourceList());
204 base::MessageLoopProxy::current()->PostTask(
205 FROM_HERE, base::Bind(arg1, google_apis::HTTP_SUCCESS,
206 base::Passed(&resource_list)));
207 }
208
201 } // namespace 209 } // namespace
202 210
203 class MockRemoteServiceObserver : public RemoteFileSyncService::Observer { 211 class MockRemoteServiceObserver : public RemoteFileSyncService::Observer {
204 public: 212 public:
205 MockRemoteServiceObserver() {} 213 MockRemoteServiceObserver() {}
206 virtual ~MockRemoteServiceObserver() {} 214 virtual ~MockRemoteServiceObserver() {}
207 215
208 // LocalChangeProcessor override. 216 // LocalChangeProcessor override.
209 MOCK_METHOD1(OnRemoteChangeQueueUpdated, 217 MOCK_METHOD1(OnRemoteChangeQueueUpdated,
210 void(int64 pending_changes)); 218 void(int64 pending_changes));
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 = google_apis::ResourceEntry::ExtractAndParse( 588 = google_apis::ResourceEntry::ExtractAndParse(
581 *origin_directory_created_value); 589 *origin_directory_created_value);
582 EXPECT_CALL(*mock_drive_service(), 590 EXPECT_CALL(*mock_drive_service(),
583 AddNewDirectory(parent_directory, directory_name, _)) 591 AddNewDirectory(parent_directory, directory_name, _))
584 .WillOnce(InvokeGetResourceEntryCallback2( 592 .WillOnce(InvokeGetResourceEntryCallback2(
585 google_apis::HTTP_SUCCESS, 593 google_apis::HTTP_SUCCESS,
586 base::Passed(&origin_directory_created))) 594 base::Passed(&origin_directory_created)))
587 .RetiresOnSaturation(); 595 .RetiresOnSaturation();
588 } 596 }
589 597
598 void SetUpDriveServiceExpectCallsForEmptyRemoteChange() {
599 EXPECT_CALL(*mock_drive_service(),
600 GetChangeList(_, _))
601 .WillOnce(InvokeGetChangeListWithEmptyChange());
tzik 2013/04/16 09:14:10 Could you add .RetiresOnSaturation(); since now we
calvinlo 2013/04/16 09:27:51 Done.
602 }
603
590 // End of mock setup helpers ----------------------------------------------- 604 // End of mock setup helpers -----------------------------------------------
591 605
592 private: 606 private:
593 MessageLoop message_loop_; 607 MessageLoop message_loop_;
594 content::TestBrowserThread ui_thread_; 608 content::TestBrowserThread ui_thread_;
595 content::TestBrowserThread file_thread_; 609 content::TestBrowserThread file_thread_;
596 610
597 base::ScopedTempDir base_dir_; 611 base::ScopedTempDir base_dir_;
598 scoped_ptr<TestingProfile> profile_; 612 scoped_ptr<TestingProfile> profile_;
599 613
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
698 DriveFileSyncClient::OriginToDirectoryTitle(kOrigin)); 712 DriveFileSyncClient::OriginToDirectoryTitle(kOrigin));
699 713
700 // Once the directory is created GetAboutResource should be called to get 714 // Once the directory is created GetAboutResource should be called to get
701 // the largest changestamp for the origin as a prepariation of the batch sync. 715 // the largest changestamp for the origin as a prepariation of the batch sync.
702 SetUpDriveServiceExpectCallsForGetAboutResource(); 716 SetUpDriveServiceExpectCallsForGetAboutResource();
703 717
704 SetUpDriveServiceExpectCallsForGetResourceListInDirectory( 718 SetUpDriveServiceExpectCallsForGetResourceListInDirectory(
705 "chromeos/sync_file_system/listing_files_in_empty_directory.json", 719 "chromeos/sync_file_system/listing_files_in_empty_directory.json",
706 kDirectoryResourceId); 720 kDirectoryResourceId);
707 721
722 SetUpDriveServiceExpectCallsForEmptyRemoteChange();
723
708 SetUpDriveSyncService(true); 724 SetUpDriveSyncService(true);
709 bool done = false; 725 bool done = false;
710 sync_service()->RegisterOriginForTrackingChanges( 726 sync_service()->RegisterOriginForTrackingChanges(
711 kOrigin, base::Bind(&ExpectEqStatus, &done, SYNC_STATUS_OK)); 727 kOrigin, base::Bind(&ExpectEqStatus, &done, SYNC_STATUS_OK));
712 message_loop()->RunUntilIdle(); 728 message_loop()->RunUntilIdle();
713 EXPECT_TRUE(done); 729 EXPECT_TRUE(done);
714 730
715 EXPECT_TRUE(metadata_store()->batch_sync_origins().empty()); 731 EXPECT_TRUE(metadata_store()->batch_sync_origins().empty());
716 EXPECT_EQ(1u, metadata_store()->incremental_sync_origins().size()); 732 EXPECT_EQ(1u, metadata_store()->incremental_sync_origins().size());
717 EXPECT_TRUE(pending_changes().empty()); 733 EXPECT_TRUE(pending_changes().empty());
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 entry->set_kind(google_apis::ENTRY_KIND_FOLDER); 1187 entry->set_kind(google_apis::ENTRY_KIND_FOLDER);
1172 1188
1173 // Expect to drop this change for file. 1189 // Expect to drop this change for file.
1174 EXPECT_FALSE(AppendIncrementalRemoteChangeByEntry( 1190 EXPECT_FALSE(AppendIncrementalRemoteChangeByEntry(
1175 kOrigin, *entry, 1)); 1191 kOrigin, *entry, 1));
1176 } 1192 }
1177 1193
1178 #endif // !defined(OS_ANDROID) 1194 #endif // !defined(OS_ANDROID)
1179 1195
1180 } // namespace sync_file_system 1196 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/drive_file_sync_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698