diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-03 05:14:19 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-03 05:14:19 +0000 |
commit | 13324ed091df492d73310f69b377ee3d52befedc (patch) | |
tree | ef05732c07f41d299c5a002cf2b3b983401b69cb /chrome | |
parent | f5ecbba1f92417edf8759d93904e12cfe9a2d0b4 (diff) | |
download | chromium_src-13324ed091df492d73310f69b377ee3d52befedc.zip chromium_src-13324ed091df492d73310f69b377ee3d52befedc.tar.gz chromium_src-13324ed091df492d73310f69b377ee3d52befedc.tar.bz2 |
Move code to allow dns queries (and accompanying
TODO) from each in-process ui test into the base
class, since it is really the base class that is
initiating these queries (by way of starting the
browser).
Review URL: http://codereview.chromium.org/56173
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@13069 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser_focus_uitest.cc | 11 | ||||
-rwxr-xr-x | chrome/browser/extensions/extension_view_unittest.cc | 13 | ||||
-rw-r--r-- | chrome/browser/views/find_bar_win_unittest.cc | 14 | ||||
-rw-r--r-- | chrome/test/in_process_browser_test.cc | 9 |
4 files changed, 9 insertions, 38 deletions
diff --git a/chrome/browser/browser_focus_uitest.cc b/chrome/browser/browser_focus_uitest.cc index 58b56cd..70b9a2a 100644 --- a/chrome/browser/browser_focus_uitest.cc +++ b/chrome/browser/browser_focus_uitest.cc @@ -21,7 +21,6 @@ #include "chrome/views/window/window.h" #include "chrome/test/in_process_browser_test.h" #include "chrome/test/ui_test_utils.h" -#include "net/base/host_resolver_unittest.h" namespace { @@ -36,19 +35,9 @@ const wchar_t kTypicalPage[] = L"files/focus/typical_page.html"; class BrowserFocusTest : public InProcessBrowserTest { public: BrowserFocusTest() { - host_mapper_ = new net::RuleBasedHostMapper(); - // TODO(phajdan.jr): Don't make a real dns lookup here. - // page_with_focus.html has a reference to google.com. - host_mapper_->AllowDirectLookup("*.google.com"); - scoped_host_mapper_.Init(host_mapper_.get()); - set_show_window(true); EnableDOMAutomation(); } - -private: - scoped_refptr<net::RuleBasedHostMapper> host_mapper_; - net::ScopedHostMapper scoped_host_mapper_; }; class JavaScriptRunner : public NotificationObserver { diff --git a/chrome/browser/extensions/extension_view_unittest.cc b/chrome/browser/extensions/extension_view_unittest.cc index 3eb614f..4cdb91c 100755 --- a/chrome/browser/extensions/extension_view_unittest.cc +++ b/chrome/browser/extensions/extension_view_unittest.cc @@ -14,7 +14,6 @@ #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" namespace { @@ -101,14 +100,6 @@ class ExtensionLoadedObserver : public NotificationObserver { class ExtensionViewTest : public InProcessBrowserTest { public: - ExtensionViewTest() { - host_mapper_ = new net::RuleBasedHostMapper(); - // TODO(aa): Don't make a real dns lookup here or simulate a failing lookup. - // But if it's really needed then remove the TODO. - host_mapper_->AllowDirectLookup("*.google.com"); - scoped_host_mapper_.Init(host_mapper_.get()); - } - virtual void SetUp() { // Initialize the error reporter here, otherwise BrowserMain will create it // with the wrong MessageLoop. @@ -119,10 +110,6 @@ class ExtensionViewTest : public InProcessBrowserTest { InProcessBrowserTest::SetUp(); } - - private: - scoped_refptr<net::RuleBasedHostMapper> host_mapper_; - net::ScopedHostMapper scoped_host_mapper_; }; // Tests that ExtensionView starts an extension process and runs the script diff --git a/chrome/browser/views/find_bar_win_unittest.cc b/chrome/browser/views/find_bar_win_unittest.cc index f2d2f74..097e4f3 100644 --- a/chrome/browser/views/find_bar_win_unittest.cc +++ b/chrome/browser/views/find_bar_win_unittest.cc @@ -13,7 +13,6 @@ #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,15 +78,6 @@ typedef enum FindInPageDirection { BACK = 0, FWD = 1 }; typedef enum FindInPageCase { IGNORE_CASE = 0, CASE_SENSITIVE = 1 }; class FindInPageControllerTest : public InProcessBrowserTest { - public: - 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, FindInPageDirection forward, @@ -106,10 +96,6 @@ 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 diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc index 3768a75..e3c064d 100644 --- a/chrome/test/in_process_browser_test.cc +++ b/chrome/test/in_process_browser_test.cc @@ -20,6 +20,7 @@ #include "chrome/common/main_function_params.h" #include "chrome/test/testing_browser_process.h" #include "chrome/test/ui_test_utils.h" +#include "net/base/host_resolver_unittest.h" #include "sandbox/src/sandbox_factory.h" #include "sandbox/src/dep.h" @@ -110,6 +111,14 @@ void InProcessBrowserTest::SetUp() { MainFunctionParams params(*command_line, sandbox_wrapper, NULL); params.ui_task = NewRunnableMethod(this, &InProcessBrowserTest::RunTestOnMainThreadLoop); + + // TODO(sky): Don't make a real dns lookup here or simulate a failing + // lookup. But if it's really needed then remove the TODO. + scoped_refptr<net::RuleBasedHostMapper> host_mapper( + new net::RuleBasedHostMapper()); + host_mapper->AllowDirectLookup("*.google.com"); + net::ScopedHostMapper scoped_host_mapper; + scoped_host_mapper.Init(host_mapper.get()); BrowserMain(params); } |