Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(249)

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

Issue 7669061: Tommi: I need an owner review for the chrome frame changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Moved private class declaration down Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <windows.h> 8 #include <windows.h>
9 9
10 #include <atlbase.h> 10 #include <atlbase.h>
11 #include <atlwin.h> 11 #include <atlwin.h>
12 12
13 #include <string> 13 #include <string>
14 14
15 #include "base/basictypes.h" 15 #include "base/basictypes.h"
16 #include "base/compiler_specific.h" 16 #include "base/compiler_specific.h"
17 #include "base/memory/scoped_ptr.h" 17 #include "base/memory/scoped_ptr.h"
18 #include "base/message_loop.h" 18 #include "base/message_loop.h"
19 #include "base/process_util.h" 19 #include "base/process_util.h"
20 #include "base/test/test_reg_util_win.h"
20 #include "base/win/registry.h" 21 #include "base/win/registry.h"
21 #include "base/win/scoped_comptr.h" 22 #include "base/win/scoped_comptr.h"
22 23
23 #include "chrome_frame/test/simulate_input.h" 24 #include "chrome_frame/test/simulate_input.h"
24 #include "chrome_frame/test_utils.h" 25 #include "chrome_frame/test_utils.h"
25 #include "chrome_frame/utils.h" 26 #include "chrome_frame/utils.h"
26 27
27 // Include without path to make GYP build see it. 28 // Include without path to make GYP build see it.
28 #include "chrome_tab.h" // NOLINT 29 #include "chrome_tab.h" // NOLINT
29 30
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 class CloseIeAtEndOfScope { 279 class CloseIeAtEndOfScope {
279 public: 280 public:
280 CloseIeAtEndOfScope() {} 281 CloseIeAtEndOfScope() {}
281 ~CloseIeAtEndOfScope(); 282 ~CloseIeAtEndOfScope();
282 }; 283 };
283 284
284 // Starts the Chrome crash service which enables us to gather crash dumps 285 // Starts the Chrome crash service which enables us to gather crash dumps
285 // during test runs. 286 // during test runs.
286 base::ProcessHandle StartCrashService(); 287 base::ProcessHandle StartCrashService();
287 288
288 class TempRegKeyOverride {
289 public:
290 static const wchar_t kTempTestKeyPath[];
291
292 TempRegKeyOverride(HKEY override, const wchar_t* temp_name);
293 ~TempRegKeyOverride();
294
295 static void DeleteAllTempKeys();
296
297 protected:
298 HKEY override_;
299 base::win::RegKey temp_key_;
300 std::wstring temp_name_;
301 };
302
303 // Used in tests where we reference the registry and don't want to run into 289 // Used in tests where we reference the registry and don't want to run into
304 // problems where existing registry settings might conflict with the 290 // problems where existing registry settings might conflict with the
305 // expectations of the test. 291 // expectations of the test.
306 class ScopedVirtualizeHklmAndHkcu { 292 class ScopedVirtualizeHklmAndHkcu {
307 public: 293 public:
308 ScopedVirtualizeHklmAndHkcu(); 294 ScopedVirtualizeHklmAndHkcu();
309 ~ScopedVirtualizeHklmAndHkcu(); 295 ~ScopedVirtualizeHklmAndHkcu();
310 296
297 // Removes all overrides and deletes all temporary test keys used by the
298 // overrides.
299 void RemoveAllOverrides();
300
311 protected: 301 protected:
312 scoped_ptr<TempRegKeyOverride> hklm_; 302 registry_util::RegistryOverrideManager override_manager_;
313 scoped_ptr<TempRegKeyOverride> hkcu_;
314 }; 303 };
315
tommi (sloooow) - chröme 2011/08/23 20:33:24 empty line removed by accident?
Roger Tawa OOO till Jul 10th 2011/08/23 21:08:02 Oops, fixed.
316 // Attempts to kill all the processes on the current machine that were launched 304 // Attempts to kill all the processes on the current machine that were launched
317 // from the given executable name, ending them with the given exit code. If 305 // from the given executable name, ending them with the given exit code. If
318 // filter is non-null, then only processes selected by the filter are killed. 306 // filter is non-null, then only processes selected by the filter are killed.
319 // Returns true if all processes were able to be killed off, false if at least 307 // Returns true if all processes were able to be killed off, false if at least
320 // one couldn't be killed. 308 // one couldn't be killed.
321 // NOTE: This function is based on the base\process_util.h helper function 309 // NOTE: This function is based on the base\process_util.h helper function
322 // KillProcesses. Takes in the wait flag as a parameter. 310 // KillProcesses. Takes in the wait flag as a parameter.
323 bool KillProcesses(const std::wstring& executable_name, int exit_code, 311 bool KillProcesses(const std::wstring& executable_name, int exit_code,
324 bool wait); 312 bool wait);
325 313
326 // Returns the type of test bed, PER_USER or SYSTEM_LEVEL. 314 // Returns the type of test bed, PER_USER or SYSTEM_LEVEL.
327 ScopedChromeFrameRegistrar::RegistrationType GetTestBedType(); 315 ScopedChromeFrameRegistrar::RegistrationType GetTestBedType();
328 316
329 // Clears IE8 session restore history. 317 // Clears IE8 session restore history.
330 void ClearIESessionHistory(); 318 void ClearIESessionHistory();
331 319
332 } // namespace chrome_frame_test 320 } // namespace chrome_frame_test
333 321
334 // TODO(tommi): This is a temporary workaround while we're getting our 322 // TODO(tommi): This is a temporary workaround while we're getting our
335 // Singleton story straight. Ideally each test should clear up any singletons 323 // Singleton story straight. Ideally each test should clear up any singletons
336 // it might have created, but test cases do not implicitly have their own 324 // it might have created, but test cases do not implicitly have their own
337 // AtExitManager, so we have this workaround method for tests that depend on 325 // AtExitManager, so we have this workaround method for tests that depend on
338 // "fresh" singletons. The implementation is in chrome_frame_unittest_main.cc. 326 // "fresh" singletons. The implementation is in chrome_frame_unittest_main.cc.
339 void DeleteAllSingletons(); 327 void DeleteAllSingletons();
340 328
341 #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_ 329 #endif // CHROME_FRAME_TEST_CHROME_FRAME_TEST_UTILS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698