OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/extensions/extension_apitest.h" | 8 #include "chrome/browser/extensions/extension_apitest.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
11 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
12 #include "chromeos/disks/mock_disk_mount_manager.h" | 12 #include "chromeos/disks/mock_disk_mount_manager.h" |
| 13 #include "content/public/browser/browser_context.h" |
13 #include "content/public/browser/browser_thread.h" | 14 #include "content/public/browser/browser_thread.h" |
| 15 #include "content/public/browser/storage_partition.h" |
14 #include "webkit/fileapi/file_system_context.h" | 16 #include "webkit/fileapi/file_system_context.h" |
15 #include "webkit/fileapi/file_system_mount_point_provider.h" | 17 #include "webkit/fileapi/file_system_mount_point_provider.h" |
16 | 18 |
17 using ::testing::_; | 19 using ::testing::_; |
18 using ::testing::AnyNumber; | 20 using ::testing::AnyNumber; |
19 using ::testing::ReturnRef; | 21 using ::testing::ReturnRef; |
20 using ::testing::StrEq; | 22 using ::testing::StrEq; |
21 using content::BrowserContext; | 23 using content::BrowserContext; |
22 | 24 |
23 using chromeos::disks::DiskMountManager; | 25 using chromeos::disks::DiskMountManager; |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // ExtensionApiTest override | 165 // ExtensionApiTest override |
164 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { | 166 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { |
165 chromeos::disks::DiskMountManager::Shutdown(); | 167 chromeos::disks::DiskMountManager::Shutdown(); |
166 disk_mount_manager_mock_ = NULL; | 168 disk_mount_manager_mock_ = NULL; |
167 | 169 |
168 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); | 170 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); |
169 } | 171 } |
170 | 172 |
171 void AddTmpMountPoint() { | 173 void AddTmpMountPoint() { |
172 fileapi::ExternalFileSystemMountPointProvider* provider = | 174 fileapi::ExternalFileSystemMountPointProvider* provider = |
173 BrowserContext::GetFileSystemContext(browser()->profile())-> | 175 BrowserContext::GetDefaultStoragePartition(browser()->profile())-> |
174 external_provider(); | 176 GetFileSystemContext()->external_provider(); |
175 provider->AddLocalMountPoint(test_mount_point_); | 177 provider->AddLocalMountPoint(test_mount_point_); |
176 } | 178 } |
177 | 179 |
178 private: | 180 private: |
179 void InitMountPoints() { | 181 void InitMountPoints() { |
180 for (size_t i = 0; i < arraysize(kTestMountPoints); i++) { | 182 for (size_t i = 0; i < arraysize(kTestMountPoints); i++) { |
181 mount_points_.insert(DiskMountManager::MountPointMap::value_type( | 183 mount_points_.insert(DiskMountManager::MountPointMap::value_type( |
182 kTestMountPoints[i].mount_path, | 184 kTestMountPoints[i].mount_path, |
183 DiskMountManager::MountPointInfo(kTestMountPoints[i].source_path, | 185 DiskMountManager::MountPointInfo(kTestMountPoints[i].source_path, |
184 kTestMountPoints[i].mount_path, | 186 kTestMountPoints[i].mount_path, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 UnmountPath(StrEq("/media/archive/archive_mount_path"))).Times(1); | 244 UnmountPath(StrEq("/media/archive/archive_mount_path"))).Times(1); |
243 | 245 |
244 EXPECT_CALL(*disk_mount_manager_mock_, disks()) | 246 EXPECT_CALL(*disk_mount_manager_mock_, disks()) |
245 .WillRepeatedly(ReturnRef(volumes_)); | 247 .WillRepeatedly(ReturnRef(volumes_)); |
246 | 248 |
247 EXPECT_CALL(*disk_mount_manager_mock_, mount_points()) | 249 EXPECT_CALL(*disk_mount_manager_mock_, mount_points()) |
248 .WillRepeatedly(ReturnRef(mount_points_)); | 250 .WillRepeatedly(ReturnRef(mount_points_)); |
249 | 251 |
250 ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_; | 252 ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_; |
251 } | 253 } |
OLD | NEW |