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

Side by Side Diff: chromeos/dbus/cros_disks_client_unittest.cc

Issue 2392503002: Allow to pass remount option to Mount method of cros_disks_client. (Closed)
Patch Set: Rename enum item names to be more readable. Created 4 years, 2 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
« no previous file with comments | « chromeos/dbus/cros_disks_client.cc ('k') | chromeos/dbus/fake_cros_disks_client.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chromeos/dbus/cros_disks_client.h" 5 #include "chromeos/dbus/cros_disks_client.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 10
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 EXPECT_EQ(kDeviceSize, result.total_size_in_bytes()); 153 EXPECT_EQ(kDeviceSize, result.total_size_in_bytes());
154 EXPECT_EQ(DEVICE_TYPE_SD, result.device_type()); 154 EXPECT_EQ(DEVICE_TYPE_SD, result.device_type());
155 EXPECT_EQ(kMountPath, result.mount_path()); 155 EXPECT_EQ(kMountPath, result.mount_path());
156 } 156 }
157 157
158 TEST(CrosDisksClientTest, ComposeMountOptions) { 158 TEST(CrosDisksClientTest, ComposeMountOptions) {
159 std::string kExpectedMountLabelOption = 159 std::string kExpectedMountLabelOption =
160 std::string("mountlabel=") + kMountLabel; 160 std::string("mountlabel=") + kMountLabel;
161 std::vector<std::string> rw_mount_options = 161 std::vector<std::string> rw_mount_options =
162 CrosDisksClient::ComposeMountOptions(kMountLabel, 162 CrosDisksClient::ComposeMountOptions(kMountLabel,
163 MOUNT_ACCESS_MODE_READ_WRITE); 163 MOUNT_ACCESS_MODE_READ_WRITE,
164 REMOUNT_OPTION_MOUNT_NEW_DEVICE);
164 ASSERT_EQ(5U, rw_mount_options.size()); 165 ASSERT_EQ(5U, rw_mount_options.size());
165 EXPECT_EQ("nodev", rw_mount_options[0]); 166 EXPECT_EQ("nodev", rw_mount_options[0]);
166 EXPECT_EQ("noexec", rw_mount_options[1]); 167 EXPECT_EQ("noexec", rw_mount_options[1]);
167 EXPECT_EQ("nosuid", rw_mount_options[2]); 168 EXPECT_EQ("nosuid", rw_mount_options[2]);
168 EXPECT_EQ("rw", rw_mount_options[3]); 169 EXPECT_EQ("rw", rw_mount_options[3]);
169 EXPECT_EQ(kExpectedMountLabelOption, rw_mount_options[4]); 170 EXPECT_EQ(kExpectedMountLabelOption, rw_mount_options[4]);
170 171
171 std::vector<std::string> ro_mount_options = 172 std::vector<std::string> ro_mount_options =
172 CrosDisksClient::ComposeMountOptions(kMountLabel, 173 CrosDisksClient::ComposeMountOptions(kMountLabel,
173 MOUNT_ACCESS_MODE_READ_ONLY); 174 MOUNT_ACCESS_MODE_READ_ONLY,
175 REMOUNT_OPTION_MOUNT_NEW_DEVICE);
174 ASSERT_EQ(5U, ro_mount_options.size()); 176 ASSERT_EQ(5U, ro_mount_options.size());
175 EXPECT_EQ("nodev", ro_mount_options[0]); 177 EXPECT_EQ("nodev", ro_mount_options[0]);
176 EXPECT_EQ("noexec", ro_mount_options[1]); 178 EXPECT_EQ("noexec", ro_mount_options[1]);
177 EXPECT_EQ("nosuid", ro_mount_options[2]); 179 EXPECT_EQ("nosuid", ro_mount_options[2]);
178 EXPECT_EQ("ro", ro_mount_options[3]); 180 EXPECT_EQ("ro", ro_mount_options[3]);
179 EXPECT_EQ(kExpectedMountLabelOption, ro_mount_options[4]); 181 EXPECT_EQ(kExpectedMountLabelOption, ro_mount_options[4]);
182
183 std::vector<std::string> remount_mount_options =
184 CrosDisksClient::ComposeMountOptions(
185 kMountLabel, MOUNT_ACCESS_MODE_READ_WRITE,
186 REMOUNT_OPTION_REMOUNT_EXISTING_DEVICE);
187 ASSERT_EQ(6U, remount_mount_options.size());
188 EXPECT_EQ("nodev", remount_mount_options[0]);
189 EXPECT_EQ("noexec", remount_mount_options[1]);
190 EXPECT_EQ("nosuid", remount_mount_options[2]);
191 EXPECT_EQ("rw", remount_mount_options[3]);
192 EXPECT_EQ("remount", remount_mount_options[4]);
193 EXPECT_EQ(kExpectedMountLabelOption, remount_mount_options[5]);
180 } 194 }
181 195
182 } // namespace chromeos 196 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/dbus/cros_disks_client.cc ('k') | chromeos/dbus/fake_cros_disks_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698