Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: chrome_frame/test/net/fake_external_tab.cc

Issue 10007043: Attempt to fix ChromeFrameTestWithWebServer tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: move snapshot fn into ui_test_utils_win.cc Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome_frame/test/mock_ie_event_sink_test.cc ('k') | chrome_frame/test/test_with_web_server.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 702 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 if (ie_configurator_.get() != NULL) 713 if (ie_configurator_.get() != NULL)
714 ie_configurator_->RevertSettings(); 714 ie_configurator_->RevertSettings();
715 715
716 if (crash_service_) 716 if (crash_service_)
717 base::KillProcess(crash_service_, 0, false); 717 base::KillProcess(crash_service_, 0, false);
718 718
719 ::ExitProcess(1); 719 ::ExitProcess(1);
720 } 720 }
721 721
722 void CFUrlRequestUnittestRunner::OverrideHttpHost() { 722 void CFUrlRequestUnittestRunner::OverrideHttpHost() {
723 net::NetworkInterfaceList nic_list; 723 override_http_host_.reset(
724 if (!net::GetNetworkList(&nic_list)) { 724 new ScopedCustomUrlRequestTestHttpHost(
725 LOG(ERROR) << "GetNetworkList failed to look up non-loopback adapters. " 725 chrome_frame_test::GetLocalIPv4Address()));
726 << "Tests will be run over the loopback adapter, which may "
727 << "result in hangs.";
728 return;
729 }
730
731 // GetNetworkList only returns 'Up' non-loopback adapters. Select the first
732 // IPV4 address found - we should be able to bind/connect over it.
733 for (size_t i = 0; i < nic_list.size(); ++i) {
734 if (nic_list[i].address.size() != net::kIPv4AddressSize)
735 continue;
736 char* address_string =
737 inet_ntoa(*reinterpret_cast<in_addr*>(&nic_list[i].address[0]));
738 DCHECK(address_string != NULL);
739 if (address_string == NULL)
740 continue;
741 LOG(INFO) << "HTTP tests will run over " << address_string << ".";
742 override_http_host_.reset(
743 new ScopedCustomUrlRequestTestHttpHost(address_string));
744 return;
745 }
746
747 LOG(ERROR) << "Failed to find a non-loopback IP_V4 address. Tests will be "
748 << "run over the loopback adapter, which may result in hangs.";
749 } 726 }
750 727
751 void CFUrlRequestUnittestRunner::PreEarlyInitialization() { 728 void CFUrlRequestUnittestRunner::PreEarlyInitialization() {
752 testing::InitGoogleTest(&g_argc, g_argv); 729 testing::InitGoogleTest(&g_argc, g_argv);
753 FilterDisabledTests(); 730 FilterDisabledTests();
754 StartFileLogger(); 731 StartFileLogger();
755 } 732 }
756 733
757 int CFUrlRequestUnittestRunner::PreCreateThreads() { 734 int CFUrlRequestUnittestRunner::PreCreateThreads() {
758 fake_chrome_.reset(new FakeExternalTab()); 735 fake_chrome_.reset(new FakeExternalTab());
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
913 // content::InitializeSandboxInfo(&sandbox_info); 890 // content::InitializeSandboxInfo(&sandbox_info);
914 FakeMainDelegate delegate; 891 FakeMainDelegate delegate;
915 content::ContentMain( 892 content::ContentMain(
916 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)), 893 reinterpret_cast<HINSTANCE>(GetModuleHandle(NULL)),
917 &sandbox_info, 894 &sandbox_info,
918 &delegate); 895 &delegate);
919 896
920 // Note: In debug builds, we ExitProcess during PostDestroyThreads. 897 // Note: In debug builds, we ExitProcess during PostDestroyThreads.
921 return g_test_suite->test_result(); 898 return g_test_suite->test_result();
922 } 899 }
OLDNEW
« no previous file with comments | « chrome_frame/test/mock_ie_event_sink_test.cc ('k') | chrome_frame/test/test_with_web_server.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698