| OLD | NEW |
| 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 #include "chrome_frame/test/net/fake_external_tab.h" | 5 #include "chrome_frame/test/net/fake_external_tab.h" |
| 6 | 6 |
| 7 #include <atlbase.h> | 7 #include <atlbase.h> |
| 8 #include <atlcom.h> | 8 #include <atlcom.h> |
| 9 #include <exdisp.h> | 9 #include <exdisp.h> |
| 10 | 10 |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 } | 224 } |
| 225 | 225 |
| 226 FakeExternalTab::~FakeExternalTab() { | 226 FakeExternalTab::~FakeExternalTab() { |
| 227 if (!overridden_user_dir_.empty()) { | 227 if (!overridden_user_dir_.empty()) { |
| 228 PathService::Override(chrome::DIR_USER_DATA, overridden_user_dir_); | 228 PathService::Override(chrome::DIR_USER_DATA, overridden_user_dir_); |
| 229 } | 229 } |
| 230 } | 230 } |
| 231 | 231 |
| 232 void FakeExternalTab::Initialize() { | 232 void FakeExternalTab::Initialize() { |
| 233 DCHECK(g_browser_process == NULL); | 233 DCHECK(g_browser_process == NULL); |
| 234 |
| 235 notificaton_service_.reset(new NotificationService); |
| 236 |
| 234 base::SystemMonitor system_monitor; | 237 base::SystemMonitor system_monitor; |
| 235 | 238 |
| 236 icu_util::Initialize(); | 239 icu_util::Initialize(); |
| 237 TestTimeouts::Initialize(); | 240 TestTimeouts::Initialize(); |
| 238 | 241 |
| 239 // Do not call chrome::RegisterPathProvider() since it is also called by our | 242 // Do not call chrome::RegisterPathProvider() since it is also called by our |
| 240 // test runner, CFUrlRequestUnittestRunner, and calling it twice unfortunately | 243 // test runner, CFUrlRequestUnittestRunner, and calling it twice unfortunately |
| 241 // causes a DCHECK(). | 244 // causes a DCHECK(). |
| 242 content::RegisterPathProvider(); | 245 content::RegisterPathProvider(); |
| 243 ui::RegisterPathProvider(); | 246 ui::RegisterPathProvider(); |
| (...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 base::AtExitManager at_exit_manager; | 556 base::AtExitManager at_exit_manager; |
| 554 CommandLine::Init(argc, argv); | 557 CommandLine::Init(argc, argv); |
| 555 CFUrlRequestUnittestRunner::InitializeLogging(); | 558 CFUrlRequestUnittestRunner::InitializeLogging(); |
| 556 LOG(INFO) << "Not running ChromeFrame net tests on IE9"; | 559 LOG(INFO) << "Not running ChromeFrame net tests on IE9"; |
| 557 return 0; | 560 return 0; |
| 558 } | 561 } |
| 559 | 562 |
| 560 google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad( | 563 google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad( |
| 561 InitializeCrashReporting(HEADLESS)); | 564 InitializeCrashReporting(HEADLESS)); |
| 562 | 565 |
| 563 NotificationService service; | |
| 564 | |
| 565 // TODO(tommi): Stuff be broke. Needs a fixin'. | 566 // TODO(tommi): Stuff be broke. Needs a fixin'. |
| 566 // This is awkward: the TestSuite derived CFUrlRequestUnittestRunner contains | 567 // This is awkward: the TestSuite derived CFUrlRequestUnittestRunner contains |
| 567 // the instance of the AtExitManager that RegisterPathProvider() and others | 568 // the instance of the AtExitManager that RegisterPathProvider() and others |
| 568 // below require. So we have to instantiate this first. | 569 // below require. So we have to instantiate this first. |
| 569 CFUrlRequestUnittestRunner test_suite(argc, argv); | 570 CFUrlRequestUnittestRunner test_suite(argc, argv); |
| 570 | 571 |
| 571 base::ProcessHandle crash_service = chrome_frame_test::StartCrashService(); | 572 base::ProcessHandle crash_service = chrome_frame_test::StartCrashService(); |
| 572 | 573 |
| 573 WindowWatchdog watchdog; | 574 WindowWatchdog watchdog; |
| 574 // See url_request_unittest.cc for these credentials. | 575 // See url_request_unittest.cc for these credentials. |
| 575 SupplyProxyCredentials credentials("user", "secret"); | 576 SupplyProxyCredentials credentials("user", "secret"); |
| 576 watchdog.AddObserver(&credentials, "Windows Security", ""); | 577 watchdog.AddObserver(&credentials, "Windows Security", ""); |
| 577 testing::InitGoogleTest(&argc, argv); | 578 testing::InitGoogleTest(&argc, argv); |
| 578 FilterDisabledTests(); | 579 FilterDisabledTests(); |
| 579 test_suite.RunMainUIThread(); | 580 test_suite.RunMainUIThread(); |
| 580 | 581 |
| 581 if (crash_service) | 582 if (crash_service) |
| 582 base::KillProcess(crash_service, 0, false); | 583 base::KillProcess(crash_service, 0, false); |
| 583 | 584 |
| 584 base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL); | 585 base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL); |
| 585 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); | 586 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); |
| 586 // Avoid CRT cleanup in debug test runs to ensure that webkit ASSERTs which | 587 // Avoid CRT cleanup in debug test runs to ensure that webkit ASSERTs which |
| 587 // check if globals are created and destroyed on the same thread don't fire. | 588 // check if globals are created and destroyed on the same thread don't fire. |
| 588 // Webkit global objects are created on the inproc renderer thread. | 589 // Webkit global objects are created on the inproc renderer thread. |
| 589 #if !defined(NDEBUG) | 590 #if !defined(NDEBUG) |
| 590 ExitProcess(test_suite.test_result()); | 591 ExitProcess(test_suite.test_result()); |
| 591 #endif // NDEBUG | 592 #endif // NDEBUG |
| 592 return test_suite.test_result(); | 593 return test_suite.test_result(); |
| 593 } | 594 } |
| OLD | NEW |