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