| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/captive_portal/testing_utils.h" | 5 #include "components/captive_portal/captive_portal_testing_utils.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "net/http/http_response_headers.h" | 10 #include "net/http/http_response_headers.h" |
| 11 #include "net/http/http_util.h" | 11 #include "net/http/http_util.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 scoped_refptr<net::HttpResponseHeaders> CreateResponseHeaders( | 15 scoped_refptr<net::HttpResponseHeaders> CreateResponseHeaders( |
| 16 const std::string& response_headers) { | 16 const std::string& response_headers) { |
| 17 std::string raw_headers = | 17 std::string raw_headers = net::HttpUtil::AssembleRawHeaders( |
| 18 net::HttpUtil::AssembleRawHeaders(response_headers.c_str(), | 18 response_headers.c_str(), static_cast<int>(response_headers.length())); |
| 19 response_headers.length()); | |
| 20 return new net::HttpResponseHeaders(raw_headers); | 19 return new net::HttpResponseHeaders(raw_headers); |
| 21 } | 20 } |
| 22 | 21 |
| 23 } // namespace | 22 } // namespace |
| 24 | 23 |
| 25 namespace captive_portal { | 24 namespace captive_portal { |
| 26 | 25 |
| 27 CaptivePortalDetectorTestBase::CaptivePortalDetectorTestBase() | 26 CaptivePortalDetectorTestBase::CaptivePortalDetectorTestBase() |
| 28 : detector_(NULL) { | 27 : detector_(NULL) { |
| 29 } | 28 } |
| (...skipping 27 matching lines...) Expand all Loading... |
| 57 scoped_refptr<net::HttpResponseHeaders> headers( | 56 scoped_refptr<net::HttpResponseHeaders> headers( |
| 58 CreateResponseHeaders(response_headers)); | 57 CreateResponseHeaders(response_headers)); |
| 59 DCHECK_EQ(status_code, headers->response_code()); | 58 DCHECK_EQ(status_code, headers->response_code()); |
| 60 fetcher()->set_response_headers(headers); | 59 fetcher()->set_response_headers(headers); |
| 61 } | 60 } |
| 62 } | 61 } |
| 63 detector()->OnURLFetchComplete(fetcher()); | 62 detector()->OnURLFetchComplete(fetcher()); |
| 64 } | 63 } |
| 65 | 64 |
| 66 } // namespace captive_portal | 65 } // namespace captive_portal |
| OLD | NEW |