| OLD | NEW |
| 1 // Copyright (c) 2010 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 #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 "chrome/common/chrome_paths.h" | 11 #include "chrome/common/chrome_paths.h" |
| 12 #include "chrome_frame/crash_server_init.h" |
| 12 #include "chrome_frame/test/chrome_frame_test_utils.h" | 13 #include "chrome_frame/test/chrome_frame_test_utils.h" |
| 13 #include "chrome_frame/test/chrome_frame_ui_test_utils.h" | 14 #include "chrome_frame/test/chrome_frame_ui_test_utils.h" |
| 14 #include "chrome_frame/test_utils.h" | 15 #include "chrome_frame/test_utils.h" |
| 15 #include "chrome_frame/utils.h" | 16 #include "chrome_frame/utils.h" |
| 16 | 17 |
| 17 // To enable ATL-based code to run in this module | 18 // To enable ATL-based code to run in this module |
| 18 class ChromeFrameUnittestsModule | 19 class ChromeFrameUnittestsModule |
| 19 : public CAtlExeModuleT<ChromeFrameUnittestsModule> { | 20 : public CAtlExeModuleT<ChromeFrameUnittestsModule> { |
| 20 public: | 21 public: |
| 21 static HRESULT InitializeCom() { | 22 static HRESULT InitializeCom() { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 36 base::PlatformThread::SetName("ChromeFrame tests"); | 37 base::PlatformThread::SetName("ChromeFrame tests"); |
| 37 | 38 |
| 38 _set_purecall_handler(PureCall); | 39 _set_purecall_handler(PureCall); |
| 39 | 40 |
| 40 base::TestSuite test_suite(argc, argv); | 41 base::TestSuite test_suite(argc, argv); |
| 41 | 42 |
| 42 SetConfigBool(kChromeFrameHeadlessMode, true); | 43 SetConfigBool(kChromeFrameHeadlessMode, true); |
| 43 SetConfigBool(kChromeFrameAccessibleMode, true); | 44 SetConfigBool(kChromeFrameAccessibleMode, true); |
| 44 | 45 |
| 45 base::ProcessHandle crash_service = chrome_frame_test::StartCrashService(); | 46 base::ProcessHandle crash_service = chrome_frame_test::StartCrashService(); |
| 47 |
| 48 google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad( |
| 49 InitializeCrashReporting(HEADLESS)); |
| 50 |
| 46 int ret = -1; | 51 int ret = -1; |
| 47 // If mini_installer is used to register CF, we use the switch | 52 // If mini_installer is used to register CF, we use the switch |
| 48 // --no-registration to avoid repetitive registration. | 53 // --no-registration to avoid repetitive registration. |
| 49 if (CommandLine::ForCurrentProcess()->HasSwitch(kNoRegistrationSwitch)) { | 54 if (CommandLine::ForCurrentProcess()->HasSwitch(kNoRegistrationSwitch)) { |
| 50 ret = test_suite.Run(); | 55 ret = test_suite.Run(); |
| 51 } else { | 56 } else { |
| 52 // This will register the chrome frame in the build directory. It currently | 57 // This will register the chrome frame in the build directory. It currently |
| 53 // leaves that chrome frame registered once the tests are done. It must be | 58 // leaves that chrome frame registered once the tests are done. It must be |
| 54 // constructed AFTER the TestSuite is created since TestSuites create THE | 59 // constructed AFTER the TestSuite is created since TestSuites create THE |
| 55 // AtExitManager. | 60 // AtExitManager. |
| 56 // TODO(robertshield): Make these tests restore the original registration | 61 // TODO(robertshield): Make these tests restore the original registration |
| 57 // once done. | 62 // once done. |
| 58 ScopedChromeFrameRegistrar registrar(chrome_frame_test::GetTestBedType()); | 63 ScopedChromeFrameRegistrar registrar(chrome_frame_test::GetTestBedType()); |
| 59 | 64 |
| 60 // Register IAccessible2 proxy stub DLL, needed for some tests. | 65 // Register IAccessible2 proxy stub DLL, needed for some tests. |
| 61 ScopedChromeFrameRegistrar ia2_registrar( | 66 ScopedChromeFrameRegistrar ia2_registrar( |
| 62 chrome_frame_test::GetIAccessible2ProxyStubPath().value(), | 67 chrome_frame_test::GetIAccessible2ProxyStubPath().value(), |
| 63 ScopedChromeFrameRegistrar::SYSTEM_LEVEL); | 68 ScopedChromeFrameRegistrar::SYSTEM_LEVEL); |
| 64 ret = test_suite.Run(); | 69 ret = test_suite.Run(); |
| 65 } | 70 } |
| 66 | 71 |
| 67 DeleteConfigValue(kChromeFrameHeadlessMode); | 72 DeleteConfigValue(kChromeFrameHeadlessMode); |
| 68 DeleteConfigValue(kChromeFrameAccessibleMode); | 73 DeleteConfigValue(kChromeFrameAccessibleMode); |
| 69 | 74 |
| 70 if (crash_service) | 75 if (crash_service) |
| 71 base::KillProcess(crash_service, 0, false); | 76 base::KillProcess(crash_service, 0, false); |
| 72 return ret; | 77 return ret; |
| 73 } | 78 } |
| OLD | NEW |