| 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 |
| 11 #include "app/app_paths.h" | 11 #include "app/app_paths.h" |
| 12 #include "app/win/scoped_com_initializer.h" |
| 12 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 13 #include "base/debug/debugger.h" | 14 #include "base/debug/debugger.h" |
| 14 #include "base/file_util.h" | 15 #include "base/file_util.h" |
| 15 #include "base/file_version_info.h" | 16 #include "base/file_version_info.h" |
| 16 #include "base/i18n/icu_util.h" | 17 #include "base/i18n/icu_util.h" |
| 17 #include "base/lazy_instance.h" | 18 #include "base/lazy_instance.h" |
| 18 #include "base/memory/scoped_ptr.h" | 19 #include "base/memory/scoped_ptr.h" |
| 19 #include "base/path_service.h" | 20 #include "base/path_service.h" |
| 20 #include "base/string_util.h" | 21 #include "base/string_util.h" |
| 21 #include "base/stringprintf.h" | 22 #include "base/stringprintf.h" |
| 22 #include "base/system_monitor/system_monitor.h" | 23 #include "base/system_monitor/system_monitor.h" |
| 23 #include "base/test/test_timeouts.h" | 24 #include "base/test/test_timeouts.h" |
| 24 #include "base/threading/platform_thread.h" | 25 #include "base/threading/platform_thread.h" |
| 25 #include "base/win/scoped_com_initializer.h" | |
| 26 #include "base/win/scoped_comptr.h" | 26 #include "base/win/scoped_comptr.h" |
| 27 #include "base/win/scoped_handle.h" | 27 #include "base/win/scoped_handle.h" |
| 28 #include "chrome/browser/automation/automation_provider_list.h" | 28 #include "chrome/browser/automation/automation_provider_list.h" |
| 29 #include "chrome/browser/chrome_content_browser_client.h" | 29 #include "chrome/browser/chrome_content_browser_client.h" |
| 30 #include "chrome/browser/prefs/browser_prefs.h" | 30 #include "chrome/browser/prefs/browser_prefs.h" |
| 31 #include "chrome/browser/prefs/pref_service.h" | 31 #include "chrome/browser/prefs/pref_service.h" |
| 32 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 32 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
| 33 #include "chrome/browser/process_singleton.h" | 33 #include "chrome/browser/process_singleton.h" |
| 34 #include "chrome/browser/profiles/profile_manager.h" | 34 #include "chrome/browser/profiles/profile_manager.h" |
| 35 #include "chrome/browser/renderer_host/web_cache_manager.h" | 35 #include "chrome/browser/renderer_host/web_cache_manager.h" |
| (...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 } | 304 } |
| 305 | 305 |
| 306 CFUrlRequestUnittestRunner::~CFUrlRequestUnittestRunner() { | 306 CFUrlRequestUnittestRunner::~CFUrlRequestUnittestRunner() { |
| 307 fake_chrome_.Shutdown(); | 307 fake_chrome_.Shutdown(); |
| 308 } | 308 } |
| 309 | 309 |
| 310 void CFUrlRequestUnittestRunner::StartChromeFrameInHostBrowser() { | 310 void CFUrlRequestUnittestRunner::StartChromeFrameInHostBrowser() { |
| 311 if (!ShouldLaunchBrowser()) | 311 if (!ShouldLaunchBrowser()) |
| 312 return; | 312 return; |
| 313 | 313 |
| 314 base::win::ScopedCOMInitializer com; | 314 app::win::ScopedCOMInitializer com; |
| 315 chrome_frame_test::CloseAllIEWindows(); | 315 chrome_frame_test::CloseAllIEWindows(); |
| 316 | 316 |
| 317 test_http_server_.reset(new test_server::SimpleWebServer(kTestServerPort)); | 317 test_http_server_.reset(new test_server::SimpleWebServer(kTestServerPort)); |
| 318 test_http_server_->AddResponse(&chrome_frame_html_); | 318 test_http_server_->AddResponse(&chrome_frame_html_); |
| 319 std::wstring url(base::StringPrintf(L"http://localhost:%i/chrome_frame", | 319 std::wstring url(base::StringPrintf(L"http://localhost:%i/chrome_frame", |
| 320 kTestServerPort).c_str()); | 320 kTestServerPort).c_str()); |
| 321 | 321 |
| 322 // Launch IE. This launches IE correctly on Vista too. | 322 // Launch IE. This launches IE correctly on Vista too. |
| 323 base::win::ScopedHandle ie_process(chrome_frame_test::LaunchIE(url)); | 323 base::win::ScopedHandle ie_process(chrome_frame_test::LaunchIE(url)); |
| 324 EXPECT_TRUE(ie_process.IsValid()); | 324 EXPECT_TRUE(ie_process.IsValid()); |
| 325 | 325 |
| 326 // NOTE: If you're running IE8 and CF is not being loaded, you need to | 326 // NOTE: If you're running IE8 and CF is not being loaded, you need to |
| 327 // disable IE8's prebinding until CF properly handles that situation. | 327 // disable IE8's prebinding until CF properly handles that situation. |
| 328 // | 328 // |
| 329 // HKCU\Software\Microsoft\Internet Explorer\Main | 329 // HKCU\Software\Microsoft\Internet Explorer\Main |
| 330 // Value name: EnablePreBinding (REG_DWORD) | 330 // Value name: EnablePreBinding (REG_DWORD) |
| 331 // Value: 0 | 331 // Value: 0 |
| 332 } | 332 } |
| 333 | 333 |
| 334 void CFUrlRequestUnittestRunner::ShutDownHostBrowser() { | 334 void CFUrlRequestUnittestRunner::ShutDownHostBrowser() { |
| 335 if (ShouldLaunchBrowser()) { | 335 if (ShouldLaunchBrowser()) { |
| 336 base::win::ScopedCOMInitializer com; | 336 app::win::ScopedCOMInitializer com; |
| 337 chrome_frame_test::CloseAllIEWindows(); | 337 chrome_frame_test::CloseAllIEWindows(); |
| 338 } | 338 } |
| 339 } | 339 } |
| 340 | 340 |
| 341 // Override virtual void Initialize to not call icu initialize | 341 // Override virtual void Initialize to not call icu initialize |
| 342 void CFUrlRequestUnittestRunner::Initialize() { | 342 void CFUrlRequestUnittestRunner::Initialize() { |
| 343 DCHECK(::GetCurrentThreadId() == test_thread_id_); | 343 DCHECK(::GetCurrentThreadId() == test_thread_id_); |
| 344 | 344 |
| 345 // Start by replicating some of the steps that would otherwise be | 345 // Start by replicating some of the steps that would otherwise be |
| 346 // done by TestSuite::Initialize. We can't call the base class | 346 // done by TestSuite::Initialize. We can't call the base class |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 FilterDisabledTests(); | 571 FilterDisabledTests(); |
| 572 test_suite.RunMainUIThread(); | 572 test_suite.RunMainUIThread(); |
| 573 | 573 |
| 574 if (crash_service) | 574 if (crash_service) |
| 575 base::KillProcess(crash_service, 0, false); | 575 base::KillProcess(crash_service, 0, false); |
| 576 | 576 |
| 577 base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL); | 577 base::KillProcesses(chrome_frame_test::kIEImageName, 0, NULL); |
| 578 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); | 578 base::KillProcesses(chrome_frame_test::kIEBrokerImageName, 0, NULL); |
| 579 return test_suite.test_result(); | 579 return test_suite.test_result(); |
| 580 } | 580 } |
| OLD | NEW |