[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef CHROME_FRAME_TEST_UTILS_H_ |
| 6 | #define CHROME_FRAME_TEST_UTILS_H_ |
| 7 | |
| 8 | #include <string> |
| 9 | |
[email protected] | 66ff735 | 2009-10-15 05:09:50 | [diff] [blame^] | 10 | #include "base/file_path.h" |
| 11 | |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 12 | // Helper class used to register different chrome frame DLLs while running |
| 13 | // tests. At construction, this registers the DLL found in the build path. |
| 14 | // At destruction, again registers the DLL found in the build path if another |
| 15 | // DLL has since been registered. Triggers GTEST asserts on failure. |
| 16 | // |
| 17 | // TODO(robertshield): Ideally, make this class restore the originally |
| 18 | // registered chrome frame DLL (e.g. by looking in HKCR) on destruction. |
| 19 | class ScopedChromeFrameRegistrar { |
| 20 | public: |
| 21 | ScopedChromeFrameRegistrar(); |
| 22 | virtual ~ScopedChromeFrameRegistrar(); |
| 23 | |
| 24 | void RegisterChromeFrameAtPath(const std::wstring& path); |
| 25 | void RegisterReferenceChromeFrameBuild(); |
| 26 | |
| 27 | std::wstring GetChromeFrameDllPath() const; |
| 28 | |
[email protected] | 66ff735 | 2009-10-15 05:09:50 | [diff] [blame^] | 29 | static FilePath GetChromeFrameBuildPath(); |
[email protected] | f781782 | 2009-09-24 05:11:58 | [diff] [blame] | 30 | static void RegisterAtPath(const std::wstring& path); |
| 31 | static void RegisterDefaults(); |
| 32 | |
| 33 | private: |
| 34 | // Contains the path of the most recently registered npchrome_tab.dll. |
| 35 | std::wstring new_chrome_frame_dll_path_; |
| 36 | |
| 37 | // Contains the path of the npchrome_tab.dll to be registered at destruction. |
| 38 | std::wstring original_dll_path_; |
| 39 | }; |
| 40 | |
| 41 | #endif // CHROME_FRAME_TEST_UTILS_H_ |