blob: 85f5cc52d3da9c1c48cb45973393bd76074464f8 [file] [log] [blame]
[email protected]f7817822009-09-24 05:11:581// 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]66ff7352009-10-15 05:09:5010#include "base/file_path.h"
11
[email protected]f7817822009-09-24 05:11:5812// 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.
19class 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]66ff7352009-10-15 05:09:5029 static FilePath GetChromeFrameBuildPath();
[email protected]f7817822009-09-24 05:11:5830 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_