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

Side by Side Diff: chrome/browser/chromeos/file_manager/file_manager_browsertest_base.cc

Issue 2315443004: Remove calls to deprecated MessageLoop methods in chrome. (Closed)
Patch Set: remove unused include Created 4 years, 3 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/chromeos/file_manager/file_manager_browsertest_base.h" 5 #include "chrome/browser/chromeos/file_manager/file_manager_browsertest_base.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <deque> 9 #include <deque>
10 10
11 #include "base/json/json_reader.h" 11 #include "base/json/json_reader.h"
12 #include "base/json/json_value_converter.h" 12 #include "base/json/json_value_converter.h"
13 #include "base/json/json_writer.h" 13 #include "base/json/json_writer.h"
14 #include "base/path_service.h" 14 #include "base/path_service.h"
15 #include "base/run_loop.h"
15 #include "base/strings/string_piece.h" 16 #include "base/strings/string_piece.h"
16 #include "base/time/time.h" 17 #include "base/time/time.h"
17 #include "chrome/browser/browser_process.h" 18 #include "chrome/browser/browser_process.h"
18 #include "chrome/browser/chromeos/drive/file_system_util.h" 19 #include "chrome/browser/chromeos/drive/file_system_util.h"
19 #include "chrome/browser/chromeos/file_manager/mount_test_util.h" 20 #include "chrome/browser/chromeos/file_manager/mount_test_util.h"
20 #include "chrome/browser/chromeos/file_manager/path_util.h" 21 #include "chrome/browser/chromeos/file_manager/path_util.h"
21 #include "chrome/browser/chromeos/file_manager/volume_manager.h" 22 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
22 #include "chrome/browser/extensions/component_loader.h" 23 #include "chrome/browser/extensions/component_loader.h"
23 #include "chrome/browser/notifications/notification.h" 24 #include "chrome/browser/notifications/notification.h"
24 #include "chrome/browser/notifications/notification_ui_manager.h" 25 #include "chrome/browser/notifications/notification_ui_manager.h"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 404
404 // Creates an empty directory with the given |name| and |modification_time|. 405 // Creates an empty directory with the given |name| and |modification_time|.
405 void CreateDirectory(const std::string& parent_id, 406 void CreateDirectory(const std::string& parent_id,
406 const std::string& target_name, 407 const std::string& target_name,
407 const base::Time& modification_time) { 408 const base::Time& modification_time) {
408 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; 409 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
409 std::unique_ptr<google_apis::FileResource> entry; 410 std::unique_ptr<google_apis::FileResource> entry;
410 fake_drive_service_->AddNewDirectory( 411 fake_drive_service_->AddNewDirectory(
411 parent_id, target_name, drive::AddNewDirectoryOptions(), 412 parent_id, target_name, drive::AddNewDirectoryOptions(),
412 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); 413 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
413 base::MessageLoop::current()->RunUntilIdle(); 414 base::RunLoop().RunUntilIdle();
414 ASSERT_EQ(google_apis::HTTP_CREATED, error); 415 ASSERT_EQ(google_apis::HTTP_CREATED, error);
415 ASSERT_TRUE(entry); 416 ASSERT_TRUE(entry);
416 417
417 fake_drive_service_->SetLastModifiedTime( 418 fake_drive_service_->SetLastModifiedTime(
418 entry->file_id(), modification_time, 419 entry->file_id(), modification_time,
419 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); 420 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
420 base::MessageLoop::current()->RunUntilIdle(); 421 base::RunLoop().RunUntilIdle();
421 ASSERT_TRUE(error == google_apis::HTTP_SUCCESS); 422 ASSERT_TRUE(error == google_apis::HTTP_SUCCESS);
422 ASSERT_TRUE(entry); 423 ASSERT_TRUE(entry);
423 CheckForUpdates(); 424 CheckForUpdates();
424 } 425 }
425 426
426 // Creates a test file with the given spec. 427 // Creates a test file with the given spec.
427 // Serves |test_file_name| file. Pass an empty string for an empty file. 428 // Serves |test_file_name| file. Pass an empty string for an empty file.
428 void CreateFile(const std::string& source_file_name, 429 void CreateFile(const std::string& source_file_name,
429 const std::string& parent_id, 430 const std::string& parent_id,
430 const std::string& target_name, 431 const std::string& target_name,
431 const std::string& mime_type, 432 const std::string& mime_type,
432 bool shared_with_me, 433 bool shared_with_me,
433 const base::Time& modification_time) { 434 const base::Time& modification_time) {
434 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR; 435 google_apis::DriveApiErrorCode error = google_apis::DRIVE_OTHER_ERROR;
435 436
436 std::string content_data; 437 std::string content_data;
437 if (!source_file_name.empty()) { 438 if (!source_file_name.empty()) {
438 base::FilePath source_file_path = GetTestFilePath(source_file_name); 439 base::FilePath source_file_path = GetTestFilePath(source_file_name);
439 ASSERT_TRUE(base::ReadFileToString(source_file_path, &content_data)); 440 ASSERT_TRUE(base::ReadFileToString(source_file_path, &content_data));
440 } 441 }
441 442
442 std::unique_ptr<google_apis::FileResource> entry; 443 std::unique_ptr<google_apis::FileResource> entry;
443 fake_drive_service_->AddNewFile( 444 fake_drive_service_->AddNewFile(
444 mime_type, content_data, parent_id, target_name, shared_with_me, 445 mime_type, content_data, parent_id, target_name, shared_with_me,
445 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); 446 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
446 base::MessageLoop::current()->RunUntilIdle(); 447 base::RunLoop().RunUntilIdle();
447 ASSERT_EQ(google_apis::HTTP_CREATED, error); 448 ASSERT_EQ(google_apis::HTTP_CREATED, error);
448 ASSERT_TRUE(entry); 449 ASSERT_TRUE(entry);
449 450
450 fake_drive_service_->SetLastModifiedTime( 451 fake_drive_service_->SetLastModifiedTime(
451 entry->file_id(), modification_time, 452 entry->file_id(), modification_time,
452 google_apis::test_util::CreateCopyResultCallback(&error, &entry)); 453 google_apis::test_util::CreateCopyResultCallback(&error, &entry));
453 base::MessageLoop::current()->RunUntilIdle(); 454 base::RunLoop().RunUntilIdle();
454 ASSERT_EQ(google_apis::HTTP_SUCCESS, error); 455 ASSERT_EQ(google_apis::HTTP_SUCCESS, error);
455 ASSERT_TRUE(entry); 456 ASSERT_TRUE(entry);
456 457
457 CheckForUpdates(); 458 CheckForUpdates();
458 } 459 }
459 460
460 // Notifies FileSystem that the contents in FakeDriveService are 461 // Notifies FileSystem that the contents in FakeDriveService are
461 // changed, hence the new contents should be fetched. 462 // changed, hence the new contents should be fetched.
462 void CheckForUpdates() { 463 void CheckForUpdates() {
463 if (integration_service_ && integration_service_->file_system()) { 464 if (integration_service_ && integration_service_->file_system()) {
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
730 } 731 }
731 732
732 drive::DriveIntegrationService* 733 drive::DriveIntegrationService*
733 FileManagerBrowserTestBase::CreateDriveIntegrationService(Profile* profile) { 734 FileManagerBrowserTestBase::CreateDriveIntegrationService(Profile* profile) {
734 drive_volumes_[profile->GetOriginalProfile()].reset(new DriveTestVolume()); 735 drive_volumes_[profile->GetOriginalProfile()].reset(new DriveTestVolume());
735 return drive_volumes_[profile->GetOriginalProfile()] 736 return drive_volumes_[profile->GetOriginalProfile()]
736 ->CreateDriveIntegrationService(profile); 737 ->CreateDriveIntegrationService(profile);
737 } 738 }
738 739
739 } // namespace file_manager 740 } // namespace file_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698