Chromium Code Reviews

Side by Side Diff: chrome_frame/test/chrome_frame_test_utils.h

Issue 5564009: Temporary workaround to get tests that reference singletons either directly o... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_CHROME_FRAME_TEST_UTILS_H_ 5 #ifndef CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_
6 #define CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ 6 #define CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_
7 7
8 #include <atlbase.h> 8 #include <atlbase.h>
9 #include <atlcom.h> 9 #include <atlcom.h>
10 #include <exdisp.h> 10 #include <exdisp.h>
11 #include <exdispid.h> 11 #include <exdispid.h>
12 #include <mshtml.h> 12 #include <mshtml.h>
13 #include <shlguid.h> 13 #include <shlguid.h>
14 #include <shobjidl.h> 14 #include <shobjidl.h>
15 #include <windows.h> 15 #include <windows.h>
16 16
17 #include <string> 17 #include <string>
18 18
19 #include "base/basictypes.h" 19 #include "base/basictypes.h"
20 #include "base/compiler_specific.h" 20 #include "base/compiler_specific.h"
21 #include "base/message_loop.h" 21 #include "base/message_loop.h"
22 #include "base/process_util.h" 22 #include "base/process_util.h"
23 #include "base/scoped_comptr_win.h" 23 #include "base/scoped_comptr_win.h"
24 #include "base/scoped_ptr.h"
25 #include "base/win/registry.h"
24 26
25 #include "chrome_frame/test_utils.h" 27 #include "chrome_frame/test_utils.h"
26 #include "chrome_frame/test/simulate_input.h" 28 #include "chrome_frame/test/simulate_input.h"
27 #include "chrome_frame/utils.h" 29 #include "chrome_frame/utils.h"
28 30
29 // Include without path to make GYP build see it. 31 // Include without path to make GYP build see it.
30 #include "chrome_tab.h" // NOLINT 32 #include "chrome_tab.h" // NOLINT
31 33
32 // Needed for CreateFunctor. 34 // Needed for CreateFunctor.
33 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING 35 #define GMOCK_MUTANT_INCLUDE_LATE_OBJECT_BINDING
(...skipping 136 matching lines...)
170 class CloseIeAtEndOfScope { 172 class CloseIeAtEndOfScope {
171 public: 173 public:
172 CloseIeAtEndOfScope() {} 174 CloseIeAtEndOfScope() {}
173 ~CloseIeAtEndOfScope(); 175 ~CloseIeAtEndOfScope();
174 }; 176 };
175 177
176 // Starts the Chrome crash service which enables us to gather crash dumps 178 // Starts the Chrome crash service which enables us to gather crash dumps
177 // during test runs. 179 // during test runs.
178 base::ProcessHandle StartCrashService(); 180 base::ProcessHandle StartCrashService();
179 181
182 class TempRegKeyOverride {
183 public:
184 static const wchar_t kTempTestKeyPath[];
185
186 TempRegKeyOverride(HKEY override, const wchar_t* temp_name);
187 ~TempRegKeyOverride();
188
189 static void DeleteAllTempKeys();
190
191 protected:
192 HKEY override_;
193 base::win::RegKey temp_key_;
194 std::wstring temp_name_;
195 };
196
197 // Used in tests where we reference the registry and don't want to run into
198 // problems where existing registry settings might conflict with the
199 // expectations of the test.
200 class ScopedVirtualizeHklmAndHkcu {
201 public:
202 ScopedVirtualizeHklmAndHkcu();
203 ~ScopedVirtualizeHklmAndHkcu();
204
205 protected:
206 scoped_ptr<TempRegKeyOverride> hklm_;
207 scoped_ptr<TempRegKeyOverride> hkcu_;
208 };
209
180 } // namespace chrome_frame_test 210 } // namespace chrome_frame_test
181 211
212 // TODO(tommi): This is a temporary workaround while we're getting our
213 // Singleton story straight. Ideally each test should clear up any singletons
214 // it might have created, but test cases do not implicitly have their own
215 // AtExitManager, so we have this workaround method for tests that depend on
216 // "fresh" singletons. The implementation is in chrome_frame_unittest_main.cc.
217 void DeleteAllSingletons();
218
182 #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ 219 #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_
OLDNEW
« no previous file with comments | « chrome_frame/chrome_frame_unittest_main.cc ('k') | chrome_frame/test/chrome_frame_test_utils.cc » ('j') | no next file with comments »

Powered by Google App Engine