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 <objbase.h> |
8 #include <shlobj.h> | 9 #include <shlobj.h> |
9 #include <propkey.h> | 10 #include <propkey.h> |
10 | 11 |
11 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
12 #include "base/strings/string16.h" | 13 #include "base/strings/string16.h" |
13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
14 #include "base/win/scoped_comptr.h" | 15 #include "base/win/scoped_comptr.h" |
15 #include "base/win/scoped_propvariant.h" | 16 #include "base/win/scoped_propvariant.h" |
16 #include "base/win/windows_version.h" | 17 #include "base/win/windows_version.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 wchar_t read_target[MAX_PATH] = {0}; | 56 wchar_t read_target[MAX_PATH] = {0}; |
56 wchar_t read_working_dir[MAX_PATH] = {0}; | 57 wchar_t read_working_dir[MAX_PATH] = {0}; |
57 wchar_t read_arguments[MAX_PATH] = {0}; | 58 wchar_t read_arguments[MAX_PATH] = {0}; |
58 wchar_t read_description[MAX_PATH] = {0}; | 59 wchar_t read_description[MAX_PATH] = {0}; |
59 wchar_t read_icon[MAX_PATH] = {0}; | 60 wchar_t read_icon[MAX_PATH] = {0}; |
60 int read_icon_index = 0; | 61 int read_icon_index = 0; |
61 | 62 |
62 HRESULT hr; | 63 HRESULT hr; |
63 | 64 |
64 // Initialize the shell interfaces. | 65 // Initialize the shell interfaces. |
65 EXPECT_TRUE(SUCCEEDED(hr = i_shell_link.CreateInstance( | 66 EXPECT_TRUE(SUCCEEDED(hr = ::CoCreateInstance(CLSID_ShellLink, NULL, |
66 CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER))); | 67 CLSCTX_INPROC_SERVER, |
| 68 IID_PPV_ARGS(&i_shell_link)))); |
67 if (FAILED(hr)) | 69 if (FAILED(hr)) |
68 return; | 70 return; |
69 | 71 |
70 EXPECT_TRUE( | 72 EXPECT_TRUE( |
71 SUCCEEDED(hr = i_shell_link.CopyTo(i_persist_file.GetAddressOf()))); | 73 SUCCEEDED(hr = i_shell_link.CopyTo(i_persist_file.GetAddressOf()))); |
72 if (FAILED(hr)) | 74 if (FAILED(hr)) |
73 return; | 75 return; |
74 | 76 |
75 // Load the shortcut. | 77 // Load the shortcut. |
76 EXPECT_TRUE(SUCCEEDED(hr = i_persist_file->Load( | 78 EXPECT_TRUE(SUCCEEDED(hr = i_persist_file->Load( |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 break; | 150 break; |
149 default: | 151 default: |
150 ADD_FAILURE() << "Unexpected variant type: " << pv_dual_mode.get().vt; | 152 ADD_FAILURE() << "Unexpected variant type: " << pv_dual_mode.get().vt; |
151 } | 153 } |
152 } | 154 } |
153 } | 155 } |
154 } | 156 } |
155 | 157 |
156 } // namespace win | 158 } // namespace win |
157 } // namespace base | 159 } // namespace base |
OLD | NEW |