OLD | NEW |
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 "components/drive/job_scheduler.h" | 5 #include "components/drive/job_scheduler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <set> | 10 #include <set> |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 ASSERT_TRUE(file_list); | 255 ASSERT_TRUE(file_list); |
256 } | 256 } |
257 | 257 |
258 TEST_F(JobSchedulerTest, GetFileListInDirectory) { | 258 TEST_F(JobSchedulerTest, GetFileListInDirectory) { |
259 ConnectToWifi(); | 259 ConnectToWifi(); |
260 | 260 |
261 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; | 261 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; |
262 std::unique_ptr<google_apis::FileList> file_list; | 262 std::unique_ptr<google_apis::FileList> file_list; |
263 | 263 |
264 scheduler_->GetFileListInDirectory( | 264 scheduler_->GetFileListInDirectory( |
265 fake_drive_service_->GetRootResourceId(), | 265 fake_drive_service_->GetRootResourceId(), "" /* team_drive_id */, |
266 google_apis::test_util::CreateCopyResultCallback(&error, &file_list)); | 266 google_apis::test_util::CreateCopyResultCallback(&error, &file_list)); |
267 base::RunLoop().RunUntilIdle(); | 267 base::RunLoop().RunUntilIdle(); |
268 | 268 |
269 ASSERT_EQ(google_apis::HTTP_SUCCESS, error); | 269 ASSERT_EQ(google_apis::HTTP_SUCCESS, error); |
270 ASSERT_TRUE(file_list); | 270 ASSERT_TRUE(file_list); |
271 } | 271 } |
272 | 272 |
273 TEST_F(JobSchedulerTest, Search) { | 273 TEST_F(JobSchedulerTest, Search) { |
274 ConnectToWifi(); | 274 ConnectToWifi(); |
275 | 275 |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 } | 379 } |
380 | 380 |
381 TEST_F(JobSchedulerTest, GetRemainingFileList) { | 381 TEST_F(JobSchedulerTest, GetRemainingFileList) { |
382 ConnectToWifi(); | 382 ConnectToWifi(); |
383 fake_drive_service_->set_default_max_results(2); | 383 fake_drive_service_->set_default_max_results(2); |
384 | 384 |
385 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; | 385 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; |
386 std::unique_ptr<google_apis::FileList> file_list; | 386 std::unique_ptr<google_apis::FileList> file_list; |
387 | 387 |
388 scheduler_->GetFileListInDirectory( | 388 scheduler_->GetFileListInDirectory( |
389 fake_drive_service_->GetRootResourceId(), | 389 fake_drive_service_->GetRootResourceId(), "" /* team_drive_id */, |
390 google_apis::test_util::CreateCopyResultCallback(&error, &file_list)); | 390 google_apis::test_util::CreateCopyResultCallback(&error, &file_list)); |
391 base::RunLoop().RunUntilIdle(); | 391 base::RunLoop().RunUntilIdle(); |
392 | 392 |
393 ASSERT_EQ(google_apis::HTTP_SUCCESS, error); | 393 ASSERT_EQ(google_apis::HTTP_SUCCESS, error); |
394 ASSERT_TRUE(file_list); | 394 ASSERT_TRUE(file_list); |
395 | 395 |
396 // Keep the next url before releasing the |file_list|. | 396 // Keep the next url before releasing the |file_list|. |
397 GURL next_url(file_list->next_link()); | 397 GURL next_url(file_list->next_link()); |
398 | 398 |
399 error = google_apis::DRIVE_OTHER_ERROR; | 399 error = google_apis::DRIVE_OTHER_ERROR; |
(...skipping 680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 scheduler_->CancelJob(first_job_id); | 1080 scheduler_->CancelJob(first_job_id); |
1081 | 1081 |
1082 // Only the first job should be cancelled. | 1082 // Only the first job should be cancelled. |
1083 base::RunLoop().RunUntilIdle(); | 1083 base::RunLoop().RunUntilIdle(); |
1084 EXPECT_EQ(google_apis::DRIVE_CANCELLED, error1); | 1084 EXPECT_EQ(google_apis::DRIVE_CANCELLED, error1); |
1085 EXPECT_EQ(google_apis::HTTP_SUCCESS, error2); | 1085 EXPECT_EQ(google_apis::HTTP_SUCCESS, error2); |
1086 EXPECT_TRUE(scheduler_->GetJobInfoList().empty()); | 1086 EXPECT_TRUE(scheduler_->GetJobInfoList().empty()); |
1087 } | 1087 } |
1088 | 1088 |
1089 } // namespace drive | 1089 } // namespace drive |
OLD | NEW |