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

Side by Side Diff: chrome_frame/test/run_all_unittests.cc

Issue 9460019: Reduce flakiness in chrome_frame_tests.exe by having each run in a clean environment. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed compile break Created 8 years, 9 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
« no previous file with comments | « chrome_frame/test/proxy_factory_mock.cc ('k') | chrome_frame/test/test_scrubber.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include <atlbase.h> 5 #include <atlbase.h>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/process_util.h" 8 #include "base/process_util.h"
9 #include "base/test/test_suite.h" 9 #include "base/test/test_suite.h"
10 #include "base/threading/platform_thread.h" 10 #include "base/threading/platform_thread.h"
11 #include "base/win/scoped_com_initializer.h" 11 #include "base/win/scoped_com_initializer.h"
12 #include "chrome/common/chrome_paths.h" 12 #include "chrome/common/chrome_paths.h"
13 #include "chrome_frame/crash_server_init.h" 13 #include "chrome_frame/crash_server_init.h"
14 #include "chrome_frame/test/chrome_frame_test_utils.h" 14 #include "chrome_frame/test/chrome_frame_test_utils.h"
15 #include "chrome_frame/test/chrome_frame_ui_test_utils.h" 15 #include "chrome_frame/test/chrome_frame_ui_test_utils.h"
16 #include "chrome_frame/test/test_scrubber.h"
16 #include "chrome_frame/test_utils.h" 17 #include "chrome_frame/test_utils.h"
17 #include "chrome_frame/utils.h" 18 #include "chrome_frame/utils.h"
18 19
19 // To enable ATL-based code to run in this module 20 // To enable ATL-based code to run in this module
20 class ChromeFrameUnittestsModule 21 class ChromeFrameUnittestsModule
21 : public CAtlExeModuleT<ChromeFrameUnittestsModule> { 22 : public CAtlExeModuleT<ChromeFrameUnittestsModule> {
22 public: 23 public:
23 static HRESULT InitializeCom() { 24 static HRESULT InitializeCom() {
24 // Note that this only gets called in versions of ATL included in 25 // Note that this only gets called in versions of ATL included in
25 // VS2008 and earlier. We still need it however since this gets called 26 // VS2008 and earlier. We still need it however since this gets called
(...skipping 28 matching lines...) Expand all
54 55
55 base::ProcessHandle crash_service = NULL; 56 base::ProcessHandle crash_service = NULL;
56 google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad; 57 google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad;
57 58
58 if (!CommandLine::ForCurrentProcess()->HasSwitch(kNoCrashService)) { 59 if (!CommandLine::ForCurrentProcess()->HasSwitch(kNoCrashService)) {
59 crash_service = chrome_frame_test::StartCrashService(); 60 crash_service = chrome_frame_test::StartCrashService();
60 61
61 breakpad.reset(InitializeCrashReporting(HEADLESS)); 62 breakpad.reset(InitializeCrashReporting(HEADLESS));
62 } 63 }
63 64
65 chrome_frame_test::InstallTestScrubber(testing::UnitTest::GetInstance());
66
64 int ret = -1; 67 int ret = -1;
65 // If mini_installer is used to register CF, we use the switch 68 // If mini_installer is used to register CF, we use the switch
66 // --no-registration to avoid repetitive registration. 69 // --no-registration to avoid repetitive registration.
67 if (CommandLine::ForCurrentProcess()->HasSwitch(kNoRegistrationSwitch)) { 70 if (CommandLine::ForCurrentProcess()->HasSwitch(kNoRegistrationSwitch)) {
68 ret = test_suite.Run(); 71 ret = test_suite.Run();
69 } else { 72 } else {
70 // This will register the chrome frame in the build directory. It currently 73 // This will register the chrome frame in the build directory. It currently
71 // leaves that chrome frame registered once the tests are done. It must be 74 // leaves that chrome frame registered once the tests are done. It must be
72 // constructed AFTER the TestSuite is created since TestSuites create THE 75 // constructed AFTER the TestSuite is created since TestSuites create THE
73 // AtExitManager. 76 // AtExitManager.
74 // TODO(robertshield): Make these tests restore the original registration 77 // TODO(robertshield): Make these tests restore the original registration
75 // once done. 78 // once done.
76 ScopedChromeFrameRegistrar registrar(chrome_frame_test::GetTestBedType()); 79 ScopedChromeFrameRegistrar registrar(chrome_frame_test::GetTestBedType());
77 80
78 // Register IAccessible2 proxy stub DLL, needed for some tests. 81 // Register IAccessible2 proxy stub DLL, needed for some tests.
79 ScopedChromeFrameRegistrar ia2_registrar( 82 ScopedChromeFrameRegistrar ia2_registrar(
80 chrome_frame_test::GetIAccessible2ProxyStubPath().value(), 83 chrome_frame_test::GetIAccessible2ProxyStubPath().value(),
81 ScopedChromeFrameRegistrar::SYSTEM_LEVEL); 84 ScopedChromeFrameRegistrar::SYSTEM_LEVEL);
82 ret = test_suite.Run(); 85 ret = test_suite.Run();
83 } 86 }
84 87
85 DeleteConfigValue(kChromeFrameHeadlessMode); 88 DeleteConfigValue(kChromeFrameHeadlessMode);
86 DeleteConfigValue(kChromeFrameAccessibleMode); 89 DeleteConfigValue(kChromeFrameAccessibleMode);
87 90
88 if (crash_service) 91 if (crash_service)
89 base::KillProcess(crash_service, 0, false); 92 base::KillProcess(crash_service, 0, false);
90 return ret; 93 return ret;
91 } 94 }
OLDNEW
« no previous file with comments | « chrome_frame/test/proxy_factory_mock.cc ('k') | chrome_frame/test/test_scrubber.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698