#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "device/fido/cable/v2_test_util.h"
#include <string>
#include <string_view>
#include <vector>
#include "base/base64url.h"
#include "base/check.h"
#include "base/containers/contains.h"
#include "base/containers/span.h"
#include "base/functional/callback.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/notreached.h"
#include "base/strings/string_number_conversions.h"
#include "base/task/sequenced_task_runner.h"
#include "components/cbor/reader.h"
#include "components/cbor/values.h"
#include "components/cbor/writer.h"
#include "crypto/random.h"
#include "device/fido/cable/v2_authenticator.h"
#include "device/fido/cable/v2_discovery.h"
#include "device/fido/cable/v2_handshake.h"
#include "device/fido/cable/websocket_adapter.h"
#include "device/fido/fido_constants.h"
#include "device/fido/network_context_factory.h"
#include "device/fido/virtual_ctap2_device.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "net/base/net_errors.h"
#include "net/http/http_status_code.h"
#include "net/storage_access_api/status.h"
#include "net/traffic_annotation/network_traffic_annotation_test_helper.h"
#include "services/network/test/test_network_context.h"
#include "third_party/blink/public/mojom/webauthn/authenticator.mojom.h"
#include "third_party/boringssl/src/include/openssl/ec_key.h"
#include "url/gurl.h"
namespace device::cablev2 {
namespace {
class TestNetworkContext : public network::TestNetworkContext { … };
class DummyBLEAdvert
: public device::cablev2::authenticator::Platform::BLEAdvert { … };
class TestPlatform : public authenticator::Platform { … };
}
namespace authenticator {
namespace {
class LateLinkingDevice : public authenticator::Transaction { … };
class HandshakeErrorDevice : public authenticator::Transaction { … };
}
}
std::unique_ptr<network::mojom::NetworkContext> NewMockTunnelServer(
std::optional<ContactCallback> contact_callback,
bool supports_connect_signal) { … }
namespace authenticator {
std::unique_ptr<authenticator::Platform> NewMockPlatform(
Discovery::AdvertEventStream::Callback ble_advert_callback,
device::VirtualCtap2Device* ctap2_device,
authenticator::Observer* observer) { … }
std::unique_ptr<Transaction> NewLateLinkingDevice(
CtapDeviceResponseCode ctap_error,
std::unique_ptr<Platform> platform,
NetworkContextFactory network_context_factory,
base::span<const uint8_t> qr_secret,
base::span<const uint8_t, kP256X962Length> peer_identity) { … }
std::unique_ptr<Transaction> NewHandshakeErrorDevice(
std::unique_ptr<Platform> platform,
NetworkContextFactory network_context_factory,
base::span<const uint8_t> qr_secret) { … }
}
}