#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <algorithm>
#include <string>
#include <tuple>
#include <utility>
#include <vector>
#include "base/memory/raw_ptr.h"
#include "base/numerics/safe_math.h"
#include "base/run_loop.h"
#include "base/task/single_thread_task_runner.h"
#include "base/test/task_environment.h"
#include "mojo/public/c/system/macros.h"
#include "mojo/public/cpp/bindings/connector.h"
#include "mojo/public/cpp/bindings/lib/validation_errors.h"
#include "mojo/public/cpp/bindings/message.h"
#include "mojo/public/cpp/bindings/message_dispatcher.h"
#include "mojo/public/cpp/bindings/message_header_validator.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "mojo/public/cpp/bindings/tests/validation_test_input_parser.h"
#include "mojo/public/cpp/system/message.h"
#include "mojo/public/cpp/test_support/test_support.h"
#include "mojo/public/interfaces/bindings/tests/validation_test_associated_interfaces.mojom.h"
#include "mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
namespace mojo {
namespace test {
namespace {
Message CreateRawMessage(size_t size) { … }
template <typename T>
void Append(std::vector<uint8_t>* data_vector, T data) { … }
bool TestInputParser(const std::string& input,
bool expected_result,
const std::vector<uint8_t>& expected_data,
size_t expected_num_handles) { … }
std::vector<std::string> GetMatchingTests(const std::vector<std::string>& names,
const std::string& prefix) { … }
bool ReadFile(const std::string& path, std::string* result) { … }
bool ReadAndParseDataFile(const std::string& path,
std::vector<uint8_t>* data,
size_t* num_handles) { … }
bool ReadResultFile(const std::string& path, std::string* result) { … }
std::string GetPath(const std::string& root, const std::string& suffix) { … }
bool ReadTestCase(const std::string& test,
Message* message,
std::string* expected) { … }
void RunValidationTests(const std::string& prefix,
MessageReceiver* test_message_receiver) { … }
class TwoStepValidator : public MessageReceiver { … };
class DummyMessageReceiver : public MessageReceiver { … };
class ValidationTest : public testing::Test { … };
class ValidationIntegrationTest : public ValidationTest { … };
class IntegrationTestInterfaceImpl : public IntegrationTestInterface { … };
TEST_F(ValidationTest, InputParser) { … }
TEST_F(ValidationTest, Conformance) { … }
TEST_F(ValidationTest, AssociatedConformace) { … }
TEST_F(ValidationTest, BoundsCheck) { … }
TEST_F(ValidationTest, ResponseConformance) { … }
TEST_F(ValidationTest, ResponseBoundsCheck) { … }
TEST_F(ValidationIntegrationTest, Remote) { … }
TEST_F(ValidationIntegrationTest, Receiver) { … }
TEST_F(ValidationTest, ValidateEncodedPointer) { … }
TEST(EnumValueValidationTest, BasicEnum) { … }
TEST(EnumValueValidationTest, EnumWithin) { … }
}
}
}