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

Side by Side Diff: chrome/browser/sync_file_system/drive_backend_v1/api_util_unittest.cc

Issue 221773002: drive: Deprecate FakeDriveService::LoadAccountMetadataForWapi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/drive/fake_drive_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 2013 The Chromium Authors. All rights reserved. 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 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_backend_v1/api_util.h" 5 #include "chrome/browser/sync_file_system/drive_backend_v1/api_util.h"
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/message_loop/message_loop_proxy.h"
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 api_util()->ContinueListing( 388 api_util()->ContinueListing(
389 feed_url, 389 feed_url,
390 base::Bind(&DidGetResourceList, &error, &document_feed)); 390 base::Bind(&DidGetResourceList, &error, &document_feed));
391 base::MessageLoop::current()->RunUntilIdle(); 391 base::MessageLoop::current()->RunUntilIdle();
392 392
393 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 393 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
394 EXPECT_EQ(2U, document_feed->entries().size()); 394 EXPECT_EQ(2U, document_feed->entries().size());
395 } 395 }
396 396
397 void APIUtilTest::TestListChanges() { 397 void APIUtilTest::TestListChanges() {
398 const int64 kStartChangestamp = 6; 398 const int64 old_changestamp =
399 fake_drive_service()->about_resource().largest_change_id();
399 const std::string sync_root_id = SetUpSyncRootDirectory(); 400 const std::string sync_root_id = SetUpSyncRootDirectory();
400 const std::string origin_root_id = SetUpOriginRootDirectory(sync_root_id); 401 const std::string origin_root_id = SetUpOriginRootDirectory(sync_root_id);
401 402
402 // Files should have changestamp #4+ since creating the sync root directory is 403 // Files should have changestamp #4+ since creating the sync root directory is
403 // #1, moving it out of 'My Drive' is #2, and creating the origin root 404 // #1, moving it out of 'My Drive' is #2, and creating the origin root
404 // directory is #3. 405 // directory is #3.
405 const int kNumberOfFiles = 5; 406 const int kNumberOfFiles = 5;
406 for (int i = 0; i < kNumberOfFiles; ++i) { 407 for (int i = 0; i < kNumberOfFiles; ++i) {
407 scoped_ptr<ResourceEntry> file; 408 scoped_ptr<ResourceEntry> file;
408 std::string file_content = base::StringPrintf("test content %d", i); 409 std::string file_content = base::StringPrintf("test content %d", i);
409 std::string file_title = base::StringPrintf("test_%d.txt", i); 410 std::string file_title = base::StringPrintf("test_%d.txt", i);
410 SetUpFile(origin_root_id, file_content, file_title, &file); 411 SetUpFile(origin_root_id, file_content, file_title, &file);
411 } 412 }
412 413
413 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR; 414 GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
414 scoped_ptr<ResourceList> document_feed; 415 scoped_ptr<ResourceList> document_feed;
415 api_util()->ListFiles( 416 api_util()->ListFiles(
416 origin_root_id, 417 origin_root_id,
417 base::Bind(&DidGetResourceList, &error, &document_feed)); 418 base::Bind(&DidGetResourceList, &error, &document_feed));
418 base::MessageLoop::current()->RunUntilIdle(); 419 base::MessageLoop::current()->RunUntilIdle();
419 420
420 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 421 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
421 EXPECT_EQ(5U, document_feed->entries().size()); 422 EXPECT_EQ(5U, document_feed->entries().size());
422 423
423 error = google_apis::GDATA_OTHER_ERROR; 424 error = google_apis::GDATA_OTHER_ERROR;
424 document_feed.reset(); 425 document_feed.reset();
425 api_util()->ListChanges( 426 api_util()->ListChanges(
426 kStartChangestamp, 427 old_changestamp + 6,
427 base::Bind(&DidGetResourceList, &error, &document_feed)); 428 base::Bind(&DidGetResourceList, &error, &document_feed));
428 base::MessageLoop::current()->RunUntilIdle(); 429 base::MessageLoop::current()->RunUntilIdle();
429 430
430 // There should be 3 files which have changestamp #6+. 431 // There should be 3 files which have changestamp #6+.
431 EXPECT_EQ(google_apis::HTTP_SUCCESS, error); 432 EXPECT_EQ(google_apis::HTTP_SUCCESS, error);
432 EXPECT_EQ(3U, document_feed->entries().size()); 433 EXPECT_EQ(3U, document_feed->entries().size());
433 } 434 }
434 435
435 void APIUtilTest::TestDownloadFile() { 436 void APIUtilTest::TestDownloadFile() {
436 const std::string kFileContent = "test content"; 437 const std::string kFileContent = "test content";
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
827 TestCreateDirectory(); 828 TestCreateDirectory();
828 } 829 }
829 830
830 TEST_F(APIUtilTest, CreateDirectory_WAPI) { 831 TEST_F(APIUtilTest, CreateDirectory_WAPI) {
831 ScopedDisableDriveAPI disable_drive_api; 832 ScopedDisableDriveAPI disable_drive_api;
832 TestCreateDirectory(); 833 TestCreateDirectory();
833 } 834 }
834 835
835 } // namespace drive_backend 836 } // namespace drive_backend
836 } // namespace sync_file_system 837 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/drive/fake_drive_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698