mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
ceftests: Deprecate the use of test_server constants (see issue #3348)
This commit is contained in:
@@ -11,10 +11,9 @@
|
||||
namespace test_server {
|
||||
|
||||
// Must use a different port than server_unittest.cc.
|
||||
const char kServerAddress[] = "127.0.0.1";
|
||||
const uint16 kServerPort = 8098;
|
||||
const char kServerScheme[] = "http";
|
||||
const char kServerOrigin[] = "http://127.0.0.1:8098";
|
||||
const char kHttpServerAddress[] = "127.0.0.1";
|
||||
const uint16 kHttpServerPort = 8098;
|
||||
|
||||
const char kIncompleteDoNotSendData[] = "DO NOT SEND";
|
||||
|
||||
CefRefPtr<CefResponse> Create404Response() {
|
||||
@@ -35,4 +34,24 @@ void Stop(base::OnceClosure callback) {
|
||||
/*https_server=*/true);
|
||||
}
|
||||
|
||||
std::string GetOrigin(bool https_server) {
|
||||
return Manager::GetOrigin(https_server);
|
||||
}
|
||||
|
||||
std::string GetScheme(bool https_server) {
|
||||
return https_server ? "https" : "http";
|
||||
}
|
||||
|
||||
std::string GetHost(bool https_server, bool include_port) {
|
||||
const auto& origin = GetOrigin(https_server);
|
||||
|
||||
const auto scheme_offset = origin.find("//");
|
||||
const auto& origin_without_scheme = origin.substr(scheme_offset + 2);
|
||||
if (include_port)
|
||||
return origin_without_scheme;
|
||||
|
||||
const auto port_offset = origin_without_scheme.find(':');
|
||||
return origin_without_scheme.substr(0, port_offset);
|
||||
}
|
||||
|
||||
} // namespace test_server
|
||||
|
Reference in New Issue
Block a user