OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome_frame/test/chrome_frame_test_utils.h" | 5 #include "chrome_frame/test/chrome_frame_test_utils.h" |
6 | 6 |
7 #include <atlbase.h> | 7 #include <atlbase.h> |
8 #include <atlwin.h> | 8 #include <atlwin.h> |
9 #include <iepmapi.h> | 9 #include <iepmapi.h> |
10 #include <oleacc.h> | 10 #include <oleacc.h> |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 } | 111 } |
112 | 112 |
113 return window_close_attempts; | 113 return window_close_attempts; |
114 } | 114 } |
115 | 115 |
116 std::wstring GetExecutableAppPath(const std::wstring& file) { | 116 std::wstring GetExecutableAppPath(const std::wstring& file) { |
117 std::wstring kAppPathsKey = | 117 std::wstring kAppPathsKey = |
118 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"; | 118 L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\"; |
119 | 119 |
120 std::wstring app_path; | 120 std::wstring app_path; |
121 RegKey key(HKEY_LOCAL_MACHINE, (kAppPathsKey + file).c_str()); | 121 RegKey key(HKEY_LOCAL_MACHINE, (kAppPathsKey + file).c_str(), KEY_READ); |
122 if (key.Handle()) { | 122 if (key.Handle()) { |
123 key.ReadValue(NULL, &app_path); | 123 key.ReadValue(NULL, &app_path); |
124 } | 124 } |
125 | 125 |
126 return app_path; | 126 return app_path; |
127 } | 127 } |
128 | 128 |
129 std::wstring FormatCommandForApp(const std::wstring& exe_name, | 129 std::wstring FormatCommandForApp(const std::wstring& exe_name, |
130 const std::wstring& argument) { | 130 const std::wstring& argument) { |
131 std::wstring reg_path(StringPrintf(L"Applications\\%ls\\shell\\open\\command", | 131 std::wstring reg_path(StringPrintf(L"Applications\\%ls\\shell\\open\\command", |
132 exe_name.c_str())); | 132 exe_name.c_str())); |
133 RegKey key(HKEY_CLASSES_ROOT, reg_path.c_str()); | 133 RegKey key(HKEY_CLASSES_ROOT, reg_path.c_str(), KEY_READ); |
134 | 134 |
135 std::wstring command; | 135 std::wstring command; |
136 if (key.Handle()) { | 136 if (key.Handle()) { |
137 key.ReadValue(NULL, &command); | 137 key.ReadValue(NULL, &command); |
138 int found = command.find(L"%1"); | 138 int found = command.find(L"%1"); |
139 if (found >= 0) { | 139 if (found >= 0) { |
140 command.replace(found, 2, argument); | 140 command.replace(found, 2, argument); |
141 } | 141 } |
142 } | 142 } |
143 return command; | 143 return command; |
(...skipping 1113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1257 } | 1257 } |
1258 | 1258 |
1259 DLOG(INFO) << "Started crash_service.exe so you know if a test crashes!"; | 1259 DLOG(INFO) << "Started crash_service.exe so you know if a test crashes!"; |
1260 // This sleep is to ensure that the crash service is done initializing, i.e | 1260 // This sleep is to ensure that the crash service is done initializing, i.e |
1261 // the pipe creation, etc. | 1261 // the pipe creation, etc. |
1262 Sleep(500); | 1262 Sleep(500); |
1263 return crash_service; | 1263 return crash_service; |
1264 } | 1264 } |
1265 | 1265 |
1266 } // namespace chrome_frame_test | 1266 } // namespace chrome_frame_test |
OLD | NEW |