| 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" | 14 #include "webkit/fileapi/file_system_path_manager.h" |
| 15 | 15 |
| 16 using ::testing::_; | 16 using ::testing::_; |
| 17 using ::testing::ReturnRef; | 17 using ::testing::ReturnRef; |
| 18 using ::testing::StrEq; | 18 using ::testing::StrEq; |
| 19 | 19 |
| 20 class FileBrowserExtensionApiTest : public ExtensionApiTest { | 20 class ExtensionFileBrowserPrivateApiTest : public ExtensionApiTest { |
| 21 public: | 21 public: |
| 22 FileBrowserExtensionApiTest() | 22 ExtensionFileBrowserPrivateApiTest() |
| 23 : disk_mount_manager_mock_(NULL), | 23 : disk_mount_manager_mock_(NULL), |
| 24 test_mount_point_("/tmp") { | 24 test_mount_point_("/tmp") { |
| 25 CreateVolumeMap(); | 25 CreateVolumeMap(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual ~FileBrowserExtensionApiTest() { | 28 virtual ~ExtensionFileBrowserPrivateApiTest() { |
| 29 DCHECK(!disk_mount_manager_mock_); | 29 DCHECK(!disk_mount_manager_mock_); |
| 30 STLDeleteValues(&volumes_); | 30 STLDeleteValues(&volumes_); |
| 31 } | 31 } |
| 32 | 32 |
| 33 // ExtensionApiTest override | 33 // ExtensionApiTest override |
| 34 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { | 34 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 35 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); | 35 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
| 36 | 36 |
| 37 disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager; | 37 disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager; |
| 38 chromeos::disks::DiskMountManager::InitializeForTesting( | 38 chromeos::disks::DiskMountManager::InitializeForTesting( |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 | 117 |
| 118 protected: | 118 protected: |
| 119 chromeos::disks::MockDiskMountManager* disk_mount_manager_mock_; | 119 chromeos::disks::MockDiskMountManager* disk_mount_manager_mock_; |
| 120 chromeos::disks::DiskMountManager::DiskMap volumes_; | 120 chromeos::disks::DiskMountManager::DiskMap volumes_; |
| 121 | 121 |
| 122 private: | 122 private: |
| 123 FilePath test_mount_point_; | 123 FilePath test_mount_point_; |
| 124 }; | 124 }; |
| 125 | 125 |
| 126 IN_PROC_BROWSER_TEST_F(FileBrowserExtensionApiTest, FileBrowserMount) { | 126 IN_PROC_BROWSER_TEST_F(ExtensionFileBrowserPrivateApiTest, FileBrowserMount) { |
| 127 // We will call fileBrowserPrivate.unmountVolume once. To test that method, we | 127 // We will call fileBrowserPrivate.unmountVolume once. To test that method, we |
| 128 // check that UnmountPath is really called with the same value. | 128 // check that UnmountPath is really called with the same value. |
| 129 AddTmpMountPoint(); | 129 AddTmpMountPoint(); |
| 130 EXPECT_CALL(*disk_mount_manager_mock_, UnmountPath(_)) | 130 EXPECT_CALL(*disk_mount_manager_mock_, UnmountPath(_)) |
| 131 .Times(0); | 131 .Times(0); |
| 132 EXPECT_CALL(*disk_mount_manager_mock_, | 132 EXPECT_CALL(*disk_mount_manager_mock_, |
| 133 UnmountPath(StrEq("/tmp/test_file.zip"))).Times(1); | 133 UnmountPath(StrEq("/tmp/test_file.zip"))).Times(1); |
| 134 | 134 |
| 135 EXPECT_CALL(*disk_mount_manager_mock_, disks()) | 135 EXPECT_CALL(*disk_mount_manager_mock_, disks()) |
| 136 .WillRepeatedly(ReturnRef(volumes_)); | 136 .WillRepeatedly(ReturnRef(volumes_)); |
| 137 | 137 |
| 138 ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_; | 138 ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_; |
| 139 } | 139 } |
| OLD | NEW |