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

Unified Diff: ios/web/public/test/http_server_util.mm

Issue 2193543002: [ios] Added web::test::SetUpHttpServer which takes ResponseProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « ios/web/public/test/http_server_util.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ios/web/public/test/http_server_util.mm
diff --git a/ios/web/public/test/http_server_util.mm b/ios/web/public/test/http_server_util.mm
index aff1531a480064e84d1e7a05cc585fd6f2306bb9..7be13c2a50c12c11170315163088e389e1fc7c98 100644
--- a/ios/web/public/test/http_server_util.mm
+++ b/ios/web/public/test/http_server_util.mm
@@ -14,20 +14,18 @@ namespace web {
namespace test {
void SetUpSimpleHttpServer(const std::map<GURL, std::string>& responses) {
- web::test::HttpServer& server = web::test::HttpServer::GetSharedInstance();
- DCHECK(server.IsRunning());
- auto provider = base::MakeUnique<HtmlResponseProvider>(responses);
-
- server.RemoveAllResponseProviders();
- server.AddResponseProvider(std::move(provider));
+ SetUpHttpServer(base::MakeUnique<HtmlResponseProvider>(responses));
}
void SetUpFileBasedHttpServer() {
- web::test::HttpServer& server = web::test::HttpServer::GetSharedInstance();
- DCHECK(server.IsRunning());
base::FilePath path;
PathService::Get(base::DIR_MODULE, &path);
- auto provider = base::MakeUnique<FileBasedResponseProvider>(path);
+ SetUpHttpServer(base::MakeUnique<FileBasedResponseProvider>(path));
+}
+
+void SetUpHttpServer(std::unique_ptr<web::ResponseProvider> provider) {
+ web::test::HttpServer& server = web::test::HttpServer::GetSharedInstance();
+ DCHECK(server.IsRunning());
server.RemoveAllResponseProviders();
server.AddResponseProvider(std::move(provider));
« no previous file with comments | « ios/web/public/test/http_server_util.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698