summaryrefslogtreecommitdiffstats
path: root/chrome/browser/browser_unittest.cc
diff options
context:
space:
mode:
authorericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 22:04:32 +0000
committerericroman@google.com <ericroman@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-07-15 22:04:32 +0000
commitb59ff376c5d5b950774fcbe65727611d51832b75 (patch)
treea37598ddd4e9ec0530d5820bcce1f47bafa89289 /chrome/browser/browser_unittest.cc
parent89d70652ad0bb9e7f419c17516fad279d8a4db32 (diff)
downloadchromium_src-b59ff376c5d5b950774fcbe65727611d51832b75.zip
chromium_src-b59ff376c5d5b950774fcbe65727611d51832b75.tar.gz
chromium_src-b59ff376c5d5b950774fcbe65727611d51832b75.tar.bz2
Refactorings surrounding HostResolver:
(1) Extract HostResolver to an interface. The existing concrete implementation is now named HostResolverImpl. This makes it possible to create mocks with more complex behavior (i.e. choose via rules if response will be sync vs async). (2) Transform HostMapper into HostResolverProc. Conceptually HostResolverProc maps a hostname to a socket address, whereas HostMapper mapped a hostname to another hostname (so you were still at the mercy of the system's host resolver). With HostResolverProc you can specify the exact AddressList, making it possible to run tests requiring IPv6 socketaddrs on systems (like WinXP) that don't actually support it. (3) Add a MockHostResolver implementation of HostResolver. This replaces the [ScopedHostMapper + RuleBasedHostMapper + HostResolver] combo. It is less clunky and a bit more expressive. BUG=http://crbug.com/16452 R=willchan TEST=existing Review URL: http://codereview.chromium.org/149511 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20795 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser_unittest.cc')
-rw-r--r--chrome/browser/browser_unittest.cc20
1 files changed, 10 insertions, 10 deletions
diff --git a/chrome/browser/browser_unittest.cc b/chrome/browser/browser_unittest.cc
index 1ef86da..702d1dce 100644
--- a/chrome/browser/browser_unittest.cc
+++ b/chrome/browser/browser_unittest.cc
@@ -4,21 +4,21 @@
#include "chrome/browser/browser.h"
#include "chrome/test/in_process_browser_test.h"
-#include "net/base/host_resolver_unittest.h"
+#include "net/base/mock_host_resolver.h"
class BrowserTest : public InProcessBrowserTest {
public:
BrowserTest() {
- host_mapper_ = new net::RuleBasedHostMapper();
+ host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL);
// 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());
+ host_resolver_proc_->AddSimulatedFailure("*.google.com");
+ scoped_host_resolver_proc_.Init(host_resolver_proc_.get());
}
private:
- scoped_refptr<net::RuleBasedHostMapper> host_mapper_;
- net::ScopedHostMapper scoped_host_mapper_;
+ scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_proc_;
+ net::ScopedDefaultHostResolverProc scoped_host_resolver_proc_;
};
/*
@@ -38,7 +38,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NoTabsInPopups) {
// Now try opening another tab in the popup browser.
popup_browser->AddTabWithURL(GURL("about:blank"), GURL(),
PageTransition::TYPED, true, -1, NULL);
-
+
// The popup should still only have one tab.
EXPECT_EQ(1, popup_browser->tab_count());
@@ -54,7 +54,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NoTabsInPopups) {
// Now try opening another tab in the app browser.
app_browser->AddTabWithURL(GURL("about:blank"), GURL(),
PageTransition::TYPED, true, -1, NULL);
-
+
// The popup should still only have one tab.
EXPECT_EQ(1, app_browser->tab_count());
@@ -70,7 +70,7 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NoTabsInPopups) {
// Now try opening another tab in the app popup browser.
app_popup_browser->AddTabWithURL(GURL("about:blank"), GURL(),
PageTransition::TYPED, true, -1, NULL);
-
+
// The popup should still only have one tab.
EXPECT_EQ(1, app_popup_browser->tab_count());
@@ -82,4 +82,4 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, NoTabsInPopups) {
app_browser->CloseAllTabs();
app_popup_browser->CloseAllTabs();
}
-*/ \ No newline at end of file
+*/