chromium/remoting/base/telemetry_log_writer_unittest.cc

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

#include "remoting/base/telemetry_log_writer.h"

#include <array>

#include "base/containers/circular_deque.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/run_loop.h"
#include "base/test/task_environment.h"
#include "base/timer/timer.h"
#include "net/http/http_status_code.h"
#include "remoting/base/chromoting_event.h"
#include "remoting/base/fake_oauth_token_getter.h"
#include "remoting/base/protobuf_http_status.h"
#include "remoting/base/protobuf_http_test_responder.h"
#include "remoting/proto/remoting/v1/telemetry_messages.pb.h"
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"

namespace remoting {

namespace {

MATCHER_P(HasDurations, durations, "") {}

template <typename... Args>
std::array<int, sizeof...(Args)> MakeIntArray(Args&&... args) {}

// Sets expectation for call to CreateEvent with the set of events specified,
// identified by their session_duration field. (Session duration is incremented
// after each call to LogFakeEvent.)
//
// responder: The ProtobufHttpTestResponder on which to set the expectation.
// durations: The durations of the expected events, grouped with parentheses.
//     E.g., (0) or (1, 2).
//
// Example usage:
//     EXPECT_EVENTS(test_responder_, (1, 2))
//         .WillOnce(DoSucceed(&test_responder_));
#define EXPECT_EVENTS(responder, durations)

// Creates a success action to be passed to WillOnce and friends.
decltype(auto) DoSucceed(ProtobufHttpTestResponder* responder) {}

// Creates a failure action to be passed to WillOnce and friends.
decltype(auto) DoFail(ProtobufHttpTestResponder* responder) {}

}  // namespace

class TelemetryLogWriterTest : public testing::Test {};

TEST_F(TelemetryLogWriterTest, PostOneLogImmediately) {}

TEST_F(TelemetryLogWriterTest, PostOneLogAndHaveTwoPendingLogs) {}

TEST_F(TelemetryLogWriterTest, PostLogFailedAndRetry) {}

TEST_F(TelemetryLogWriterTest, PostOneLogFailedResendWithTwoPendingLogs) {}

TEST_F(TelemetryLogWriterTest, PostThreeLogsFailedAndResendWithOnePending) {}

TEST_F(TelemetryLogWriterTest, PostOneFailedThenSucceed) {}

}  // namespace remoting