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

Unified Diff: ios/web/public/test/response_providers/http_auth_response_provider.h

Issue 2898733003: Split up ios/web:test_support. (Closed)
Patch Set: don't break downstream clients Created 3 years, 7 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
Index: ios/web/public/test/response_providers/http_auth_response_provider.h
diff --git a/ios/web/public/test/response_providers/http_auth_response_provider.h b/ios/web/public/test/response_providers/http_auth_response_provider.h
deleted file mode 100644
index 1787b38dd8a13947f63d319ce5e9c4edb971b224..0000000000000000000000000000000000000000
--- a/ios/web/public/test/response_providers/http_auth_response_provider.h
+++ /dev/null
@@ -1,61 +0,0 @@
-// Copyright 2017 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_HTTP_AUTH_RESPONSE_PROVIDER_H_
-#define IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_HTTP_AUTH_RESPONSE_PROVIDER_H_
-
-#include <string>
-
-#import "ios/web/public/test/response_providers/html_response_provider.h"
-#include "url/gurl.h"
-
-namespace net {
-class HttpResponseHeaders;
-class HttpRequestHeaders;
-} // namespace net
-
-namespace web {
-
-// Serves a page which requires Basic HTTP Authentication.
-class HttpAuthResponseProvider : public HtmlResponseProvider {
- public:
- // Constructs provider which will respond to the given |url| and will use the
- // given authenticaion |realm|. |username| and |password| are credentials
- // required for sucessfull authentication. Use different realms and
- // username/password combination for different tests to prevent credentials
- // caching.
- HttpAuthResponseProvider(const GURL& url,
- const std::string& realm,
- const std::string& username,
- const std::string& password);
- ~HttpAuthResponseProvider() override;
-
- // HtmlResponseProvider overrides:
- bool CanHandleRequest(const Request& request) override;
- void GetResponseHeadersAndBody(
- const Request& request,
- scoped_refptr<net::HttpResponseHeaders>* headers,
- std::string* response_body) override;
-
- // Text returned in response if authentication was successfull.
- static std::string page_text() { return "authenticated"; }
-
- private:
- // Checks if authorization header has valid credintials:
- // https://tools.ietf.org/html/rfc1945#section-10.2
- bool HeadersHaveValidCredentials(const net::HttpRequestHeaders& headers);
-
- // URL this provider responds to.
- GURL url_;
- // HTTP Authentication realm.
- std::string realm_;
- // Correct username to pass authentication
- std::string username_;
- // Correct password to pass authentication
- std::string password_;
-};
-
-} // namespace web
-
-#endif // IOS_WEB_PUBLIC_TEST_RESPONSE_PROVIDERS_HTTP_AUTH_RESPONSE_PROVIDER_H_

Powered by Google App Engine
This is Rietveld 408576698