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

Side by Side Diff: chrome/browser/prerender/prerender_browsertest.cc

Issue 2851103002: Update some host_resolver()->AddRules in chrome/browser. (Closed)
Patch Set: fix Created 3 years, 7 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
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 <stddef.h> 5 #include <stddef.h>
6 #include <deque> 6 #include <deque>
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 #include <unordered_map> 9 #include <unordered_map>
10 #include <utility> 10 #include <utility>
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 int expected_number_of_loads) { 591 int expected_number_of_loads) {
592 GURL url = src_server()->GetURL(MakeAbsolute(html_file)); 592 GURL url = src_server()->GetURL(MakeAbsolute(html_file));
593 return PrerenderTestURLImpl(url, expected_final_status_queue, 593 return PrerenderTestURLImpl(url, expected_final_status_queue,
594 expected_number_of_loads); 594 expected_number_of_loads);
595 } 595 }
596 596
597 void SetUpOnMainThread() override { 597 void SetUpOnMainThread() override {
598 test_utils::PrerenderInProcessBrowserTest::SetUpOnMainThread(); 598 test_utils::PrerenderInProcessBrowserTest::SetUpOnMainThread();
599 prerender::PrerenderManager::SetMode( 599 prerender::PrerenderManager::SetMode(
600 prerender::PrerenderManager::PRERENDER_MODE_ENABLED); 600 prerender::PrerenderManager::PRERENDER_MODE_ENABLED);
601 const testing::TestInfo* const test_info =
602 testing::UnitTest::GetInstance()->current_test_info();
603 // This one test fails with the host resolver redirecting all hosts.
604 if (std::string(test_info->name()) != "PrerenderServerRedirectInIframe")
605 host_resolver()->AddRule("*", "127.0.0.1");
601 } 606 }
602 607
603 void SetUpInProcessBrowserTestFixture() override { 608 void SetUpInProcessBrowserTestFixture() override {
604 test_utils::PrerenderInProcessBrowserTest:: 609 test_utils::PrerenderInProcessBrowserTest::
605 SetUpInProcessBrowserTestFixture(); 610 SetUpInProcessBrowserTestFixture();
606 611
607 // Although PreferHtmlOverPlugins is redundant with the Field Trial testing 612 // Although PreferHtmlOverPlugins is redundant with the Field Trial testing
608 // configuration, the official builders don't use those, so enable it here. 613 // configuration, the official builders don't use those, so enable it here.
609 feature_list_.InitAndEnableFeature(features::kPreferHtmlOverPlugins); 614 feature_list_.InitAndEnableFeature(features::kPreferHtmlOverPlugins);
610 } 615 }
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 if (!prerender_dict) 836 if (!prerender_dict)
832 return std::numeric_limits<size_t>::max(); 837 return std::numeric_limits<size_t>::max();
833 base::ListValue* history_list; 838 base::ListValue* history_list;
834 if (!prerender_dict->GetList("history", &history_list)) 839 if (!prerender_dict->GetList("history", &history_list))
835 return std::numeric_limits<size_t>::max(); 840 return std::numeric_limits<size_t>::max();
836 return history_list->GetSize(); 841 return history_list->GetSize();
837 } 842 }
838 843
839 void SetLoaderHostOverride(const std::string& host) { 844 void SetLoaderHostOverride(const std::string& host) {
840 loader_host_override_ = host; 845 loader_host_override_ = host;
841 host_resolver()->AddRule(host, "127.0.0.1");
842 } 846 }
843 847
844 void set_loader_path(const std::string& path) { 848 void set_loader_path(const std::string& path) {
845 loader_path_ = path; 849 loader_path_ = path;
846 } 850 }
847 851
848 void set_loader_query(const std::string& query) { 852 void set_loader_query(const std::string& query) {
849 loader_query_ = query; 853 loader_query_ = query;
850 } 854 }
851 855
852 GURL GetCrossDomainTestUrl(const std::string& path) { 856 GURL GetCrossDomainTestUrl(const std::string& path) {
853 static const std::string secondary_domain = "www.foo.com"; 857 static const std::string secondary_domain = "www.foo.com";
854 host_resolver()->AddRule(secondary_domain, "127.0.0.1");
855 std::string url_str(base::StringPrintf( 858 std::string url_str(base::StringPrintf(
856 "http://%s:%d/%s", secondary_domain.c_str(), 859 "http://%s:%d/%s", secondary_domain.c_str(),
857 embedded_test_server()->host_port_pair().port(), path.c_str())); 860 embedded_test_server()->host_port_pair().port(), path.c_str()));
858 return GURL(url_str); 861 return GURL(url_str);
859 } 862 }
860 863
861 const GURL& dest_url() const { 864 const GURL& dest_url() const {
862 return dest_url_; 865 return dest_url_;
863 } 866 }
864 867
(...skipping 3053 matching lines...) Expand 10 before | Expand all | Expand 10 after
3918 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents, 3921 ASSERT_TRUE(content::ExecuteScriptAndExtractBool(web_contents,
3919 "DidDisplayReallyPass()", 3922 "DidDisplayReallyPass()",
3920 &display_test_result)); 3923 &display_test_result));
3921 ASSERT_TRUE(display_test_result); 3924 ASSERT_TRUE(display_test_result);
3922 } 3925 }
3923 #endif // !defined(DISABLE_NACL) 3926 #endif // !defined(DISABLE_NACL)
3924 3927
3925 } // namespace prerender 3928 } // namespace prerender
3926 3929
3927 #endif // !defined(OS_MACOSX) || !defined(ADDRESS_SANITIZER) 3930 #endif // !defined(OS_MACOSX) || !defined(ADDRESS_SANITIZER)
OLDNEW
« no previous file with comments | « chrome/browser/pdf/pdf_extension_test.cc ('k') | chrome/browser/prerender/prerender_nostate_prefetch_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698