| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <stdio.h> | 5 #include <stdio.h> |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "chrome/browser/chromeos/disks/mock_disk_mount_manager.h" | 8 #include "chrome/browser/chromeos/disks/mock_disk_mount_manager.h" |
| 9 #include "chrome/browser/extensions/extension_apitest.h" | 9 #include "chrome/browser/extensions/extension_apitest.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| 11 #include "chrome/browser/ui/browser.h" | 11 #include "chrome/browser/ui/browser.h" |
| 12 #include "webkit/fileapi/file_system_context.h" | 12 #include "webkit/fileapi/file_system_context.h" |
| 13 #include "webkit/fileapi/file_system_mount_point_provider.h" | 13 #include "webkit/fileapi/file_system_mount_point_provider.h" |
| 14 #include "webkit/fileapi/file_system_path_manager.h" | |
| 15 | 14 |
| 16 using ::testing::_; | 15 using ::testing::_; |
| 17 using ::testing::ReturnRef; | 16 using ::testing::ReturnRef; |
| 18 using ::testing::StrEq; | 17 using ::testing::StrEq; |
| 19 | 18 |
| 20 class ExtensionFileBrowserPrivateApiTest : public ExtensionApiTest { | 19 class ExtensionFileBrowserPrivateApiTest : public ExtensionApiTest { |
| 21 public: | 20 public: |
| 22 ExtensionFileBrowserPrivateApiTest() | 21 ExtensionFileBrowserPrivateApiTest() |
| 23 : disk_mount_manager_mock_(NULL), | 22 : disk_mount_manager_mock_(NULL), |
| 24 test_mount_point_("/tmp") { | 23 test_mount_point_("/tmp") { |
| (...skipping 17 matching lines...) Expand all Loading... |
| 42 | 41 |
| 43 // ExtensionApiTest override | 42 // ExtensionApiTest override |
| 44 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { | 43 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { |
| 45 chromeos::disks::DiskMountManager::Shutdown(); | 44 chromeos::disks::DiskMountManager::Shutdown(); |
| 46 disk_mount_manager_mock_ = NULL; | 45 disk_mount_manager_mock_ = NULL; |
| 47 | 46 |
| 48 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); | 47 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); |
| 49 } | 48 } |
| 50 | 49 |
| 51 void AddTmpMountPoint() { | 50 void AddTmpMountPoint() { |
| 52 fileapi::FileSystemPathManager* path_manager = | |
| 53 browser()->profile()->GetFileSystemContext()->path_manager(); | |
| 54 fileapi::ExternalFileSystemMountPointProvider* provider = | 51 fileapi::ExternalFileSystemMountPointProvider* provider = |
| 55 path_manager->external_provider(); | 52 browser()->profile()->GetFileSystemContext()->external_provider(); |
| 56 provider->AddMountPoint(test_mount_point_); | 53 provider->AddMountPoint(test_mount_point_); |
| 57 } | 54 } |
| 58 | 55 |
| 59 private: | 56 private: |
| 60 void CreateVolumeMap() { | 57 void CreateVolumeMap() { |
| 61 // These have to be sync'd with values in filebrowser_mount extension. | 58 // These have to be sync'd with values in filebrowser_mount extension. |
| 62 volumes_.insert( | 59 volumes_.insert( |
| 63 std::pair<std::string, chromeos::disks::DiskMountManager::Disk*>( | 60 std::pair<std::string, chromeos::disks::DiskMountManager::Disk*>( |
| 64 "device_path1", | 61 "device_path1", |
| 65 new chromeos::disks::DiskMountManager::Disk( | 62 new chromeos::disks::DiskMountManager::Disk( |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 EXPECT_CALL(*disk_mount_manager_mock_, UnmountPath(_)) | 127 EXPECT_CALL(*disk_mount_manager_mock_, UnmountPath(_)) |
| 131 .Times(0); | 128 .Times(0); |
| 132 EXPECT_CALL(*disk_mount_manager_mock_, | 129 EXPECT_CALL(*disk_mount_manager_mock_, |
| 133 UnmountPath(StrEq("/tmp/test_file.zip"))).Times(1); | 130 UnmountPath(StrEq("/tmp/test_file.zip"))).Times(1); |
| 134 | 131 |
| 135 EXPECT_CALL(*disk_mount_manager_mock_, disks()) | 132 EXPECT_CALL(*disk_mount_manager_mock_, disks()) |
| 136 .WillRepeatedly(ReturnRef(volumes_)); | 133 .WillRepeatedly(ReturnRef(volumes_)); |
| 137 | 134 |
| 138 ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_; | 135 ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_; |
| 139 } | 136 } |
| OLD | NEW |