Home | History | Annotate | Download | only in drive_backend_v1
      1 // Copyright 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_service.h"
      6 
      7 #include <algorithm>
      8 
      9 #include "base/file_util.h"
     10 #include "base/message_loop/message_loop.h"
     11 #include "base/stl_util.h"
     12 #include "base/strings/stringprintf.h"
     13 #include "base/strings/utf_string_conversions.h"
     14 #include "base/threading/sequenced_worker_pool.h"
     15 #include "chrome/browser/drive/drive_uploader.h"
     16 #include "chrome/browser/drive/fake_drive_service.h"
     17 #include "chrome/browser/sync_file_system/drive_backend_v1/api_util.h"
     18 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_file_sync_util.h"
     19 #include "chrome/browser/sync_file_system/drive_backend_v1/drive_metadata_store.h"
     20 #include "chrome/browser/sync_file_system/drive_backend_v1/fake_drive_service_helper.h"
     21 #include "chrome/browser/sync_file_system/local/canned_syncable_file_system.h"
     22 #include "chrome/browser/sync_file_system/local/local_file_sync_context.h"
     23 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h"
     24 #include "chrome/browser/sync_file_system/local/sync_file_system_backend.h"
     25 #include "chrome/browser/sync_file_system/sync_file_system_test_util.h"
     26 #include "chrome/browser/sync_file_system/syncable_file_system_util.h"
     27 #include "chrome/test/base/testing_profile.h"
     28 #include "content/public/test/test_browser_thread.h"
     29 #include "content/public/test/test_browser_thread_bundle.h"
     30 #include "testing/gtest/include/gtest/gtest.h"
     31 #include "webkit/browser/fileapi/file_system_context.h"
     32 
     33 #define FPL(path) FILE_PATH_LITERAL(path)
     34 
     35 using content::BrowserThread;
     36 
     37 using google_apis::GDataErrorCode;
     38 using google_apis::ResourceEntry;
     39 
     40 namespace sync_file_system {
     41 
     42 using drive_backend::APIUtil;
     43 using drive_backend::APIUtilInterface;
     44 using drive_backend::FakeDriveServiceHelper;
     45 
     46 class DriveFileSyncServiceSyncTest : public testing::Test {
     47  public:
     48   DriveFileSyncServiceSyncTest()
     49       : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {}
     50 
     51   virtual ~DriveFileSyncServiceSyncTest() {
     52   }
     53 
     54   virtual void SetUp() OVERRIDE {
     55     // TODO(tzik): Set up TestExtensionSystem to support simulated relaunch.
     56 
     57     RegisterSyncableFileSystem();
     58     local_sync_service_.reset(new LocalFileSyncService(&profile_));
     59 
     60     fake_drive_service_ = new drive::FakeDriveService();
     61     fake_drive_service_->Initialize("test_user (at) gmail.com");
     62     ASSERT_TRUE(fake_drive_service_->LoadAccountMetadataForWapi(
     63         "sync_file_system/account_metadata.json"));
     64     ASSERT_TRUE(fake_drive_service_->LoadResourceListForWapi(
     65         "gdata/root_feed.json"));
     66 
     67     drive_uploader_ = new drive::DriveUploader(
     68         fake_drive_service_, base::MessageLoopProxy::current().get());
     69 
     70     fake_drive_helper_.reset(new FakeDriveServiceHelper(
     71         fake_drive_service_, drive_uploader_));
     72 
     73     SyncStatusCode status = SYNC_STATUS_UNKNOWN;
     74     bool created = false;
     75     scoped_ptr<DriveMetadataStore> metadata_store(
     76         new DriveMetadataStore(fake_drive_helper_->base_dir_path(),
     77                                base::MessageLoopProxy::current().get()));
     78     metadata_store->Initialize(CreateResultReceiver(&status, &created));
     79     FlushMessageLoop();
     80     EXPECT_EQ(SYNC_STATUS_OK, status);
     81     EXPECT_TRUE(created);
     82 
     83     scoped_ptr<APIUtil> api_util(APIUtil::CreateForTesting(
     84         fake_drive_helper_->base_dir_path().AppendASCII("tmp"),
     85         scoped_ptr<drive::DriveServiceInterface>(fake_drive_service_),
     86         scoped_ptr<drive::DriveUploaderInterface>(drive_uploader_)));
     87 
     88     remote_sync_service_ = DriveFileSyncService::CreateForTesting(
     89         &profile_,
     90         fake_drive_helper_->base_dir_path(),
     91         api_util.PassAs<APIUtilInterface>(),
     92         metadata_store.Pass());
     93 
     94     local_sync_service_->SetLocalChangeProcessor(remote_sync_service_.get());
     95     remote_sync_service_->SetRemoteChangeProcessor(local_sync_service_.get());
     96   }
     97 
     98   virtual void TearDown() OVERRIDE {
     99     drive_uploader_ = NULL;
    100     fake_drive_service_ = NULL;
    101     remote_sync_service_.reset();
    102     local_sync_service_.reset();
    103     FlushMessageLoop();
    104 
    105     typedef std::map<GURL, CannedSyncableFileSystem*>::iterator iterator;
    106     for (iterator itr = file_systems_.begin();
    107          itr != file_systems_.end(); ++itr) {
    108       itr->second->TearDown();
    109       delete itr->second;
    110     }
    111     file_systems_.clear();
    112 
    113     FlushMessageLoop();
    114     RevokeSyncableFileSystem();
    115   }
    116 
    117  protected:
    118   void RegisterOrigin(const GURL& origin) {
    119     if (!ContainsKey(file_systems_, origin)) {
    120       CannedSyncableFileSystem* file_system = new CannedSyncableFileSystem(
    121           origin,
    122           BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(),
    123           BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)
    124               .get());
    125 
    126       SyncStatusCode status = SYNC_STATUS_UNKNOWN;
    127       file_system->SetUp();
    128       local_sync_service_->MaybeInitializeFileSystemContext(
    129           origin, file_system->file_system_context(),
    130           CreateResultReceiver(&status));
    131       FlushMessageLoop();
    132       EXPECT_EQ(SYNC_STATUS_OK, status);
    133 
    134       file_system->backend()->sync_context()->
    135           set_mock_notify_changes_duration_in_sec(0);
    136 
    137       EXPECT_EQ(base::PLATFORM_FILE_OK, file_system->OpenFileSystem());
    138       file_systems_[origin] = file_system;
    139     }
    140 
    141     SyncStatusCode status = SYNC_STATUS_UNKNOWN;
    142     remote_sync_service_->RegisterOrigin(
    143         origin, CreateResultReceiver(&status));
    144     FlushMessageLoop();
    145     EXPECT_EQ(SYNC_STATUS_OK, status);
    146   }
    147 
    148   void AddOrUpdateLocalFile(const GURL& origin,
    149                             const base::FilePath& path,
    150                             const std::string& content) {
    151     fileapi::FileSystemURL url(CreateSyncableFileSystemURL(origin, path));
    152     ASSERT_TRUE(ContainsKey(file_systems_, origin));
    153     EXPECT_EQ(base::PLATFORM_FILE_OK, file_systems_[origin]->CreateFile(url));
    154     int64 bytes_written = file_systems_[origin]->WriteString(url, content);
    155     EXPECT_EQ(static_cast<int64>(content.size()), bytes_written);
    156     FlushMessageLoop();
    157   }
    158 
    159   void UpdateLocalFile(const GURL& origin,
    160                        const base::FilePath& path,
    161                        const std::string& content) {
    162     ASSERT_TRUE(ContainsKey(file_systems_, origin));
    163     int64 bytes_written = file_systems_[origin]->WriteString(
    164         CreateSyncableFileSystemURL(origin, path), content);
    165     EXPECT_EQ(static_cast<int64>(content.size()), bytes_written);
    166     FlushMessageLoop();
    167   }
    168 
    169   void RemoveLocal(const GURL& origin, const base::FilePath& path) {
    170     ASSERT_TRUE(ContainsKey(file_systems_, origin));
    171     EXPECT_EQ(base::PLATFORM_FILE_OK,
    172               file_systems_[origin]->Remove(
    173                   CreateSyncableFileSystemURL(origin, path),
    174                   true /* recursive */));
    175     FlushMessageLoop();
    176   }
    177 
    178   SyncStatusCode ProcessLocalChange() {
    179     SyncStatusCode status = SYNC_STATUS_UNKNOWN;
    180     fileapi::FileSystemURL url;
    181     local_sync_service_->ProcessLocalChange(
    182         CreateResultReceiver(&status, &url));
    183     FlushMessageLoop();
    184     return status;
    185   }
    186 
    187   SyncStatusCode ProcessRemoteChange() {
    188     SyncStatusCode status = SYNC_STATUS_UNKNOWN;
    189     fileapi::FileSystemURL url;
    190     remote_sync_service_->ProcessRemoteChange(
    191         CreateResultReceiver(&status, &url));
    192     FlushMessageLoop();
    193     return status;
    194   }
    195 
    196   SyncStatusCode ProcessChangesUntilDone() {
    197     remote_sync_service_->OnNotificationReceived();
    198     FlushMessageLoop();
    199 
    200     SyncStatusCode local_sync_status;
    201     SyncStatusCode remote_sync_status;
    202     do {
    203       local_sync_status = ProcessLocalChange();
    204       if (local_sync_status != SYNC_STATUS_OK &&
    205           local_sync_status != SYNC_STATUS_NO_CHANGE_TO_SYNC)
    206         return local_sync_status;
    207 
    208       remote_sync_status = ProcessRemoteChange();
    209       if (remote_sync_status != SYNC_STATUS_OK &&
    210           remote_sync_status != SYNC_STATUS_NO_CHANGE_TO_SYNC)
    211         return remote_sync_status;
    212     } while (local_sync_status != SYNC_STATUS_NO_CHANGE_TO_SYNC &&
    213              remote_sync_status != SYNC_STATUS_NO_CHANGE_TO_SYNC);
    214     return SYNC_STATUS_OK;
    215   }
    216 
    217   // Verifies local and remote files/folders are consistent.
    218   // This function checks:
    219   //  - Each registered origin has corresponding remote folder.
    220   //  - Each local file/folder has corresponding remote one.
    221   //  - Each remote file/folder has corresponding local one.
    222   // TODO(tzik): Handle conflict case. i.e. allow remote file has different
    223   // file content if the corresponding local file conflicts to it.
    224   void VerifyConsistency() {
    225     std::string sync_root_folder_id;
    226     GDataErrorCode error =
    227         fake_drive_helper_->GetSyncRootFolderID(&sync_root_folder_id);
    228     if (sync_root_folder_id.empty()) {
    229       EXPECT_EQ(google_apis::HTTP_NOT_FOUND, error);
    230       EXPECT_TRUE(file_systems_.empty());
    231       return;
    232     }
    233     EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
    234 
    235     ScopedVector<ResourceEntry> remote_entries;
    236     EXPECT_EQ(google_apis::HTTP_SUCCESS,
    237               fake_drive_helper_->ListFilesInFolder(
    238                   sync_root_folder_id, &remote_entries));
    239     std::map<std::string, const ResourceEntry*> origin_root_by_title;
    240     for (ScopedVector<ResourceEntry>::iterator itr = remote_entries.begin();
    241          itr != remote_entries.end();
    242          ++itr) {
    243       const ResourceEntry& remote_entry = **itr;
    244       EXPECT_FALSE(ContainsKey(origin_root_by_title, remote_entry.title()));
    245       origin_root_by_title[remote_entry.title()] = *itr;
    246     }
    247 
    248     for (std::map<GURL, CannedSyncableFileSystem*>::const_iterator itr =
    249              file_systems_.begin();
    250          itr != file_systems_.end(); ++itr) {
    251       const GURL& origin = itr->first;
    252       SCOPED_TRACE(testing::Message() << "Verifying origin: " << origin);
    253       CannedSyncableFileSystem* file_system = itr->second;
    254       ASSERT_TRUE(ContainsKey(origin_root_by_title, origin.host()));
    255       VerifyConsistencyForFolder(
    256           origin, base::FilePath(),
    257           origin_root_by_title[origin.host()]->resource_id(),
    258           file_system);
    259     }
    260   }
    261 
    262   void VerifyConsistencyForOrigin(const GURL& origin) {
    263     std::string sync_root_folder_id;
    264     ASSERT_EQ(google_apis::HTTP_SUCCESS,
    265               fake_drive_helper_->GetSyncRootFolderID(&sync_root_folder_id));
    266     ASSERT_FALSE(sync_root_folder_id.empty());
    267 
    268     ScopedVector<ResourceEntry> origin_folder;
    269     EXPECT_EQ(google_apis::HTTP_SUCCESS,
    270               fake_drive_helper_->SearchByTitle(
    271                   sync_root_folder_id, origin.host(), &origin_folder));
    272     ASSERT_EQ(1u, origin_folder.size());
    273 
    274     ASSERT_TRUE(ContainsKey(file_systems_, origin));
    275     VerifyConsistencyForFolder(
    276         origin, base::FilePath(),
    277         origin_folder[0]->resource_id(),
    278         file_systems_[origin]);
    279   }
    280 
    281   void VerifyConsistencyForFolder(const GURL& origin,
    282                                   const base::FilePath& path,
    283                                   const std::string& folder_id,
    284                                   CannedSyncableFileSystem* file_system) {
    285     SCOPED_TRACE(testing::Message() << "Verifying path: " << path.value());
    286 
    287     ScopedVector<ResourceEntry> remote_entries;
    288     EXPECT_EQ(google_apis::HTTP_SUCCESS,
    289               fake_drive_helper_->ListFilesInFolder(
    290                   folder_id, &remote_entries));
    291     std::map<std::string, const ResourceEntry*> remote_entry_by_title;
    292     for (ScopedVector<ResourceEntry>::iterator itr = remote_entries.begin();
    293          itr != remote_entries.end();
    294          ++itr) {
    295       const ResourceEntry& remote_entry = **itr;
    296       EXPECT_FALSE(ContainsKey(remote_entry_by_title, remote_entry.title()));
    297       remote_entry_by_title[remote_entry.title()] = *itr;
    298     }
    299 
    300     fileapi::FileSystemURL url(CreateSyncableFileSystemURL(origin, path));
    301     CannedSyncableFileSystem::FileEntryList local_entries;
    302     EXPECT_EQ(base::PLATFORM_FILE_OK,
    303               file_system->ReadDirectory(url, &local_entries));
    304     for (CannedSyncableFileSystem::FileEntryList::iterator itr =
    305              local_entries.begin();
    306          itr != local_entries.end();
    307          ++itr) {
    308       const fileapi::DirectoryEntry& local_entry = *itr;
    309       fileapi::FileSystemURL entry_url(
    310           CreateSyncableFileSystemURL(origin, path.Append(local_entry.name)));
    311       std::string title = DriveFileSyncService::PathToTitle(entry_url.path());
    312       ASSERT_TRUE(ContainsKey(remote_entry_by_title, title));
    313       const ResourceEntry& remote_entry = *remote_entry_by_title[title];
    314       if (local_entry.is_directory) {
    315         ASSERT_TRUE(remote_entry.is_folder());
    316         VerifyConsistencyForFolder(origin, entry_url.path(),
    317                                    remote_entry.resource_id(),
    318                                    file_system);
    319       } else {
    320         ASSERT_TRUE(remote_entry.is_file());
    321         VerifyConsistencyForFile(origin, entry_url.path(),
    322                                  remote_entry.resource_id(),
    323                                  file_system);
    324       }
    325       remote_entry_by_title.erase(title);
    326     }
    327 
    328     EXPECT_TRUE(remote_entry_by_title.empty());
    329   }
    330 
    331   void VerifyConsistencyForFile(const GURL& origin,
    332                                 const base::FilePath& path,
    333                                 const std::string& file_id,
    334                                 CannedSyncableFileSystem* file_system) {
    335     fileapi::FileSystemURL url(CreateSyncableFileSystemURL(origin, path));
    336     std::string file_content;
    337     EXPECT_EQ(google_apis::HTTP_SUCCESS,
    338               fake_drive_helper_->ReadFile(file_id, &file_content));
    339     EXPECT_EQ(base::PLATFORM_FILE_OK,
    340               file_system->VerifyFile(url, file_content));
    341   }
    342 
    343   void FlushMessageLoop() {
    344     base::MessageLoop::current()->RunUntilIdle();
    345     BrowserThread::GetBlockingPool()->FlushForTesting();
    346     base::MessageLoop::current()->RunUntilIdle();
    347   }
    348 
    349   void TestInitialization();
    350   void TestLocalToRemoteBasic();
    351   void TestRemoteToLocalBasic();
    352   void TestLocalFileUpdate();
    353   void TestRemoteFileUpdate();
    354   void TestLocalFileDeletion();
    355   void TestRemoteFileDeletion();
    356 
    357   content::TestBrowserThreadBundle thread_bundle_;
    358 
    359   TestingProfile profile_;
    360 
    361   drive::FakeDriveService* fake_drive_service_;
    362   drive::DriveUploader* drive_uploader_;
    363   scoped_ptr<FakeDriveServiceHelper> fake_drive_helper_;
    364   std::map<GURL, CannedSyncableFileSystem*> file_systems_;
    365 
    366   scoped_ptr<DriveFileSyncService> remote_sync_service_;
    367   scoped_ptr<LocalFileSyncService> local_sync_service_;
    368 
    369  private:
    370   DISALLOW_COPY_AND_ASSIGN(DriveFileSyncServiceSyncTest);
    371 };
    372 
    373 void DriveFileSyncServiceSyncTest::TestInitialization() {
    374   EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
    375   VerifyConsistency();
    376 }
    377 
    378 void DriveFileSyncServiceSyncTest::TestLocalToRemoteBasic() {
    379   const GURL kOrigin("chrome-extension://example");
    380 
    381   RegisterOrigin(kOrigin);
    382   AddOrUpdateLocalFile(kOrigin, base::FilePath(FPL("file")), "abcde");
    383 
    384   EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
    385   VerifyConsistency();
    386 }
    387 
    388 void DriveFileSyncServiceSyncTest::TestRemoteToLocalBasic() {
    389   const GURL kOrigin("chrome-extension://example");
    390 
    391   std::string sync_root_folder_id;
    392   EXPECT_EQ(google_apis::HTTP_CREATED,
    393             fake_drive_helper_->AddOrphanedFolder(
    394                 APIUtil::GetSyncRootDirectoryName(),
    395                 &sync_root_folder_id));
    396 
    397   std::string origin_root_folder_id;
    398   EXPECT_EQ(google_apis::HTTP_CREATED,
    399             fake_drive_helper_->AddFolder(
    400                 sync_root_folder_id, kOrigin.host(), &origin_root_folder_id));
    401 
    402   RegisterOrigin(kOrigin);
    403 
    404   std::string file_id;
    405   EXPECT_EQ(google_apis::HTTP_SUCCESS,
    406             fake_drive_helper_->AddFile(
    407                 origin_root_folder_id, "file", "abcde", &file_id));
    408 
    409   EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
    410   VerifyConsistency();
    411 }
    412 
    413 void DriveFileSyncServiceSyncTest::TestLocalFileUpdate() {
    414   const GURL kOrigin("chrome-extension://example");
    415   const base::FilePath kPath(FPL("file"));
    416 
    417   RegisterOrigin(kOrigin);
    418   AddOrUpdateLocalFile(kOrigin, kPath, "abcde");
    419 
    420   EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
    421   VerifyConsistencyForOrigin(kOrigin);
    422 
    423   UpdateLocalFile(kOrigin, kPath, "1234567890");
    424 
    425   EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
    426   VerifyConsistency();
    427 }
    428 
    429 void DriveFileSyncServiceSyncTest::TestRemoteFileUpdate() {
    430   const GURL kOrigin("chrome-extension://example");
    431   const base::FilePath kPath(FPL("file"));
    432   const std::string kTitle(DriveFileSyncService::PathToTitle(kPath));
    433 
    434   std::string sync_root_folder_id;
    435   EXPECT_EQ(google_apis::HTTP_CREATED,
    436             fake_drive_helper_->AddOrphanedFolder(
    437                 APIUtil::GetSyncRootDirectoryName(),
    438                 &sync_root_folder_id));
    439 
    440   std::string origin_root_folder_id;
    441   EXPECT_EQ(google_apis::HTTP_CREATED,
    442             fake_drive_helper_->AddFolder(
    443                 sync_root_folder_id, kOrigin.host(), &origin_root_folder_id));
    444 
    445   std::string remote_file_id;
    446   EXPECT_EQ(google_apis::HTTP_SUCCESS,
    447             fake_drive_helper_->AddFile(
    448                 origin_root_folder_id, kTitle, "abcde", &remote_file_id));
    449 
    450   RegisterOrigin(kOrigin);
    451   EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
    452   VerifyConsistencyForOrigin(kOrigin);
    453 
    454   EXPECT_EQ(google_apis::HTTP_SUCCESS,
    455             fake_drive_helper_->UpdateFile(remote_file_id, "1234567890"));
    456 
    457   EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
    458   VerifyConsistency();
    459 }
    460 
    461 void DriveFileSyncServiceSyncTest::TestLocalFileDeletion() {
    462   const GURL kOrigin("chrome-extension://example");
    463   const base::FilePath kPath(FPL("file"));
    464 
    465   RegisterOrigin(kOrigin);
    466   AddOrUpdateLocalFile(kOrigin, kPath, "abcde");
    467 
    468   EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
    469   VerifyConsistencyForOrigin(kOrigin);
    470 
    471   RemoveLocal(kOrigin, kPath);
    472 
    473   EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
    474   VerifyConsistency();
    475 }
    476 
    477 void DriveFileSyncServiceSyncTest::TestRemoteFileDeletion() {
    478   const GURL kOrigin("chrome-extension://example");
    479   const base::FilePath kPath(FPL("file"));
    480   const std::string kTitle(DriveFileSyncService::PathToTitle(kPath));
    481 
    482   std::string sync_root_folder_id;
    483   EXPECT_EQ(google_apis::HTTP_CREATED,
    484             fake_drive_helper_->AddOrphanedFolder(
    485                 APIUtil::GetSyncRootDirectoryName(),
    486                 &sync_root_folder_id));
    487 
    488   std::string origin_root_folder_id;
    489   EXPECT_EQ(google_apis::HTTP_CREATED,
    490             fake_drive_helper_->AddFolder(
    491                 sync_root_folder_id, kOrigin.host(), &origin_root_folder_id));
    492 
    493   std::string remote_file_id;
    494   EXPECT_EQ(google_apis::HTTP_SUCCESS,
    495             fake_drive_helper_->AddFile(
    496                 origin_root_folder_id, kTitle, "abcde", &remote_file_id));
    497 
    498   RegisterOrigin(kOrigin);
    499   EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
    500   VerifyConsistencyForOrigin(kOrigin);
    501 
    502   EXPECT_EQ(google_apis::HTTP_SUCCESS,
    503             fake_drive_helper_->TrashResource(remote_file_id));
    504 
    505   EXPECT_EQ(SYNC_STATUS_OK, ProcessChangesUntilDone());
    506   VerifyConsistency();
    507 }
    508 
    509 TEST_F(DriveFileSyncServiceSyncTest, InitializationTest) {
    510   ASSERT_FALSE(IsDriveAPIDisabled());
    511   TestInitialization();
    512 }
    513 
    514 TEST_F(DriveFileSyncServiceSyncTest, InitializationTest_WAPI) {
    515   ScopedDisableDriveAPI disable_drive_api;
    516   TestInitialization();
    517 }
    518 
    519 TEST_F(DriveFileSyncServiceSyncTest, LocalToRemoteBasicTest) {
    520   ASSERT_FALSE(IsDriveAPIDisabled());
    521   TestLocalToRemoteBasic();
    522 }
    523 
    524 TEST_F(DriveFileSyncServiceSyncTest, LocalToRemoteBasicTest_WAPI) {
    525   ScopedDisableDriveAPI disable_drive_api;
    526   TestLocalToRemoteBasic();
    527 }
    528 
    529 TEST_F(DriveFileSyncServiceSyncTest, RemoteToLocalBasicTest) {
    530   ASSERT_FALSE(IsDriveAPIDisabled());
    531   TestRemoteToLocalBasic();
    532 }
    533 
    534 TEST_F(DriveFileSyncServiceSyncTest, RemoteToLocalBasicTest_WAPI) {
    535   ScopedDisableDriveAPI disable_drive_api;
    536   TestRemoteToLocalBasic();
    537 }
    538 
    539 TEST_F(DriveFileSyncServiceSyncTest, LocalFileUpdateTest) {
    540   ASSERT_FALSE(IsDriveAPIDisabled());
    541   TestLocalFileUpdate();
    542 }
    543 
    544 TEST_F(DriveFileSyncServiceSyncTest, LocalFileUpdateTest_WAPI) {
    545   ScopedDisableDriveAPI disable_drive_api;
    546   TestLocalFileUpdate();
    547 }
    548 
    549 TEST_F(DriveFileSyncServiceSyncTest, RemoteFileUpdateTest) {
    550   ASSERT_FALSE(IsDriveAPIDisabled());
    551   TestRemoteFileUpdate();
    552 }
    553 
    554 TEST_F(DriveFileSyncServiceSyncTest, RemoteFileUpdateTest_WAPI) {
    555   ScopedDisableDriveAPI disable_drive_api;
    556   TestRemoteFileUpdate();
    557 }
    558 
    559 TEST_F(DriveFileSyncServiceSyncTest, LocalFileDeletionTest) {
    560   ASSERT_FALSE(IsDriveAPIDisabled());
    561   TestLocalFileDeletion();
    562 }
    563 
    564 TEST_F(DriveFileSyncServiceSyncTest, LocalFileDeletionTest_WAPI) {
    565   ScopedDisableDriveAPI disable_drive_api;
    566   TestLocalFileDeletion();
    567 }
    568 
    569 TEST_F(DriveFileSyncServiceSyncTest, RemoteFileDeletionTest) {
    570   ASSERT_FALSE(IsDriveAPIDisabled());
    571   TestRemoteFileDeletion();
    572 }
    573 
    574 TEST_F(DriveFileSyncServiceSyncTest, RemoteFileDeletionTest_WAPI) {
    575   ScopedDisableDriveAPI disable_drive_api;
    576   TestRemoteFileDeletion();
    577 }
    578 
    579 }  // namespace sync_file_system
    580