Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(672)

Side by Side Diff: chrome/browser/chromeos/extensions/file_manager/file_browser_private_apitest.cc

Issue 24024002: file_manager: Move mount test stuff to c/t/d/extensions/api_test/file_browser (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/stl_util.h" 5 #include "base/stl_util.h"
6 #include "chrome/browser/extensions/extension_apitest.h" 6 #include "chrome/browser/extensions/extension_apitest.h"
7 #include "chromeos/dbus/cros_disks_client.h" 7 #include "chromeos/dbus/cros_disks_client.h"
8 #include "chromeos/disks/mock_disk_mount_manager.h" 8 #include "chromeos/disks/mock_disk_mount_manager.h"
9 9
10 using ::testing::_; 10 using ::testing::_;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 true, 99 true,
100 false, 100 false,
101 false, 101 false,
102 true, 102 true,
103 false 103 false
104 } 104 }
105 }; 105 };
106 106
107 } // namespace 107 } // namespace
108 108
109 class ExtensionFileBrowserPrivateApiTest : public ExtensionApiTest { 109 class FileBrowserPrivateApiTest : public ExtensionApiTest {
110 public: 110 public:
111 ExtensionFileBrowserPrivateApiTest() 111 FileBrowserPrivateApiTest()
112 : disk_mount_manager_mock_(NULL) { 112 : disk_mount_manager_mock_(NULL) {
113 InitMountPoints(); 113 InitMountPoints();
114 } 114 }
115 115
116 virtual ~ExtensionFileBrowserPrivateApiTest() { 116 virtual ~FileBrowserPrivateApiTest() {
117 DCHECK(!disk_mount_manager_mock_); 117 DCHECK(!disk_mount_manager_mock_);
118 STLDeleteValues(&volumes_); 118 STLDeleteValues(&volumes_);
119 } 119 }
120 120
121 // ExtensionApiTest override 121 // ExtensionApiTest override
122 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { 122 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE {
123 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); 123 ExtensionApiTest::SetUpInProcessBrowserTestFixture();
124 124
125 disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager; 125 disk_mount_manager_mock_ = new chromeos::disks::MockDiskMountManager;
126 chromeos::disks::DiskMountManager::InitializeForTesting( 126 chromeos::disks::DiskMountManager::InitializeForTesting(
127 disk_mount_manager_mock_); 127 disk_mount_manager_mock_);
128 disk_mount_manager_mock_->SetupDefaultReplies(); 128 disk_mount_manager_mock_->SetupDefaultReplies();
129 129
130 // OVERRIDE FindDiskBySourcePath mock function. 130 // OVERRIDE FindDiskBySourcePath mock function.
131 ON_CALL(*disk_mount_manager_mock_, FindDiskBySourcePath(_)). 131 ON_CALL(*disk_mount_manager_mock_, FindDiskBySourcePath(_)).
132 WillByDefault(Invoke( 132 WillByDefault(Invoke(
133 this, &ExtensionFileBrowserPrivateApiTest::FindVolumeBySourcePath)); 133 this, &FileBrowserPrivateApiTest::FindVolumeBySourcePath));
134 } 134 }
135 135
136 // ExtensionApiTest override 136 // ExtensionApiTest override
137 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { 137 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE {
138 chromeos::disks::DiskMountManager::Shutdown(); 138 chromeos::disks::DiskMountManager::Shutdown();
139 disk_mount_manager_mock_ = NULL; 139 disk_mount_manager_mock_ = NULL;
140 140
141 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); 141 ExtensionApiTest::TearDownInProcessBrowserTestFixture();
142 } 142 }
143 143
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 volumes_.find(source_path); 226 volumes_.find(source_path);
227 return (volume_it == volumes_.end()) ? NULL : volume_it->second; 227 return (volume_it == volumes_.end()) ? NULL : volume_it->second;
228 } 228 }
229 229
230 protected: 230 protected:
231 chromeos::disks::MockDiskMountManager* disk_mount_manager_mock_; 231 chromeos::disks::MockDiskMountManager* disk_mount_manager_mock_;
232 DiskMountManager::DiskMap volumes_; 232 DiskMountManager::DiskMap volumes_;
233 DiskMountManager::MountPointMap mount_points_; 233 DiskMountManager::MountPointMap mount_points_;
234 }; 234 };
235 235
236 IN_PROC_BROWSER_TEST_F(ExtensionFileBrowserPrivateApiTest, FileBrowserMount) { 236 IN_PROC_BROWSER_TEST_F(FileBrowserPrivateApiTest, Mount) {
237 // We will call fileBrowserPrivate.unmountVolume once. To test that method, we 237 // We will call fileBrowserPrivate.unmountVolume once. To test that method, we
238 // check that UnmountPath is really called with the same value. 238 // check that UnmountPath is really called with the same value.
239 EXPECT_CALL(*disk_mount_manager_mock_, UnmountPath(_, _, _)) 239 EXPECT_CALL(*disk_mount_manager_mock_, UnmountPath(_, _, _))
240 .Times(0); 240 .Times(0);
241 EXPECT_CALL(*disk_mount_manager_mock_, 241 EXPECT_CALL(*disk_mount_manager_mock_,
242 UnmountPath( 242 UnmountPath(
243 chromeos::CrosDisksClient::GetArchiveMountPoint().AppendASCII( 243 chromeos::CrosDisksClient::GetArchiveMountPoint().AppendASCII(
244 "archive_mount_path").AsUTF8Unsafe(), 244 "archive_mount_path").AsUTF8Unsafe(),
245 chromeos::UNMOUNT_OPTIONS_NONE, _)).Times(1); 245 chromeos::UNMOUNT_OPTIONS_NONE, _)).Times(1);
246 246
247 EXPECT_CALL(*disk_mount_manager_mock_, disks()) 247 EXPECT_CALL(*disk_mount_manager_mock_, disks())
248 .WillRepeatedly(ReturnRef(volumes_)); 248 .WillRepeatedly(ReturnRef(volumes_));
249 249
250 EXPECT_CALL(*disk_mount_manager_mock_, mount_points()) 250 EXPECT_CALL(*disk_mount_manager_mock_, mount_points())
251 .WillRepeatedly(ReturnRef(mount_points_)); 251 .WillRepeatedly(ReturnRef(mount_points_));
252 252
253 ASSERT_TRUE(RunComponentExtensionTest("filebrowser_mount")) << message_; 253 ASSERT_TRUE(RunComponentExtensionTest("file_browser/mount_test"))
254 << message_;
254 } 255 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/resources/file_manager/OWNERS » ('j') | chrome/browser/resources/file_manager/OWNERS » ('J')

Powered by Google App Engine
This is Rietveld 408576698