Don't allow updating tabs to javascript URLs without host
permissions to that tab.
Cleaned up a few things along the way:
- added a GetExtension() method to
ExtensionFunctionDispatcher and ExtensionFunction since it
was used in more than one place.
- Removed first param from chrome.test.failCallback() since
it wasn't used anywhere.
- Added a convenience CanAccessHost() method to Extension,
since it seems likely to be commonly used.
- Refactored setup of mock host resolver in browsertest,
since the way it was, you could only customize it at the
testsuite level, not the test level.
Review URL: http://codereview.chromium.org/199074
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@25971 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/chrome/test/in_process_browser_test.cc b/chrome/test/in_process_browser_test.cc
index af63adbc..d4c26eeb 100644
--- a/chrome/test/in_process_browser_test.cc
+++ b/chrome/test/in_process_browser_test.cc
@@ -30,7 +30,6 @@
#include "chrome/common/notification_type.h"
#include "chrome/test/testing_browser_process.h"
#include "chrome/test/ui_test_utils.h"
-#include "net/base/mock_host_resolver.h"
#include "sandbox/src/dep.h"
extern int BrowserMain(const MainFunctionParams&);
@@ -129,11 +128,18 @@
params.ui_task =
NewRunnableMethod(this, &InProcessBrowserTest::RunTestOnMainThreadLoop);
- scoped_refptr<net::RuleBasedHostResolverProc> host_resolver_proc(
- new net::RuleBasedHostResolverProc(NULL));
- ConfigureHostResolverProc(host_resolver_proc);
+ host_resolver_ = new net::RuleBasedHostResolverProc(NULL);
+
+ // Something inside the browser does this lookup implicitly. Make it fail
+ // to avoid external dependency. It won't break the tests.
+ host_resolver_->AddSimulatedFailure("*.google.com");
+
+ // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol
+ // We don't want the test code to use it.
+ host_resolver_->AddSimulatedFailure("wpad");
+
net::ScopedDefaultHostResolverProc scoped_host_resolver_proc(
- host_resolver_proc);
+ host_resolver_.get());
BrowserMain(params);
}
@@ -235,17 +241,6 @@
http_server_ = NULL;
}
-void InProcessBrowserTest::ConfigureHostResolverProc(
- net::RuleBasedHostResolverProc* host_resolver_proc) {
- // Something inside the browser does this lookup implicitly. Make it fail
- // to avoid external dependency. It won't break the tests.
- host_resolver_proc->AddSimulatedFailure("*.google.com");
-
- // See http://en.wikipedia.org/wiki/Web_Proxy_Autodiscovery_Protocol
- // We don't want the test code to use it.
- host_resolver_proc->AddSimulatedFailure("wpad");
-}
-
void InProcessBrowserTest::TimedOut() {
DCHECK(MessageLoopForUI::current()->IsNested());