Chromium Code Reviews| 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 | 11 |
| 11 #include "base/bind.h" | 12 #include "base/bind.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" |
| (...skipping 29 matching lines...) Expand all Loading... | |
| 49 #include "chrome_frame/test/simulate_input.h" | 50 #include "chrome_frame/test/simulate_input.h" |
| 50 #include "chrome_frame/test/win_event_receiver.h" | 51 #include "chrome_frame/test/win_event_receiver.h" |
| 51 #include "chrome_frame/utils.h" | 52 #include "chrome_frame/utils.h" |
| 52 #include "content/app/content_main.h" | 53 #include "content/app/content_main.h" |
| 53 #include "content/public/app/startup_helper_win.h" | 54 #include "content/public/app/startup_helper_win.h" |
| 54 #include "content/public/browser/browser_thread.h" | 55 #include "content/public/browser/browser_thread.h" |
| 55 #include "content/public/browser/notification_service.h" | 56 #include "content/public/browser/notification_service.h" |
| 56 #include "content/public/browser/render_process_host.h" | 57 #include "content/public/browser/render_process_host.h" |
| 57 #include "content/public/common/content_client.h" | 58 #include "content/public/common/content_client.h" |
| 58 #include "content/public/common/content_paths.h" | 59 #include "content/public/common/content_paths.h" |
| 60 #include "net/url_request/url_request_test_util.h" | |
| 59 #include "sandbox/src/sandbox_types.h" | 61 #include "sandbox/src/sandbox_types.h" |
| 60 #include "testing/gtest/include/gtest/gtest.h" | 62 #include "testing/gtest/include/gtest/gtest.h" |
| 61 #include "ui/base/resource/resource_bundle.h" | 63 #include "ui/base/resource/resource_bundle.h" |
| 62 #include "ui/base/ui_base_paths.h" | 64 #include "ui/base/ui_base_paths.h" |
| 63 | 65 |
| 64 using content::BrowserThread; | 66 using content::BrowserThread; |
| 65 | 67 |
| 66 namespace { | 68 namespace { |
| 67 | 69 |
| 68 // We must store this globally so that our main delegate can set it. | 70 // We must store this globally so that our main delegate can set it. |
| (...skipping 500 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 569 | 571 |
| 570 DCHECK_EQ(test_thread_.IsValid(), false); | 572 DCHECK_EQ(test_thread_.IsValid(), false); |
| 571 test_thread_.Set(::CreateThread(NULL, 0, RunAllUnittests, this, 0, | 573 test_thread_.Set(::CreateThread(NULL, 0, RunAllUnittests, this, 0, |
| 572 &test_thread_id_)); | 574 &test_thread_id_)); |
| 573 DCHECK(test_thread_.IsValid()); | 575 DCHECK(test_thread_.IsValid()); |
| 574 } | 576 } |
| 575 | 577 |
| 576 // static | 578 // static |
| 577 DWORD CFUrlRequestUnittestRunner::RunAllUnittests(void* param) { | 579 DWORD CFUrlRequestUnittestRunner::RunAllUnittests(void* param) { |
| 578 base::PlatformThread::SetName("CFUrlRequestUnittestRunner"); | 580 base::PlatformThread::SetName("CFUrlRequestUnittestRunner"); |
| 581 | |
| 582 char hostname[256]; | |
| 583 struct hostent *host_info = NULL; | |
|
eroman
2012/02/16 02:35:14
style-nit: asterisk goes on left.
| |
| 584 | |
| 585 LOG(ERROR) << "Calling gethostname."; | |
|
eroman
2012/02/16 02:35:14
Please only log to LOG(ERROR) if an error actually
| |
| 586 if (0 != gethostname(hostname, arraysize(hostname))) { | |
| 587 LOG(ERROR) << "Failed to determine the local host name. Tests will be run " | |
| 588 << "over the loopback adapter, which may result in hangs."; | |
|
eroman
2012/02/16 02:35:14
nit: indent by one more.
| |
| 589 | |
| 590 } else { | |
| 591 LOG(ERROR) << "hostname is " << hostname << " ."; | |
| 592 if (NULL == (host_info = gethostbyname(hostname)) || | |
| 593 host_info->h_addrtype != AF_INET || | |
| 594 host_info->h_addr_list[0] == NULL) { | |
| 595 LOG(ERROR) << "Failed to look up addresses for the local host name. Tests " | |
|
eroman
2012/02/16 02:35:14
line longer than 80
| |
| 596 << "will be run over the loopback adapter, which may result in " | |
| 597 << "hangs."; | |
| 598 } else { | |
| 599 std::string host( | |
| 600 inet_ntoa(*reinterpret_cast<in_addr *>(host_info->h_addr_list[0]))); | |
|
eroman
2012/02/16 02:35:14
Are you able to use the net code here? If you are,
| |
| 601 | |
| 602 LOG(ERROR) << "chrome_frame_net_tests URLRequestTestHTTP will execute over " | |
|
eroman
2012/02/16 02:35:14
long line.
| |
| 603 << "host IP address " << host << "."; | |
| 604 | |
| 605 set_url_request_test_http_host(host); | |
| 606 } | |
| 607 } | |
| 608 | |
| 579 CFUrlRequestUnittestRunner* me = | 609 CFUrlRequestUnittestRunner* me = |
| 580 reinterpret_cast<CFUrlRequestUnittestRunner*>(param); | 610 reinterpret_cast<CFUrlRequestUnittestRunner*>(param); |
| 611 | |
| 581 me->test_result_ = me->Run(); | 612 me->test_result_ = me->Run(); |
| 582 BrowserThread::PostTask(BrowserThread::UI, | 613 BrowserThread::PostTask(BrowserThread::UI, |
| 583 FROM_HERE, | 614 FROM_HERE, |
| 584 base::Bind(TakeDownBrowser, me)); | 615 base::Bind(TakeDownBrowser, me)); |
| 585 return 0; | 616 return 0; |
| 586 } | 617 } |
| 587 | 618 |
| 588 // static | 619 // static |
| 589 void CFUrlRequestUnittestRunner::TakeDownBrowser( | 620 void CFUrlRequestUnittestRunner::TakeDownBrowser( |
| 590 CFUrlRequestUnittestRunner* me) { | 621 CFUrlRequestUnittestRunner* me) { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 749 // content::InitializeSandboxInfo(&sandbox_info); | 780 // content::InitializeSandboxInfo(&sandbox_info); |
| 750 FakeMainDelegate delegate; | 781 FakeMainDelegate delegate; |
| 751 content::ContentMain( | 782 content::ContentMain( |
| 752 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)), | 783 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)), |
| 753 &sandbox_info, | 784 &sandbox_info, |
| 754 &delegate); | 785 &delegate); |
| 755 | 786 |
| 756 // Note: In debug builds, we ExitProcess during PostDestroyThreads. | 787 // Note: In debug builds, we ExitProcess during PostDestroyThreads. |
| 757 return g_test_suite->test_result(); | 788 return g_test_suite->test_result(); |
| 758 } | 789 } |
| OLD | NEW |