2020-08-20 00:27:27 +02:00
|
|
|
// Copyright (c) 2020 The Chromium Embedded Framework 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 CEF_TESTS_CEFTESTS_TEST_SERVER_H_
|
|
|
|
#define CEF_TESTS_CEFTESTS_TEST_SERVER_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
2021-06-17 22:08:01 +02:00
|
|
|
#include "include/base/cef_callback.h"
|
2020-08-20 00:27:27 +02:00
|
|
|
#include "include/cef_registration.h"
|
|
|
|
#include "include/cef_request.h"
|
2020-08-14 21:28:23 +02:00
|
|
|
#include "include/cef_response.h"
|
2020-08-20 00:27:27 +02:00
|
|
|
|
|
|
|
namespace test_server {
|
|
|
|
|
2022-07-31 03:17:40 +02:00
|
|
|
// Use of these values is deprecated. Instead use GetOrigin/GetHost in the
|
|
|
|
// browser process after server initialization.
|
|
|
|
extern const char kHttpServerAddress[];
|
2023-06-01 16:06:15 +02:00
|
|
|
extern const uint16_t kHttpServerPort;
|
2020-08-20 00:27:27 +02:00
|
|
|
|
2022-07-29 22:05:20 +02:00
|
|
|
// Used with incomplete tests for data that should not be sent.
|
|
|
|
extern const char kIncompleteDoNotSendData[];
|
|
|
|
|
2022-07-31 01:53:48 +02:00
|
|
|
// Create a 404 response for passing to ResponseCallback.
|
|
|
|
CefRefPtr<CefResponse> Create404Response();
|
2020-08-20 00:27:27 +02:00
|
|
|
|
2022-07-31 01:53:48 +02:00
|
|
|
using ResponseCallback =
|
|
|
|
base::RepeatingCallback<void(CefRefPtr<CefResponse> response,
|
|
|
|
const std::string& response_data)>;
|
2020-08-20 00:27:27 +02:00
|
|
|
|
2022-07-31 01:53:48 +02:00
|
|
|
// Stops all servers that are currently running and executes |callback| on the
|
2020-08-20 00:27:27 +02:00
|
|
|
// UI thread. This method will be called by the test framework on shutdown.
|
2022-07-31 01:53:48 +02:00
|
|
|
void Stop(base::OnceClosure callback);
|
2020-08-20 00:27:27 +02:00
|
|
|
|
2022-07-31 03:17:40 +02:00
|
|
|
// Returns the origin for the currently running server (e.g.
|
|
|
|
// "[http|https]://127.0.0.1:<port>").
|
|
|
|
std::string GetOrigin(bool https_server);
|
|
|
|
|
|
|
|
// Returns the scheme for the currently running server (e.g. "http" or "https").
|
|
|
|
std::string GetScheme(bool https_server);
|
|
|
|
|
|
|
|
// Returns the host for the currently running server (e.g.
|
|
|
|
// "127.0.0.1[:<port>]").
|
|
|
|
std::string GetHost(bool https_server, bool include_port);
|
|
|
|
|
2020-08-20 00:27:27 +02:00
|
|
|
} // namespace test_server
|
|
|
|
|
|
|
|
#endif // CEF_TESTS_CEFTESTS_TEST_SERVER_H_
|