OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/web/public/test/http_server/http_server_util.h" | 5 #include "ios/web/public/test/http_server/http_server_util.h" |
6 | 6 |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #import "ios/web/public/test/http_server/html_response_provider.h" | 9 #import "ios/web/public/test/http_server/html_response_provider.h" |
10 #import "ios/web/public/test/http_server/http_server.h" | 10 #import "ios/web/public/test/http_server/http_server.h" |
11 | 11 |
| 12 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 13 #error "This file requires ARC support." |
| 14 #endif |
| 15 |
12 namespace web { | 16 namespace web { |
13 namespace test { | 17 namespace test { |
14 | 18 |
15 void SetUpSimpleHttpServer(const std::map<GURL, std::string>& responses) { | 19 void SetUpSimpleHttpServer(const std::map<GURL, std::string>& responses) { |
16 SetUpHttpServer(base::MakeUnique<HtmlResponseProvider>(responses)); | 20 SetUpHttpServer(base::MakeUnique<HtmlResponseProvider>(responses)); |
17 } | 21 } |
18 | 22 |
19 void SetUpSimpleHttpServerWithSetCookies( | 23 void SetUpSimpleHttpServerWithSetCookies( |
20 const std::map<GURL, std::pair<std::string, std::string>>& responses) { | 24 const std::map<GURL, std::pair<std::string, std::string>>& responses) { |
21 SetUpHttpServer(base::MakeUnique<HtmlResponseProvider>(responses)); | 25 SetUpHttpServer(base::MakeUnique<HtmlResponseProvider>(responses)); |
(...skipping 12 matching lines...) Expand all Loading... |
34 } | 38 } |
35 | 39 |
36 void AddResponseProvider(std::unique_ptr<web::ResponseProvider> provider) { | 40 void AddResponseProvider(std::unique_ptr<web::ResponseProvider> provider) { |
37 web::test::HttpServer& server = web::test::HttpServer::GetSharedInstance(); | 41 web::test::HttpServer& server = web::test::HttpServer::GetSharedInstance(); |
38 DCHECK(server.IsRunning()); | 42 DCHECK(server.IsRunning()); |
39 server.AddResponseProvider(std::move(provider)); | 43 server.AddResponseProvider(std::move(provider)); |
40 } | 44 } |
41 | 45 |
42 } // namespace test | 46 } // namespace test |
43 } // namespace web | 47 } // namespace web |
OLD | NEW |