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

Side by Side Diff: ios/web/public/test/http_server.mm

Issue 2644223002: Integration tests for WebStateDelegate::OnAuthRequired callback. (Closed)
Patch Set: Addressed review comments Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #import "ios/web/public/test/http_server.h" 5 #import "ios/web/public/test/http_server.h"
6 6
7 #import <Foundation/Foundation.h> 7 #import <Foundation/Foundation.h>
8 8
9 #include <string> 9 #include <string>
10 10
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 RemoveAllResponseProviders(); 138 RemoveAllResponseProviders();
139 [gcd_web_server_ stop]; 139 [gcd_web_server_ stop];
140 SetPort(0); 140 SetPort(0);
141 } 141 }
142 142
143 bool HttpServer::IsRunning() const { 143 bool HttpServer::IsRunning() const {
144 DCHECK([NSThread isMainThread]); 144 DCHECK([NSThread isMainThread]);
145 return [gcd_web_server_ isRunning]; 145 return [gcd_web_server_ isRunning];
146 } 146 }
147 147
148 NSUInteger HttpServer::GetPort() const {
149 base::AutoLock autolock(port_lock_);
150 return port_;
151 }
152
148 // static 153 // static
149 GURL HttpServer::MakeUrl(const std::string &url) { 154 GURL HttpServer::MakeUrl(const std::string &url) {
150 return HttpServer::GetSharedInstance().MakeUrlForHttpServer(url); 155 return HttpServer::GetSharedInstance().MakeUrlForHttpServer(url);
151 } 156 }
152 157
153 GURL HttpServer::MakeUrlForHttpServer(const std::string& url) const { 158 GURL HttpServer::MakeUrlForHttpServer(const std::string& url) const {
154 GURL result(url); 159 GURL result(url);
155 DCHECK(result.is_valid()); 160 DCHECK(result.is_valid());
156 const std::string kLocalhostHost = std::string("localhost"); 161 const std::string kLocalhostHost = std::string("localhost");
157 if (result.port() == base::IntToString(GetPort()) && 162 if (result.port() == base::IntToString(GetPort()) &&
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 DCHECK([NSThread isMainThread]); 227 DCHECK([NSThread isMainThread]);
223 base::AutoLock autolock(provider_list_lock_); 228 base::AutoLock autolock(provider_list_lock_);
224 providers_.clear(); 229 providers_.clear();
225 } 230 }
226 231
227 void HttpServer::SetPort(NSUInteger port) { 232 void HttpServer::SetPort(NSUInteger port) {
228 base::AutoLock autolock(port_lock_); 233 base::AutoLock autolock(port_lock_);
229 port_ = port; 234 port_ = port;
230 } 235 }
231 236
232 NSUInteger HttpServer::GetPort() const {
233 base::AutoLock autolock(port_lock_);
234 return port_;
235 }
236
237 } // namespace test 237 } // namespace test
238 } // namespace web 238 } // namespace web
OLDNEW
« no previous file with comments | « ios/web/public/test/http_server.h ('k') | ios/web/public/test/response_providers/http_auth_response_provider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698