chromium/mojo/public/cpp/bindings/tests/sample_service_unittest.cc

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifdef UNSAFE_BUFFERS_BUILD
// TODO(crbug.com/351564777): Remove this and convert code to safer constructs.
#pragma allow_unsafe_buffers
#endif

#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <iomanip>
#include <ostream>
#include <string>
#include <utility>

#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/tests/bindings_test_base.h"
#include "mojo/public/interfaces/bindings/tests/sample_service.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace mojo {

template <>
struct TypeConverter<int32_t, sample::BarPtr> {};

}  // namespace mojo

namespace sample {
namespace {

// Set this variable to true to print the message in hex.
bool g_dump_message_as_hex =;

// Set this variable to true to print the message in human readable form.
bool g_dump_message_as_text =;

// Make a sample |Foo|.
FooPtr MakeFoo() {}

// Check that the given |Foo| is identical to the one made by |MakeFoo()|.
void CheckFoo(const Foo& foo) {}

void PrintSpacer(int depth) {}

void Print(int depth, const char* name, bool value) {}

void Print(int depth, const char* name, int32_t value) {}

void Print(int depth, const char* name, uint8_t value) {}

template <typename H>
void Print(int depth,
           const char* name,
           const mojo::ScopedHandleBase<H>& value) {}

void Print(int depth, const char* name, const std::string& str) {}

void Print(int depth, const char* name, const BarPtr& bar) {}

template <typename T>
void Print(int depth, const char* name, const std::vector<T>& array) {}

template <typename T>
void Print(int depth,
           const char* name,
           const std::optional<std::vector<T>>& array) {}

void Print(int depth, const char* name, const FooPtr& foo) {}

void DumpHex(const uint8_t* bytes, size_t num_bytes) {}

class ServiceImpl : public Service {};

class ServiceProxyImpl : public ServiceProxy {};

class SimpleMessageReceiver : public mojo::MessageReceiverWithResponder {};

BindingsSampleTest;

TEST_P(BindingsSampleTest, Basic) {}

TEST_P(BindingsSampleTest, DefaultValues) {}

INSTANTIATE_MOJO_BINDINGS_TEST_SUITE_P();

}  // namespace
}  // namespace sample