Chromium Code Reviews| Index: chrome/browser/extensions/extension_file_browser_private_apitest.cc |
| diff --git a/chrome/browser/extensions/extension_file_browser_private_apitest.cc b/chrome/browser/extensions/extension_file_browser_private_apitest.cc |
| index b5568c62c53e839a7f876de5fc0111efc7ab811d..8585ad902f3a9b7983a53a28d69779791e6543f5 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 "chrome/browser/chromeos/dbus/mock_cros_disks_client.h" |
| +#include "chrome/browser/chromeos/dbus/mock_dbus_thread_manager.h" |
| #include "chrome/browser/extensions/extension_apitest.h" |
| #include "chrome/browser/profiles/profile.h" |
| #include "chrome/browser/ui/browser.h" |
| @@ -20,18 +20,18 @@ 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. |
| + chromeos::MockDBusThreadManager* mock_dbus_thread_manager = |
| + new chromeos::MockDBusThreadManager; |
| + chromeos::DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager); |
| + cros_disks_client_mock_ = |
| + mock_dbus_thread_manager->mock_cros_disks_client(); |
| + cros_disks_client_mock_->SetupDefaultReplies(); |
| CreateVolumeMap(); |
| } |
| virtual ~ExtensionFileBrowserPrivateApiTest() { |
| DeleteVolumeMap(); |
| - chromeos::CrosLibrary::Get()->GetTestApi()->SetMountLibrary(NULL, true); |
| } |
| void AddTmpMountPoint() { |
| @@ -46,63 +46,63 @@ 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::CrosDisksClient::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::CrosDisksClient::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))); |
| volumes_.insert( |
| - std::pair<std::string, chromeos::MountLibrary::Disk*>( |
| + std::pair<std::string, chromeos::CrosDisksClient::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::CrosDisksClient::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))); |
|
satorux1
2011/11/07 23:21:55
Gee. Five boolean parameters are super cryptic...
hashimoto
2011/11/08 07:31:05
I agree, they are too ugly…
|
| volumes_.insert( |
| - std::pair<std::string, chromeos::MountLibrary::Disk*>( |
| + std::pair<std::string, chromeos::CrosDisksClient::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))); |
| + new chromeos::CrosDisksClient::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(); |
| + for (chromeos::CrosDisksClient::DiskMap::iterator it = volumes_.begin(); |
| it != volumes_.end(); |
| ++it) { |
| delete it->second; |
| @@ -111,8 +111,8 @@ class ExtensionFileBrowserPrivateApiTest : public ExtensionApiTest { |
| } |
| protected: |
| - chromeos::MockMountLibrary mount_library_mock_; |
| - chromeos::MountLibrary::DiskMap volumes_; |
| + chromeos::MockCrosDisksClient* cros_disks_client_mock_; |
| + chromeos::CrosDisksClient::DiskMap volumes_; |
| private: |
| FilePath test_mount_point_; |
| @@ -122,14 +122,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(*cros_disks_client_mock_, UnmountPath(_)) |
| .Times(0); |
| - EXPECT_CALL(mount_library_mock_, UnmountPath(StrEq("/tmp/test_file.zip"))) |
| - .Times(1); |
| + EXPECT_CALL(*cros_disks_client_mock_, |
| + UnmountPath(StrEq("/tmp/test_file.zip"))).Times(1); |
| - EXPECT_CALL(mount_library_mock_, disks()) |
| + EXPECT_CALL(*cros_disks_client_mock_, disks()) |
| .WillRepeatedly(ReturnRef(volumes_)); |
| ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_; |
| } |
| - |