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

Unified Diff: chrome/browser/views/find_bar_win_unittest.cc

Issue 45026: Prevent making real DNS lookups by chrome tests. (Closed)
Patch Set: simplified Created 11 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/net/dns_master_unittest.cc ('k') | chrome/test/unit/chrome_test_suite.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/views/find_bar_win_unittest.cc
diff --git a/chrome/browser/views/find_bar_win_unittest.cc b/chrome/browser/views/find_bar_win_unittest.cc
index 4ef345c6593f93aa8d8d1961dcf53434703f3da6..f2d2f744b584c629e0e0b76aa974632c9c132343 100644
--- a/chrome/browser/views/find_bar_win_unittest.cc
+++ b/chrome/browser/views/find_bar_win_unittest.cc
@@ -13,6 +13,7 @@
#include "chrome/common/notification_service.h"
#include "chrome/test/in_process_browser_test.h"
#include "chrome/test/ui_test_utils.h"
+#include "net/base/host_resolver_unittest.h"
const std::wstring kFramePage = L"files/find_in_page/frames.html";
const std::wstring kFrameData = L"files/find_in_page/framedata_general.html";
@@ -79,7 +80,13 @@ typedef enum FindInPageCase { IGNORE_CASE = 0, CASE_SENSITIVE = 1 };
class FindInPageControllerTest : public InProcessBrowserTest {
public:
- FindInPageControllerTest() {}
+ FindInPageControllerTest() {
+ host_mapper_ = new net::RuleBasedHostMapper();
+ // Avoid making external DNS lookups. In this test we don't need this
+ // to succeed.
+ host_mapper_->AddSimulatedFailure("*.google.com");
+ scoped_host_mapper_.Init(host_mapper_.get());
+ }
protected:
int FindInPage(const std::wstring& search_string,
@@ -99,6 +106,10 @@ class FindInPageControllerTest : public InProcessBrowserTest {
}
return 0;
}
+
+ private:
+ scoped_refptr<net::RuleBasedHostMapper> host_mapper_;
+ net::ScopedHostMapper scoped_host_mapper_;
};
// This test loads a page with frames and starts FindInPage requests
« no previous file with comments | « chrome/browser/net/dns_master_unittest.cc ('k') | chrome/test/unit/chrome_test_suite.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698