| OLD | NEW |
| 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 "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 #include <Winsock2.h> | 10 #include <Winsock2.h> |
| (...skipping 651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 g_browser_process->AddRefModule(); | 662 g_browser_process->AddRefModule(); |
| 663 ShutDownHostBrowser(); | 663 ShutDownHostBrowser(); |
| 664 | 664 |
| 665 // In case IE is somehow hung, make sure we don't sit around until a try-bot | 665 // In case IE is somehow hung, make sure we don't sit around until a try-bot |
| 666 // kills us. OnIEShutdownFailure will log and exit with an error. | 666 // kills us. OnIEShutdownFailure will log and exit with an error. |
| 667 BrowserThread::PostDelayedTask( | 667 BrowserThread::PostDelayedTask( |
| 668 BrowserThread::UI, | 668 BrowserThread::UI, |
| 669 FROM_HERE, | 669 FROM_HERE, |
| 670 base::Bind(&CFUrlRequestUnittestRunner::OnIEShutdownFailure, | 670 base::Bind(&CFUrlRequestUnittestRunner::OnIEShutdownFailure, |
| 671 base::Unretained(this)), | 671 base::Unretained(this)), |
| 672 TestTimeouts::action_max_timeout_ms()); | 672 TestTimeouts::action_max_timeout()); |
| 673 } | 673 } |
| 674 | 674 |
| 675 void CFUrlRequestUnittestRunner::InitializeLogging() { | 675 void CFUrlRequestUnittestRunner::InitializeLogging() { |
| 676 FilePath exe; | 676 FilePath exe; |
| 677 PathService::Get(base::FILE_EXE, &exe); | 677 PathService::Get(base::FILE_EXE, &exe); |
| 678 FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log")); | 678 FilePath log_filename = exe.ReplaceExtension(FILE_PATH_LITERAL("log")); |
| 679 logging::InitLogging( | 679 logging::InitLogging( |
| 680 log_filename.value().c_str(), | 680 log_filename.value().c_str(), |
| 681 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, | 681 logging::LOG_TO_BOTH_FILE_AND_SYSTEM_DEBUG_LOG, |
| 682 logging::LOCK_LOG_FILE, | 682 logging::LOCK_LOG_FILE, |
| 683 logging::DELETE_OLD_LOG_FILE, | 683 logging::DELETE_OLD_LOG_FILE, |
| 684 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); | 684 logging::DISABLE_DCHECK_FOR_NON_OFFICIAL_RELEASE_BUILDS); |
| 685 // We want process and thread IDs because we may have multiple processes. | 685 // We want process and thread IDs because we may have multiple processes. |
| 686 // Note: temporarily enabled timestamps in an effort to catch bug 6361. | 686 // Note: temporarily enabled timestamps in an effort to catch bug 6361. |
| 687 logging::SetLogItems(true, true, true, true); | 687 logging::SetLogItems(true, true, true, true); |
| 688 } | 688 } |
| 689 | 689 |
| 690 void CFUrlRequestUnittestRunner::CancelInitializationTimeout() { | 690 void CFUrlRequestUnittestRunner::CancelInitializationTimeout() { |
| 691 timeout_closure_.Cancel(); | 691 timeout_closure_.Cancel(); |
| 692 } | 692 } |
| 693 | 693 |
| 694 void CFUrlRequestUnittestRunner::StartInitializationTimeout() { | 694 void CFUrlRequestUnittestRunner::StartInitializationTimeout() { |
| 695 timeout_closure_.Reset( | 695 timeout_closure_.Reset( |
| 696 base::Bind(&CFUrlRequestUnittestRunner::OnInitializationTimeout, | 696 base::Bind(&CFUrlRequestUnittestRunner::OnInitializationTimeout, |
| 697 base::Unretained(this))); | 697 base::Unretained(this))); |
| 698 MessageLoop::current()->PostDelayedTask( | 698 MessageLoop::current()->PostDelayedTask( |
| 699 FROM_HERE, | 699 FROM_HERE, |
| 700 timeout_closure_.callback(), | 700 timeout_closure_.callback(), |
| 701 TestTimeouts::action_max_timeout_ms()); | 701 TestTimeouts::action_max_timeout()); |
| 702 } | 702 } |
| 703 | 703 |
| 704 void CFUrlRequestUnittestRunner::OnInitializationTimeout() { | 704 void CFUrlRequestUnittestRunner::OnInitializationTimeout() { |
| 705 LOG(ERROR) << "Failed to start Chrome Frame in the host browser."; | 705 LOG(ERROR) << "Failed to start Chrome Frame in the host browser."; |
| 706 StopFileLogger(true); | 706 StopFileLogger(true); |
| 707 | 707 |
| 708 if (launch_browser_) { | 708 if (launch_browser_) { |
| 709 base::win::ScopedCOMInitializer com; | 709 base::win::ScopedCOMInitializer com; |
| 710 chrome_frame_test::CloseAllIEWindows(); | 710 chrome_frame_test::CloseAllIEWindows(); |
| 711 } | 711 } |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 890 // content::InitializeSandboxInfo(&sandbox_info); | 890 // content::InitializeSandboxInfo(&sandbox_info); |
| 891 FakeMainDelegate delegate; | 891 FakeMainDelegate delegate; |
| 892 content::ContentMain( | 892 content::ContentMain( |
| 893 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)), | 893 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)), |
| 894 &sandbox_info, | 894 &sandbox_info, |
| 895 &delegate); | 895 &delegate); |
| 896 | 896 |
| 897 // Note: In debug builds, we ExitProcess during PostDestroyThreads. | 897 // Note: In debug builds, we ExitProcess during PostDestroyThreads. |
| 898 return g_test_suite->test_result(); | 898 return g_test_suite->test_result(); |
| 899 } | 899 } |
| OLD | NEW |