summaryrefslogtreecommitdiffstats
path: root/net/url_request/url_request_test_util.h
diff options
context:
space:
mode:
authorerikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-22 18:07:07 +0000
committererikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-02-22 18:07:07 +0000
commit1700c6adca76ce8cfc814310f2eb8757dd7118ee (patch)
tree3a26aeef12a9af779f2c69ea011f32e7dfa8b631 /net/url_request/url_request_test_util.h
parent5d0bcd4c8f488e73f2a7fd5f5c79c02803f4bd71 (diff)
downloadchromium_src-1700c6adca76ce8cfc814310f2eb8757dd7118ee.zip
chromium_src-1700c6adca76ce8cfc814310f2eb8757dd7118ee.tar.gz
chromium_src-1700c6adca76ce8cfc814310f2eb8757dd7118ee.tar.bz2
Expose a static configuration value for the host to use for URLRequestTestHTTP tests.
This defaults to 127.0.0.1 but may be modified, affecting all test cases in the URLRequestTestHTTP suite. BUG=114369 TEST=net_unittests still pass. Review URL: http://codereview.chromium.org/9368031 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123057 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/url_request/url_request_test_util.h')
-rw-r--r--net/url_request/url_request_test_util.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/net/url_request/url_request_test_util.h b/net/url_request/url_request_test_util.h
index d6054c0..29ecb98 100644
--- a/net/url_request/url_request_test_util.h
+++ b/net/url_request/url_request_test_util.h
@@ -11,6 +11,7 @@
#include <map>
#include <string>
+#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/path_service.h"
#include "base/process_util.h"
@@ -242,4 +243,29 @@ class TestNetworkDelegate : public net::NetworkDelegate {
std::map<int, std::string> event_order_;
};
+// Overrides the host used by the LocalHttpTestServer in
+// url_request_unittest.cc . This is used by the chrome_frame_net_tests due to
+// a mysterious bug when tests execute over the loopback adapter. See
+// http://crbug.com/114369 .
+class ScopedCustomUrlRequestTestHttpHost {
+ public:
+ // Sets the host name to be used. The previous hostname will be stored and
+ // restored upon destruction. Note that if the lifetimes of two or more
+ // instances of this class overlap, they must be strictly nested.
+ explicit ScopedCustomUrlRequestTestHttpHost(const std::string& new_value);
+
+ ~ScopedCustomUrlRequestTestHttpHost();
+
+ // Returns the current value to be used by HTTP tests in
+ // url_request_unittest.cc .
+ static const std::string& value();
+
+ private:
+ static std::string value_;
+ const std::string old_value_;
+ const std::string new_value_;
+
+ DISALLOW_COPY_AND_ASSIGN(ScopedCustomUrlRequestTestHttpHost);
+};
+
#endif // NET_URL_REQUEST_URL_REQUEST_TEST_UTIL_H_