Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / chrome / test / chromedriver / net / net_util.h
blobaec07f02571b877fd37513373e6538e06b8c8050
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_TEST_CHROMEDRIVER_NET_NET_UTIL_H_
6 #define CHROME_TEST_CHROMEDRIVER_NET_NET_UTIL_H_
8 #include <string>
10 class URLRequestContextGetter;
12 class NetAddress {
13 public:
14 NetAddress(); // Creates an invalid address.
15 explicit NetAddress(int port); // Host is set to 127.0.0.1.
16 NetAddress(const std::string& host, int port);
17 ~NetAddress();
19 bool IsValid() const;
21 // Returns host:port.
22 std::string ToString() const;
24 const std::string& host() const;
25 int port() const;
27 private:
28 std::string host_;
29 int port_;
32 // Synchronously fetches data from a GET HTTP request to the given URL.
33 // Returns true if response is 200 OK and sets response body to |response|.
34 bool FetchUrl(const std::string& url,
35 URLRequestContextGetter* getter,
36 std::string* response);
38 #endif // CHROME_TEST_CHROMEDRIVER_NET_NET_UTIL_H_