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

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

Issue 2201023002: Change access mode of disk devices when mounting based on config. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Register default value for the new preference. Created 4 years, 4 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 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/chromeos/file_manager/volume_manager.h" 5 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 506 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 volume_manager()->RemoveObserver(&observer); 517 volume_manager()->RemoveObserver(&observer);
518 } 518 }
519 519
520 TEST_F(VolumeManagerTest, OnMountEvent_Remounting) { 520 TEST_F(VolumeManagerTest, OnMountEvent_Remounting) {
521 std::unique_ptr<chromeos::disks::DiskMountManager::Disk> disk( 521 std::unique_ptr<chromeos::disks::DiskMountManager::Disk> disk(
522 new chromeos::disks::DiskMountManager::Disk( 522 new chromeos::disks::DiskMountManager::Disk(
523 "device1", "", "", "", "", "", "", "", "", "", "uuid1", "", 523 "device1", "", "", "", "", "", "", "", "", "", "uuid1", "",
524 chromeos::DEVICE_TYPE_UNKNOWN, 0, false, false, false, false, false, 524 chromeos::DEVICE_TYPE_UNKNOWN, 0, false, false, false, false, false,
525 false)); 525 false));
526 disk_mount_manager_->AddDiskForTest(disk.release()); 526 disk_mount_manager_->AddDiskForTest(disk.release());
527 disk_mount_manager_->MountPath( 527 disk_mount_manager_->MountPath("device1", "", "", chromeos::MOUNT_TYPE_DEVICE,
528 "device1", "", "", chromeos::MOUNT_TYPE_DEVICE); 528 chromeos::MOUNT_ACCESS_MODE_READ_WRITE);
529 529
530 const chromeos::disks::DiskMountManager::MountPointInfo kMountPoint( 530 const chromeos::disks::DiskMountManager::MountPointInfo kMountPoint(
531 "device1", 531 "device1",
532 "mount1", 532 "mount1",
533 chromeos::MOUNT_TYPE_DEVICE, 533 chromeos::MOUNT_TYPE_DEVICE,
534 chromeos::disks::MOUNT_CONDITION_NONE); 534 chromeos::disks::MOUNT_CONDITION_NONE);
535 535
536 volume_manager()->OnMountEvent( 536 volume_manager()->OnMountEvent(
537 chromeos::disks::DiskMountManager::MOUNTING, 537 chromeos::disks::DiskMountManager::MOUNTING,
538 chromeos::MOUNT_ERROR_NONE, 538 chromeos::MOUNT_ERROR_NONE,
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 const LoggingObserver::Event& event = observer.events()[0]; 665 const LoggingObserver::Event& event = observer.events()[0];
666 EXPECT_EQ(LoggingObserver::Event::FORMAT_COMPLETED, event.type); 666 EXPECT_EQ(LoggingObserver::Event::FORMAT_COMPLETED, event.type);
667 EXPECT_EQ("device1", event.device_path); 667 EXPECT_EQ("device1", event.device_path);
668 EXPECT_FALSE(event.success); 668 EXPECT_FALSE(event.success);
669 669
670 EXPECT_EQ(0U, disk_mount_manager_->mount_requests().size()); 670 EXPECT_EQ(0U, disk_mount_manager_->mount_requests().size());
671 671
672 volume_manager()->RemoveObserver(&observer); 672 volume_manager()->RemoveObserver(&observer);
673 } 673 }
674 674
675 TEST_F(VolumeManagerTest, OnExternalStorageDisabledChanged) { 675 TEST_F(VolumeManagerTest, OnExternalStorageDisabledChanged) {
hashimoto 2016/08/05 06:24:28 Are we going to have a test which ensures that the
yamaguchi 2016/08/05 07:05:12 Done.
676 // Here create two mount points. 676 // Here create two mount points.
677 disk_mount_manager_->MountPath( 677 disk_mount_manager_->MountPath("mount1", "", "", chromeos::MOUNT_TYPE_DEVICE,
678 "mount1", "", "", chromeos::MOUNT_TYPE_DEVICE); 678 chromeos::MOUNT_ACCESS_MODE_READ_WRITE);
679 disk_mount_manager_->MountPath( 679 disk_mount_manager_->MountPath("mount2", "", "", chromeos::MOUNT_TYPE_DEVICE,
680 "mount2", "", "", chromeos::MOUNT_TYPE_DEVICE); 680 chromeos::MOUNT_ACCESS_MODE_READ_ONLY);
681 681
682 // Initially, there are two mount points. 682 // Initially, there are two mount points.
683 ASSERT_EQ(2U, disk_mount_manager_->mount_points().size()); 683 ASSERT_EQ(2U, disk_mount_manager_->mount_points().size());
684 ASSERT_EQ(0U, disk_mount_manager_->unmount_requests().size()); 684 ASSERT_EQ(0U, disk_mount_manager_->unmount_requests().size());
685 685
686 // Emulate to set kExternalStorageDisabled to false. 686 // Emulate to set kExternalStorageDisabled to false.
687 profile()->GetPrefs()->SetBoolean(prefs::kExternalStorageDisabled, false); 687 profile()->GetPrefs()->SetBoolean(prefs::kExternalStorageDisabled, false);
688 volume_manager()->OnExternalStorageDisabledChanged(); 688 volume_manager()->OnExternalStorageDisabledChanged();
689 689
690 // Expect no effects. 690 // Expect no effects.
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
873 // Detach 873 // Detach
874 volume_manager()->OnRemovableStorageDetached(info); 874 volume_manager()->OnRemovableStorageDetached(info);
875 ASSERT_EQ(2u, observer.events().size()); 875 ASSERT_EQ(2u, observer.events().size());
876 EXPECT_EQ(LoggingObserver::Event::VOLUME_UNMOUNTED, 876 EXPECT_EQ(LoggingObserver::Event::VOLUME_UNMOUNTED,
877 observer.events()[1].type); 877 observer.events()[1].type);
878 878
879 EXPECT_FALSE(volume.get()); 879 EXPECT_FALSE(volume.get());
880 } 880 }
881 881
882 } // namespace file_manager 882 } // namespace file_manager
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/file_manager/volume_manager.cc ('k') | chrome/browser/chromeos/login/kiosk_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698