| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/file_path.h" | 13 #include "base/file_path.h" |
| 14 | 14 |
| 15 extern const wchar_t kChromeFrameDllName[]; |
| 16 |
| 15 // Helper class used to register different chrome frame DLLs while running | 17 // Helper class used to register different chrome frame DLLs while running |
| 16 // tests. At construction, this registers the DLL found in the build path. | 18 // tests. At construction, this registers the DLL found in the build path. |
| 17 // At destruction, again registers the DLL found in the build path if another | 19 // At destruction, again registers the DLL found in the build path if another |
| 18 // DLL has since been registered. Triggers GTEST asserts on failure. | 20 // DLL has since been registered. Triggers GTEST asserts on failure. |
| 19 // | 21 // |
| 20 // TODO(robertshield): Ideally, make this class restore the originally | 22 // TODO(robertshield): Ideally, make this class restore the originally |
| 21 // registered chrome frame DLL (e.g. by looking in HKCR) on destruction. | 23 // registered chrome frame DLL (e.g. by looking in HKCR) on destruction. |
| 22 class ScopedChromeFrameRegistrar { | 24 class ScopedChromeFrameRegistrar { |
| 23 public: | 25 public: |
| 24 ScopedChromeFrameRegistrar(); | 26 ScopedChromeFrameRegistrar(); |
| 25 virtual ~ScopedChromeFrameRegistrar(); | 27 virtual ~ScopedChromeFrameRegistrar(); |
| 26 | 28 |
| 27 void RegisterChromeFrameAtPath(const std::wstring& path); | 29 void RegisterChromeFrameAtPath(const std::wstring& path); |
| 28 void RegisterReferenceChromeFrameBuild(); | 30 void RegisterReferenceChromeFrameBuild(); |
| 29 | 31 |
| 30 std::wstring GetChromeFrameDllPath() const; | 32 std::wstring GetChromeFrameDllPath() const; |
| 31 | 33 |
| 32 static FilePath GetChromeFrameBuildPath(); | 34 static FilePath GetChromeFrameBuildPath(); |
| 33 static void RegisterAtPath(const std::wstring& path); | 35 static void RegisterAtPath(const std::wstring& path); |
| 34 static void RegisterDefaults(); | 36 static void RegisterDefaults(); |
| 35 | 37 |
| 36 private: | 38 private: |
| 37 // Contains the path of the most recently registered npchrome_tab.dll. | 39 // Contains the path of the most recently registered Chrome Frame DLL. |
| 38 std::wstring new_chrome_frame_dll_path_; | 40 std::wstring new_chrome_frame_dll_path_; |
| 39 | 41 |
| 40 // Contains the path of the npchrome_tab.dll to be registered at destruction. | 42 // Contains the path of the Chrome Frame DLL to be registered at destruction. |
| 41 std::wstring original_dll_path_; | 43 std::wstring original_dll_path_; |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 // Callback description for onload, onloaderror, onmessage | 46 // Callback description for onload, onloaderror, onmessage |
| 45 static _ATL_FUNC_INFO g_single_param = {CC_STDCALL, VT_EMPTY, 1, {VT_VARIANT}}; | 47 static _ATL_FUNC_INFO g_single_param = {CC_STDCALL, VT_EMPTY, 1, {VT_VARIANT}}; |
| 46 // Simple class that forwards the callbacks. | 48 // Simple class that forwards the callbacks. |
| 47 template <typename T> | 49 template <typename T> |
| 48 class DispCallback | 50 class DispCallback |
| 49 : public IDispEventSimpleImpl<1, DispCallback<T>, &IID_IDispatch> { | 51 : public IDispEventSimpleImpl<1, DispCallback<T>, &IID_IDispatch> { |
| 50 public: | 52 public: |
| (...skipping 26 matching lines...) Expand all Loading... |
| 77 }; | 79 }; |
| 78 | 80 |
| 79 // Kills all running processes named |process_name| that have the string | 81 // Kills all running processes named |process_name| that have the string |
| 80 // |argument| on their command line. Useful for killing all Chrome Frame | 82 // |argument| on their command line. Useful for killing all Chrome Frame |
| 81 // instances of Chrome that all have --chrome-frame in their command line. | 83 // instances of Chrome that all have --chrome-frame in their command line. |
| 82 bool KillAllNamedProcessesWithArgument(const std::wstring& process_name, | 84 bool KillAllNamedProcessesWithArgument(const std::wstring& process_name, |
| 83 const std::wstring& argument); | 85 const std::wstring& argument); |
| 84 | 86 |
| 85 | 87 |
| 86 #endif // CHROME_FRAME_TEST_UTILS_H_ | 88 #endif // CHROME_FRAME_TEST_UTILS_H_ |
| OLD | NEW |