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/test/test_shortcut_win.h" | 5 #include "base/test/test_shortcut_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 #include <shlobj.h> | 8 #include <shlobj.h> |
9 #include <propkey.h> | 9 #include <propkey.h> |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 int read_icon_index = 0; | 60 int read_icon_index = 0; |
61 | 61 |
62 HRESULT hr; | 62 HRESULT hr; |
63 | 63 |
64 // Initialize the shell interfaces. | 64 // Initialize the shell interfaces. |
65 EXPECT_TRUE(SUCCEEDED(hr = i_shell_link.CreateInstance( | 65 EXPECT_TRUE(SUCCEEDED(hr = i_shell_link.CreateInstance( |
66 CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER))); | 66 CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER))); |
67 if (FAILED(hr)) | 67 if (FAILED(hr)) |
68 return; | 68 return; |
69 | 69 |
70 EXPECT_TRUE(SUCCEEDED(hr = i_persist_file.QueryFrom(i_shell_link.get()))); | 70 EXPECT_TRUE(SUCCEEDED(hr = i_persist_file.QueryFrom(i_shell_link.Get()))); |
71 if (FAILED(hr)) | 71 if (FAILED(hr)) |
72 return; | 72 return; |
73 | 73 |
74 // Load the shortcut. | 74 // Load the shortcut. |
75 EXPECT_TRUE(SUCCEEDED(hr = i_persist_file->Load( | 75 EXPECT_TRUE(SUCCEEDED(hr = i_persist_file->Load( |
76 shortcut_path.value().c_str(), 0))) << "Failed to load shortcut at " | 76 shortcut_path.value().c_str(), 0))) << "Failed to load shortcut at " |
77 << shortcut_path.value(); | 77 << shortcut_path.value(); |
78 if (FAILED(hr)) | 78 if (FAILED(hr)) |
79 return; | 79 return; |
80 | 80 |
(...skipping 24 matching lines...) Expand all Loading... |
105 | 105 |
106 if (properties.options & ShortcutProperties::PROPERTIES_ICON) { | 106 if (properties.options & ShortcutProperties::PROPERTIES_ICON) { |
107 EXPECT_TRUE(SUCCEEDED( | 107 EXPECT_TRUE(SUCCEEDED( |
108 i_shell_link->GetIconLocation(read_icon, MAX_PATH, &read_icon_index))); | 108 i_shell_link->GetIconLocation(read_icon, MAX_PATH, &read_icon_index))); |
109 ValidatePathsAreEqual(properties.icon, base::FilePath(read_icon)); | 109 ValidatePathsAreEqual(properties.icon, base::FilePath(read_icon)); |
110 EXPECT_EQ(properties.icon_index, read_icon_index); | 110 EXPECT_EQ(properties.icon_index, read_icon_index); |
111 } | 111 } |
112 | 112 |
113 if (GetVersion() >= VERSION_WIN7) { | 113 if (GetVersion() >= VERSION_WIN7) { |
114 ScopedComPtr<IPropertyStore> property_store; | 114 ScopedComPtr<IPropertyStore> property_store; |
115 EXPECT_TRUE(SUCCEEDED(hr = property_store.QueryFrom(i_shell_link.get()))); | 115 EXPECT_TRUE(SUCCEEDED(hr = property_store.QueryFrom(i_shell_link.Get()))); |
116 if (FAILED(hr)) | 116 if (FAILED(hr)) |
117 return; | 117 return; |
118 | 118 |
119 if (properties.options & ShortcutProperties::PROPERTIES_APP_ID) { | 119 if (properties.options & ShortcutProperties::PROPERTIES_APP_ID) { |
120 ScopedPropVariant pv_app_id; | 120 ScopedPropVariant pv_app_id; |
121 EXPECT_EQ(S_OK, property_store->GetValue(PKEY_AppUserModel_ID, | 121 EXPECT_EQ(S_OK, property_store->GetValue(PKEY_AppUserModel_ID, |
122 pv_app_id.Receive())); | 122 pv_app_id.Receive())); |
123 switch (pv_app_id.get().vt) { | 123 switch (pv_app_id.get().vt) { |
124 case VT_EMPTY: | 124 case VT_EMPTY: |
125 EXPECT_TRUE(properties.app_id.empty()); | 125 EXPECT_TRUE(properties.app_id.empty()); |
(...skipping 20 matching lines...) Expand all Loading... |
146 break; | 146 break; |
147 default: | 147 default: |
148 ADD_FAILURE() << "Unexpected variant type: " << pv_dual_mode.get().vt; | 148 ADD_FAILURE() << "Unexpected variant type: " << pv_dual_mode.get().vt; |
149 } | 149 } |
150 } | 150 } |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 } // namespace win | 154 } // namespace win |
155 } // namespace base | 155 } // namespace base |
OLD | NEW |