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

Side by Side Diff: base/win/shortcut_unittest.cc

Issue 18286004: Move PathExists to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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
« no previous file with comments | « base/win/shortcut.cc ('k') | cc/test/paths.cc » ('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 (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/win/shortcut.h" 5 #include "base/win/shortcut.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 SHORTCUT_UPDATE_EXISTING)); 205 SHORTCUT_UPDATE_EXISTING));
206 206
207 ShortcutProperties expected_properties = link_properties_; 207 ShortcutProperties expected_properties = link_properties_;
208 expected_properties.set_arguments(string16()); 208 expected_properties.set_arguments(string16());
209 ValidateShortcut(link_file_, expected_properties); 209 ValidateShortcut(link_file_, expected_properties);
210 } 210 }
211 211
212 TEST_F(ShortcutTest, FailUpdateShortcutThatDoesNotExist) { 212 TEST_F(ShortcutTest, FailUpdateShortcutThatDoesNotExist) {
213 ASSERT_FALSE(CreateOrUpdateShortcutLink( 213 ASSERT_FALSE(CreateOrUpdateShortcutLink(
214 link_file_, link_properties_, SHORTCUT_UPDATE_EXISTING)); 214 link_file_, link_properties_, SHORTCUT_UPDATE_EXISTING));
215 ASSERT_FALSE(file_util::PathExists(link_file_)); 215 ASSERT_FALSE(PathExists(link_file_));
216 } 216 }
217 217
218 TEST_F(ShortcutTest, ReplaceShortcutAllProperties) { 218 TEST_F(ShortcutTest, ReplaceShortcutAllProperties) {
219 ASSERT_TRUE(CreateOrUpdateShortcutLink( 219 ASSERT_TRUE(CreateOrUpdateShortcutLink(
220 link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS)); 220 link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS));
221 221
222 ASSERT_TRUE(CreateOrUpdateShortcutLink( 222 ASSERT_TRUE(CreateOrUpdateShortcutLink(
223 link_file_, link_properties_2_, SHORTCUT_REPLACE_EXISTING)); 223 link_file_, link_properties_2_, SHORTCUT_REPLACE_EXISTING));
224 224
225 ValidateShortcut(link_file_, link_properties_2_); 225 ValidateShortcut(link_file_, link_properties_2_);
(...skipping 16 matching lines...) Expand all
242 expected_properties.set_working_dir(FilePath()); 242 expected_properties.set_working_dir(FilePath());
243 expected_properties.set_icon(FilePath(), 0); 243 expected_properties.set_icon(FilePath(), 0);
244 expected_properties.set_app_id(string16()); 244 expected_properties.set_app_id(string16());
245 expected_properties.set_dual_mode(false); 245 expected_properties.set_dual_mode(false);
246 ValidateShortcut(link_file_, expected_properties); 246 ValidateShortcut(link_file_, expected_properties);
247 } 247 }
248 248
249 TEST_F(ShortcutTest, FailReplaceShortcutThatDoesNotExist) { 249 TEST_F(ShortcutTest, FailReplaceShortcutThatDoesNotExist) {
250 ASSERT_FALSE(CreateOrUpdateShortcutLink( 250 ASSERT_FALSE(CreateOrUpdateShortcutLink(
251 link_file_, link_properties_, SHORTCUT_REPLACE_EXISTING)); 251 link_file_, link_properties_, SHORTCUT_REPLACE_EXISTING));
252 ASSERT_FALSE(file_util::PathExists(link_file_)); 252 ASSERT_FALSE(PathExists(link_file_));
253 } 253 }
254 254
255 // Test that the old arguments remain on the replaced shortcut when not 255 // Test that the old arguments remain on the replaced shortcut when not
256 // otherwise specified. 256 // otherwise specified.
257 TEST_F(ShortcutTest, ReplaceShortcutKeepOldArguments) { 257 TEST_F(ShortcutTest, ReplaceShortcutKeepOldArguments) {
258 ASSERT_TRUE(CreateOrUpdateShortcutLink( 258 ASSERT_TRUE(CreateOrUpdateShortcutLink(
259 link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS)); 259 link_file_, link_properties_, SHORTCUT_CREATE_ALWAYS));
260 260
261 // Do not explicitly set the arguments. 261 // Do not explicitly set the arguments.
262 link_properties_2_.options &= 262 link_properties_2_.options &=
263 ~ShortcutProperties::PROPERTIES_ARGUMENTS; 263 ~ShortcutProperties::PROPERTIES_ARGUMENTS;
264 ASSERT_TRUE(CreateOrUpdateShortcutLink( 264 ASSERT_TRUE(CreateOrUpdateShortcutLink(
265 link_file_, link_properties_2_, SHORTCUT_REPLACE_EXISTING)); 265 link_file_, link_properties_2_, SHORTCUT_REPLACE_EXISTING));
266 266
267 ShortcutProperties expected_properties(link_properties_2_); 267 ShortcutProperties expected_properties(link_properties_2_);
268 expected_properties.set_arguments(link_properties_.arguments); 268 expected_properties.set_arguments(link_properties_.arguments);
269 ValidateShortcut(link_file_, expected_properties); 269 ValidateShortcut(link_file_, expected_properties);
270 } 270 }
271 271
272 } // namespace win 272 } // namespace win
273 } // namespace base 273 } // namespace base
OLDNEW
« no previous file with comments | « base/win/shortcut.cc ('k') | cc/test/paths.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698