diff options
author | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-17 07:49:55 +0000 |
---|---|---|
committer | hashimoto@chromium.org <hashimoto@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-17 07:49:55 +0000 |
commit | b307bceb5f8f104022a5f306a35c2d2bd161641f (patch) | |
tree | 9e109f0235bf0565fe022ed1f3dbf4011bc4bd07 /chrome/browser/extensions/extension_file_browser_private_apitest.cc | |
parent | 8004a4cb0bf6959d5df10c0e4aac90e00e7d4dd7 (diff) | |
download | chromium_src-b307bceb5f8f104022a5f306a35c2d2bd161641f.zip chromium_src-b307bceb5f8f104022a5f306a35c2d2bd161641f.tar.gz chromium_src-b307bceb5f8f104022a5f306a35c2d2bd161641f.tar.bz2 |
Switch from MountLibrary to DiskMountManager and CrosDisksLibrary
This patch is 2nd part of 3 splitted patches made from http://codereview.chromium.org/8386031
BUG=chromium-os:16556
TEST=Confirm that removable disk is correctly mounted
Review URL: http://codereview.chromium.org/8497007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110469 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/extensions/extension_file_browser_private_apitest.cc')
-rw-r--r-- | chrome/browser/extensions/extension_file_browser_private_apitest.cc | 154 |
1 files changed, 79 insertions, 75 deletions
diff --git a/chrome/browser/extensions/extension_file_browser_private_apitest.cc b/chrome/browser/extensions/extension_file_browser_private_apitest.cc index b5568c6..51be874 100644 --- a/chrome/browser/extensions/extension_file_browser_private_apitest.cc +++ b/chrome/browser/extensions/extension_file_browser_private_apitest.cc @@ -4,8 +4,8 @@ #include <stdio.h> -#include "chrome/browser/chromeos/cros/cros_library.h" -#include "chrome/browser/chromeos/cros/mock_mount_library.h" +#include "base/stl_util.h" +#include "chrome/browser/chromeos/disks/mock_disk_mount_manager.h" #include "chrome/browser/extensions/extension_apitest.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/ui/browser.h" @@ -19,19 +19,33 @@ using ::testing::StrEq; class ExtensionFileBrowserPrivateApiTest : public ExtensionApiTest { public: - ExtensionFileBrowserPrivateApiTest() : test_mount_point_("/tmp") { - mount_library_mock_.SetupDefaultReplies(); - - chromeos::CrosLibrary::Get()->GetTestApi()->SetMountLibrary( - &mount_library_mock_, - false); // We own the mock library object. - + ExtensionFileBrowserPrivateApiTest() + : disk_mount_manager_mock_(NULL), + test_mount_point_("/tmp") { CreateVolumeMap(); } virtual ~ExtensionFileBrowserPrivateApiTest() { - DeleteVolumeMap(); - chromeos::CrosLibrary::Get()->GetTestApi()->SetMountLibrary(NULL, true); + DCHECK(!disk_mount_manager_mock_); + STLDeleteValues(&volumes_); + } + + // ExtensionApiTest override + virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { + ExtensionApiTest::SetUpInProcessBrowserTestFixture(); + + disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager; + chromeos::disks::DiskMountManager::InitializeForTesting( + disk_mount_manager_mock_); + disk_mount_manager_mock_->SetupDefaultReplies(); + } + + // ExtensionApiTest override + virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { + chromeos::disks::DiskMountManager::Shutdown(); + disk_mount_manager_mock_ = NULL; + + ExtensionApiTest::TearDownInProcessBrowserTestFixture(); } void AddTmpMountPoint() { @@ -46,73 +60,64 @@ class ExtensionFileBrowserPrivateApiTest : public ExtensionApiTest { void CreateVolumeMap() { // These have to be sync'd with values in filebrowser_mount extension. volumes_.insert( - std::pair<std::string, chromeos::MountLibrary::Disk*>( + std::pair<std::string, chromeos::disks::DiskMountManager::Disk*>( "device_path1", - new chromeos::MountLibrary::Disk("device_path1", - "/media/removable/mount_path1", - "system_path1", - "file_path1", - "device_label1", - "drive_label1", - "parent_path1", - "system_path_prefix1", - chromeos::FLASH, - 1073741824, - false, - false, - false, - false, - false))); + new chromeos::disks::DiskMountManager::Disk( + "device_path1", + "/media/removable/mount_path1", + "system_path1", + "file_path1", + "device_label1", + "drive_label1", + "system_path_prefix1", + chromeos::FLASH, + 1073741824, + false, + false, + false, + false, + false))); volumes_.insert( - std::pair<std::string, chromeos::MountLibrary::Disk*>( + std::pair<std::string, chromeos::disks::DiskMountManager::Disk*>( "device_path2", - new chromeos::MountLibrary::Disk("device_path2", - "/media/removable/mount_path2", - "system_path2", - "file_path2", - "device_label2", - "drive_label2", - "parent_path2", - "system_path_prefix2", - chromeos::HDD, - 47723, - true, - true, - true, - true, - false))); + new chromeos::disks::DiskMountManager::Disk( + "device_path2", + "/media/removable/mount_path2", + "system_path2", + "file_path2", + "device_label2", + "drive_label2", + "system_path_prefix2", + chromeos::HDD, + 47723, + true, + true, + true, + true, + false))); volumes_.insert( - std::pair<std::string, chromeos::MountLibrary::Disk*>( + std::pair<std::string, chromeos::disks::DiskMountManager::Disk*>( "device_path3", - new chromeos::MountLibrary::Disk("device_path3", - "/media/removable/mount_path3", - "system_path3", - "file_path3", - "device_label3", - "drive_label3", - "parent_path3", - "system_path_prefix3", - chromeos::OPTICAL, - 0, - true, - false, - false, - true, - false))); - } - - void DeleteVolumeMap() { - for (chromeos::MountLibrary::DiskMap::iterator it = volumes_.begin(); - it != volumes_.end(); - ++it) { - delete it->second; - } - volumes_.clear(); + new chromeos::disks::DiskMountManager::Disk( + "device_path3", + "/media/removable/mount_path3", + "system_path3", + "file_path3", + "device_label3", + "drive_label3", + "system_path_prefix3", + chromeos::OPTICAL, + 0, + true, + false, + false, + true, + false))); } protected: - chromeos::MockMountLibrary mount_library_mock_; - chromeos::MountLibrary::DiskMap volumes_; + chromeos::disks::MockDiskMountManager* disk_mount_manager_mock_; + chromeos::disks::DiskMountManager::DiskMap volumes_; private: FilePath test_mount_point_; @@ -122,14 +127,13 @@ IN_PROC_BROWSER_TEST_F(ExtensionFileBrowserPrivateApiTest, FileBrowserMount) { // We will call fileBrowserPrivate.unmountVolume once. To test that method, we // check that UnmountPath is really called with the same value. AddTmpMountPoint(); - EXPECT_CALL(mount_library_mock_, UnmountPath(_)) + EXPECT_CALL(*disk_mount_manager_mock_, UnmountPath(_)) .Times(0); - EXPECT_CALL(mount_library_mock_, UnmountPath(StrEq("/tmp/test_file.zip"))) - .Times(1); + EXPECT_CALL(*disk_mount_manager_mock_, + UnmountPath(StrEq("/tmp/test_file.zip"))).Times(1); - EXPECT_CALL(mount_library_mock_, disks()) + EXPECT_CALL(*disk_mount_manager_mock_, disks()) .WillRepeatedly(ReturnRef(volumes_)); ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_; } - |