#include <stdint.h>
#include <cstddef>
#include <cstdio>
#include <memory>
#include <set>
#include <string>
#include <utility>
#include <vector>
#include "base/at_exit.h"
#include "base/command_line.h"
#include "base/compiler_specific.h"
#include "base/files/scoped_file.h"
#include "base/functional/bind.h"
#include "base/functional/callback.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/memory/ref_counted.h"
#include "base/message_loop/message_pump_type.h"
#include "base/run_loop.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/single_thread_task_executor.h"
#include "base/task/single_thread_task_runner.h"
#include "base/task/thread_pool/thread_pool_instance.h"
#include "base/threading/thread.h"
#include "base/time/default_clock.h"
#include "base/time/time.h"
#include "base/values.h"
#include "build/build_config.h"
#include "google_apis/gcm/base/fake_encryptor.h"
#include "google_apis/gcm/base/mcs_message.h"
#include "google_apis/gcm/base/mcs_util.h"
#include "google_apis/gcm/engine/checkin_request.h"
#include "google_apis/gcm/engine/connection_factory_impl.h"
#include "google_apis/gcm/engine/gcm_store_impl.h"
#include "google_apis/gcm/engine/gservices_settings.h"
#include "google_apis/gcm/engine/mcs_client.h"
#include "google_apis/gcm/monitoring/fake_gcm_stats_recorder.h"
#include "mojo/core/embedder/embedder.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/cert/cert_verifier.h"
#include "net/dns/host_resolver.h"
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_auth_preferences.h"
#include "net/http/http_auth_scheme.h"
#include "net/log/file_net_log_observer.h"
#include "net/proxy_resolution/configured_proxy_resolution_service.h"
#include "net/url_request/url_request_context.h"
#include "net/url_request/url_request_context_builder.h"
#include "net/url_request/url_request_test_util.h"
#include "services/network/network_context.h"
#include "services/network/public/cpp/shared_url_loader_factory.h"
#include "services/network/public/cpp/weak_wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/proxy_resolving_socket.mojom.h"
#include "services/network/public/mojom/url_loader_factory.mojom.h"
#include "services/network/test/test_network_connection_tracker.h"
#include "url/scheme_host_port.h"
#if BUILDFLAG(IS_MAC)
#include "base/apple/scoped_nsautorelease_pool.h"
#endif
namespace gcm {
namespace {
const net::BackoffEntry::Policy kDefaultBackoffPolicy = …;
const char kChromeVersion[] = …;
const char kMCSServerHost[] = …;
const uint16_t kMCSServerPort = …;
const char kRMQFileName[] = …;
const char kAndroidIdSwitch[] = …;
const char kSecretSwitch[] = …;
const char kLogFileSwitch[] = …;
const char kIgnoreCertSwitch[] = …;
const char kServerHostSwitch[] = …;
const char kServerPortSwitch[] = …;
void MessageReceivedCallback(const MCSMessage& message) { … }
void MessageSentCallback(int64_t user_serial_number,
const std::string& app_id,
const std::string& message_id,
MCSClient::MessageSendStatus status) { … }
class MyTestCertVerifier : public net::CertVerifier { … };
class MCSProbeAuthPreferences : public net::HttpAuthPreferences { … };
class MCSProbe { … };
MCSProbe::MCSProbe(const base::CommandLine& command_line)
: … { … }
MCSProbe::~MCSProbe() { … }
void MCSProbe::Start() { … }
void MCSProbe::LoadCallback(std::unique_ptr<GCMStore::LoadResult> load_result) { … }
void MCSProbe::UpdateCallback(bool success) { … }
void MCSProbe::InitializeNetworkState() { … }
void MCSProbe::ErrorCallback() { … }
void MCSProbe::RequestProxyResolvingSocketFactory(
mojo::PendingReceiver<network::mojom::ProxyResolvingSocketFactory>
receiver) { … }
void MCSProbe::CheckIn() { … }
void MCSProbe::OnCheckInCompleted(
net::HttpStatusCode response_code,
const checkin_proto::AndroidCheckinResponse& checkin_response) { … }
void MCSProbe::StartMCSLogin() { … }
int MCSProbeMain(int argc, char* argv[]) { … }
}
}
int main(int argc, char* argv[]) { … }