| 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 "base/win/shortcut.h" | 5 #include "base/win/shortcut.h" |
| 6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 7 #include <string> | 9 #include <string> |
| 8 | 10 |
| 9 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 10 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 11 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/macros.h" |
| 12 #include "base/test/test_file_util.h" | 15 #include "base/test/test_file_util.h" |
| 13 #include "base/test/test_shortcut_win.h" | 16 #include "base/test/test_shortcut_win.h" |
| 14 #include "base/win/scoped_com_initializer.h" | 17 #include "base/win/scoped_com_initializer.h" |
| 15 #include "base/win/windows_version.h" | 18 #include "base/win/windows_version.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 20 |
| 18 namespace base { | 21 namespace base { |
| 19 namespace win { | 22 namespace win { |
| 20 | 23 |
| 21 namespace { | 24 namespace { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 // Properties for the created shortcut. | 76 // Properties for the created shortcut. |
| 74 ShortcutProperties link_properties_; | 77 ShortcutProperties link_properties_; |
| 75 | 78 |
| 76 // Properties for the updated shortcut. | 79 // Properties for the updated shortcut. |
| 77 ShortcutProperties link_properties_2_; | 80 ShortcutProperties link_properties_2_; |
| 78 }; | 81 }; |
| 79 | 82 |
| 80 } // namespace | 83 } // namespace |
| 81 | 84 |
| 82 TEST_F(ShortcutTest, CreateAndResolveShortcutProperties) { | 85 TEST_F(ShortcutTest, CreateAndResolveShortcutProperties) { |
| 83 uint32 valid_properties = ShortcutProperties::PROPERTIES_BASIC; | 86 uint32_t valid_properties = ShortcutProperties::PROPERTIES_BASIC; |
| 84 if (GetVersion() >= VERSION_WIN7) | 87 if (GetVersion() >= VERSION_WIN7) |
| 85 valid_properties |= ShortcutProperties::PROPERTIES_WIN7; | 88 valid_properties |= ShortcutProperties::PROPERTIES_WIN7; |
| 86 | 89 |
| 87 // Test all properties. | 90 // Test all properties. |
| 88 FilePath file_1(temp_dir_.path().Append(L"Link1.lnk")); | 91 FilePath file_1(temp_dir_.path().Append(L"Link1.lnk")); |
| 89 ASSERT_TRUE(CreateOrUpdateShortcutLink( | 92 ASSERT_TRUE(CreateOrUpdateShortcutLink( |
| 90 file_1, link_properties_, SHORTCUT_CREATE_ALWAYS)); | 93 file_1, link_properties_, SHORTCUT_CREATE_ALWAYS)); |
| 91 | 94 |
| 92 ShortcutProperties properties_read_1; | 95 ShortcutProperties properties_read_1; |
| 93 ASSERT_TRUE(ResolveShortcutProperties( | 96 ASSERT_TRUE(ResolveShortcutProperties( |
| (...skipping 219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 ASSERT_TRUE(CreateOrUpdateShortcutLink( | 316 ASSERT_TRUE(CreateOrUpdateShortcutLink( |
| 314 link_file_, link_properties_2_, SHORTCUT_REPLACE_EXISTING)); | 317 link_file_, link_properties_2_, SHORTCUT_REPLACE_EXISTING)); |
| 315 | 318 |
| 316 ShortcutProperties expected_properties(link_properties_2_); | 319 ShortcutProperties expected_properties(link_properties_2_); |
| 317 expected_properties.set_arguments(link_properties_.arguments); | 320 expected_properties.set_arguments(link_properties_.arguments); |
| 318 ValidateShortcut(link_file_, expected_properties); | 321 ValidateShortcut(link_file_, expected_properties); |
| 319 } | 322 } |
| 320 | 323 |
| 321 } // namespace win | 324 } // namespace win |
| 322 } // namespace base | 325 } // namespace base |
| OLD | NEW |