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 #ifndef CHROME_FRAME_TEST_UTILS_H_ | 5 #ifndef CHROME_FRAME_TEST_UTILS_H_ |
6 #define CHROME_FRAME_TEST_UTILS_H_ | 6 #define CHROME_FRAME_TEST_UTILS_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include <atlbase.h> | 10 #include <atlbase.h> |
11 #include <atlcom.h> | 11 #include <atlcom.h> |
12 | 12 |
13 #include "base/string16.h" | 13 #include "base/string16.h" |
14 | 14 |
| 15 namespace base { |
15 class FilePath; | 16 class FilePath; |
| 17 } |
16 | 18 |
17 extern const wchar_t kChromeFrameDllName[]; | 19 extern const wchar_t kChromeFrameDllName[]; |
18 extern const wchar_t kChromeLauncherExeName[]; | 20 extern const wchar_t kChromeLauncherExeName[]; |
19 | 21 |
20 // Helper class used to register different chrome frame DLLs while running | 22 // Helper class used to register different chrome frame DLLs while running |
21 // tests. The default constructor registers the DLL found in the build path. | 23 // tests. The default constructor registers the DLL found in the build path. |
22 // Programs that use this class MUST include a call to the class's | 24 // Programs that use this class MUST include a call to the class's |
23 // RegisterAndExitProcessIfDirected method at the top of their main entrypoint. | 25 // RegisterAndExitProcessIfDirected method at the top of their main entrypoint. |
24 // | 26 // |
25 // At destruction, again registers the DLL found in the build path if another | 27 // At destruction, again registers the DLL found in the build path if another |
(...skipping 17 matching lines...) Expand all Loading... |
43 void UnegisterChromeFrameAtPath(const std::wstring& path); | 45 void UnegisterChromeFrameAtPath(const std::wstring& path); |
44 void RegisterReferenceChromeFrameBuild(); | 46 void RegisterReferenceChromeFrameBuild(); |
45 | 47 |
46 std::wstring GetChromeFrameDllPath() const; | 48 std::wstring GetChromeFrameDllPath() const; |
47 | 49 |
48 static void RegisterAtPath(const std::wstring& path, | 50 static void RegisterAtPath(const std::wstring& path, |
49 RegistrationType registration_type); | 51 RegistrationType registration_type); |
50 static void UnregisterAtPath(const std::wstring& path, | 52 static void UnregisterAtPath(const std::wstring& path, |
51 RegistrationType registration_type); | 53 RegistrationType registration_type); |
52 static void RegisterDefaults(); | 54 static void RegisterDefaults(); |
53 static FilePath GetReferenceChromeFrameDllPath(); | 55 static base::FilePath GetReferenceChromeFrameDllPath(); |
54 | 56 |
55 // Registers or unregisters a COM DLL and exits the process if the process's | 57 // Registers or unregisters a COM DLL and exits the process if the process's |
56 // command line is: | 58 // command line is: |
57 // this.exe --call-registration-entrypoint path_to_dll entrypoint | 59 // this.exe --call-registration-entrypoint path_to_dll entrypoint |
58 // Otherwise simply returns. This method should be invoked at the start of the | 60 // Otherwise simply returns. This method should be invoked at the start of the |
59 // entrypoint in each executable that uses ScopedChromeFrameRegistrar to | 61 // entrypoint in each executable that uses ScopedChromeFrameRegistrar to |
60 // register or unregister DLLs. | 62 // register or unregister DLLs. |
61 static void RegisterAndExitProcessIfDirected(); | 63 static void RegisterAndExitProcessIfDirected(); |
62 | 64 |
63 private: | 65 private: |
(...skipping 18 matching lines...) Expand all Loading... |
82 // Indicates whether per user or per machine registration is needed. | 84 // Indicates whether per user or per machine registration is needed. |
83 RegistrationType registration_type_; | 85 RegistrationType registration_type_; |
84 // We need to register the chrome path provider only once per process. This | 86 // We need to register the chrome path provider only once per process. This |
85 // flag keeps track of that. | 87 // flag keeps track of that. |
86 static bool register_chrome_path_provider_; | 88 static bool register_chrome_path_provider_; |
87 }; | 89 }; |
88 | 90 |
89 // Returns the path to the Chrome Frame DLL in the build directory. Assumes | 91 // Returns the path to the Chrome Frame DLL in the build directory. Assumes |
90 // that the test executable is running from the build folder or a similar | 92 // that the test executable is running from the build folder or a similar |
91 // folder structure. | 93 // folder structure. |
92 FilePath GetChromeFrameBuildPath(); | 94 base::FilePath GetChromeFrameBuildPath(); |
93 | 95 |
94 // Callback description for onload, onloaderror, onmessage | 96 // Callback description for onload, onloaderror, onmessage |
95 static _ATL_FUNC_INFO g_single_param = {CC_STDCALL, VT_EMPTY, 1, {VT_VARIANT}}; | 97 static _ATL_FUNC_INFO g_single_param = {CC_STDCALL, VT_EMPTY, 1, {VT_VARIANT}}; |
96 // Simple class that forwards the callbacks. | 98 // Simple class that forwards the callbacks. |
97 template <typename T> | 99 template <typename T> |
98 class DispCallback | 100 class DispCallback |
99 : public IDispEventSimpleImpl<1, DispCallback<T>, &IID_IDispatch> { | 101 : public IDispEventSimpleImpl<1, DispCallback<T>, &IID_IDispatch> { |
100 public: | 102 public: |
101 typedef HRESULT (T::*Method)(const VARIANT* param); | 103 typedef HRESULT (T::*Method)(const VARIANT* param); |
102 | 104 |
(...skipping 26 matching lines...) Expand all Loading... |
129 // Kills all running processes named |process_name| that have the string | 131 // Kills all running processes named |process_name| that have the string |
130 // |argument| on their command line. Useful for killing all Chrome Frame | 132 // |argument| on their command line. Useful for killing all Chrome Frame |
131 // instances of Chrome that all have --chrome-frame in their command line. | 133 // instances of Chrome that all have --chrome-frame in their command line. |
132 bool KillAllNamedProcessesWithArgument(const std::wstring& process_name, | 134 bool KillAllNamedProcessesWithArgument(const std::wstring& process_name, |
133 const std::wstring& argument); | 135 const std::wstring& argument); |
134 | 136 |
135 // If the workstation is locked and cannot receive user input. | 137 // If the workstation is locked and cannot receive user input. |
136 bool IsWorkstationLocked(); | 138 bool IsWorkstationLocked(); |
137 | 139 |
138 #endif // CHROME_FRAME_TEST_UTILS_H_ | 140 #endif // CHROME_FRAME_TEST_UTILS_H_ |
OLD | NEW |