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

Unified Diff: chrome/browser/chromeos/drive/drive_scheduler_unittest.cc

Issue 13450006: Support new methods to replace GetResourceList on DriveScheduler. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/chromeos/drive/drive_scheduler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/drive/drive_scheduler_unittest.cc
diff --git a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc
index 7cb99dd81946bdcecf843b77567bdefecc36825d..f3a937b82b43c8aeca9bed695aa8f75d664e8980 100644
--- a/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc
+++ b/chrome/browser/chromeos/drive/drive_scheduler_unittest.cc
@@ -162,7 +162,6 @@ TEST_F(DriveSchedulerTest, GetAccountMetadata) {
ASSERT_TRUE(account_metadata);
}
-
TEST_F(DriveSchedulerTest, GetResourceList) {
ConnectToWifi();
@@ -182,6 +181,118 @@ TEST_F(DriveSchedulerTest, GetResourceList) {
ASSERT_TRUE(resource_list);
}
+TEST_F(DriveSchedulerTest, GetAllResourceList) {
+ ConnectToWifi();
+
+ google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ scoped_ptr<google_apis::ResourceList> resource_list;
+
+ scheduler_->GetAllResourceList(
+ google_apis::test_util::CreateCopyResultCallback(
+ &error, &resource_list));
+ google_apis::test_util::RunBlockingPoolTask();
+
+ ASSERT_EQ(google_apis::HTTP_SUCCESS, error);
+ ASSERT_TRUE(resource_list);
+}
+
+TEST_F(DriveSchedulerTest, GetResourceListInDirectory) {
+ ConnectToWifi();
+
+ google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ scoped_ptr<google_apis::ResourceList> resource_list;
+
+ scheduler_->GetResourceListInDirectory(
+ fake_drive_service_->GetRootResourceId(),
+ google_apis::test_util::CreateCopyResultCallback(
+ &error, &resource_list));
+ google_apis::test_util::RunBlockingPoolTask();
+
+ ASSERT_EQ(google_apis::HTTP_SUCCESS, error);
+ ASSERT_TRUE(resource_list);
+}
+
+TEST_F(DriveSchedulerTest, Search) {
+ ConnectToWifi();
+
+ google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ scoped_ptr<google_apis::ResourceList> resource_list;
+
+ scheduler_->Search(
+ "File", // search query
+ google_apis::test_util::CreateCopyResultCallback(
+ &error, &resource_list));
+ google_apis::test_util::RunBlockingPoolTask();
+
+ ASSERT_EQ(google_apis::HTTP_SUCCESS, error);
+ ASSERT_TRUE(resource_list);
+}
+
+TEST_F(DriveSchedulerTest, GetChangeList) {
+ ConnectToWifi();
+
+ google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+
+ // Create a new directory.
+ // The loaded (initial) changestamp is 654321. Thus, by this operation,
+ // it should become 654322.
+ {
+ scoped_ptr<google_apis::ResourceEntry> resource_entry;
+ fake_drive_service_->AddNewDirectory(
+ fake_drive_service_->GetRootResourceId(),
+ "new directory",
+ google_apis::test_util::CreateCopyResultCallback(
+ &error, &resource_entry));
+ google_apis::test_util::RunBlockingPoolTask();
+ ASSERT_EQ(google_apis::HTTP_CREATED, error);
+ }
+
+ error = google_apis::GDATA_OTHER_ERROR;
+ scoped_ptr<google_apis::ResourceList> resource_list;
+ scheduler_->GetChangeList(
+ 654321 + 1, // start_changestamp
+ google_apis::test_util::CreateCopyResultCallback(
+ &error, &resource_list));
+ google_apis::test_util::RunBlockingPoolTask();
+
+ ASSERT_EQ(google_apis::HTTP_SUCCESS, error);
+ ASSERT_TRUE(resource_list);
+}
+
+TEST_F(DriveSchedulerTest, ContinueGetResourceList) {
+ ConnectToWifi();
+ fake_drive_service_->set_default_max_results(2);
+
+ google_apis::GDataErrorCode error = google_apis::GDATA_OTHER_ERROR;
+ scoped_ptr<google_apis::ResourceList> resource_list;
+
+ scheduler_->GetAllResourceList(
+ google_apis::test_util::CreateCopyResultCallback(
+ &error, &resource_list));
+ google_apis::test_util::RunBlockingPoolTask();
+
+ ASSERT_EQ(google_apis::HTTP_SUCCESS, error);
+ ASSERT_TRUE(resource_list);
+
+ const google_apis::Link* next_link =
+ resource_list->GetLinkByType(google_apis::Link::LINK_NEXT);
+ ASSERT_TRUE(next_link);
+ // Keep the next url before releasing the |resource_list|.
+ GURL next_url(next_link->href());
+
+ error = google_apis::GDATA_OTHER_ERROR;
+ resource_list.reset();
+
+ scheduler_->ContinueGetResourceList(
+ next_url,
+ google_apis::test_util::CreateCopyResultCallback(
+ &error, &resource_list));
+ google_apis::test_util::RunBlockingPoolTask();
+
+ ASSERT_EQ(google_apis::HTTP_SUCCESS, error);
+ ASSERT_TRUE(resource_list);
+}
+
TEST_F(DriveSchedulerTest, GetResourceEntry) {
ConnectToWifi();
« no previous file with comments | « chrome/browser/chromeos/drive/drive_scheduler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698