| 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..51be8740d0601f74677f75a0e32a69c541d790c2 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_;
|
| }
|
| -
|
|
|