chromium/services/device/power_monitor/power_monitor_message_broadcaster_unittest.cc

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

#include "services/device/power_monitor/power_monitor_message_broadcaster.h"

#include <memory>

#include "base/run_loop.h"
#include "base/task/sequenced_task_runner.h"
#include "base/test/power_monitor_test.h"
#include "mojo/public/cpp/bindings/pending_remote.h"
#include "services/device/device_service_test_base.h"
#include "services/device/public/cpp/power_monitor/power_monitor_broadcast_source.h"
#include "services/device/public/mojom/power_monitor.mojom.h"

namespace device {

class MockClient : public PowerMonitorBroadcastSource::Client {};

class PowerMonitorMessageBroadcasterTest : public DeviceServiceTestBase {};

TEST_F(PowerMonitorMessageBroadcasterTest, PowerMessageBroadcast) {}

// When adding a PowerMonitorClient, the new client needs to be sent the
// device's current is_on_battery state. However, when clients are created
// their is_on_battery ivar == false. Therefore, when the device is not on
// battery, these new clients aren't sent an OnPowerStateChange() message.
// This test sets the device's is_on_battery state to true and confirms
// that a new client receives an OnPowerStateChange() message.
TEST_F(PowerMonitorMessageBroadcasterTest, PowerClientUpdateWhenOnBattery) {}

}  // namespace device