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

Unified Diff: chrome/browser/extensions/extension_view_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 | « no previous file | chrome/browser/net/dns_master_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_view_unittest.cc
diff --git a/chrome/browser/extensions/extension_view_unittest.cc b/chrome/browser/extensions/extension_view_unittest.cc
index bc17d4cda4c4cf43785b3211c86d70548d5f81a2..3eb614f3c4f5c50b87fd969b99ac91f01f058ba9 100755
--- a/chrome/browser/extensions/extension_view_unittest.cc
+++ b/chrome/browser/extensions/extension_view_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/message_loop.h"
+#include "base/ref_counted.h"
#include "chrome/browser/browser.h"
#include "chrome/browser/renderer_host/render_view_host.h"
#include "chrome/browser/profile.h"
@@ -13,6 +14,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"
namespace {
@@ -99,6 +101,14 @@ 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.
@@ -109,6 +119,10 @@ 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
« no previous file with comments | « no previous file | chrome/browser/net/dns_master_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698