blob: 40b5eed73b1b5fc2ca10b8067bd421dd74a0d9bf [file] [log] [blame]
Paul Stewart8c116a92012-05-02 18:30:03 -07001// Copyright (c) 2012 The Chromium OS Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
Ben Chanc54afe52014-11-05 10:28:08 -08005#ifndef SHILL_CELLULAR_MOCK_MODEM_INFO_H_
6#define SHILL_CELLULAR_MOCK_MODEM_INFO_H_
Paul Stewart8c116a92012-05-02 18:30:03 -07007
Ben Chanc20ed132014-10-16 12:25:03 -07008#include <memory>
Alex Vakulenko8a532292014-06-16 17:18:44 -07009#include <string>
10
Ben Chancc67c522014-09-03 07:19:18 -070011#include <base/macros.h>
Paul Stewart8c116a92012-05-02 18:30:03 -070012#include <gmock/gmock.h>
13
Ben Chanc54afe52014-11-05 10:28:08 -080014#include "shill/cellular/modem_info.h"
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070015#include "shill/mock_control.h"
16#include "shill/mock_event_dispatcher.h"
17#include "shill/mock_glib.h"
18#include "shill/mock_manager.h"
19#include "shill/mock_metrics.h"
Arman Uguray41cc6342013-03-29 16:34:39 -070020#include "shill/mock_pending_activation_store.h"
Paul Stewart8c116a92012-05-02 18:30:03 -070021
22namespace shill {
23
24class MockModemInfo : public ModemInfo {
25 public:
26 MockModemInfo();
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070027
Ben Chanea18c6c2014-09-30 13:08:26 -070028 // All nullptr parameters are replaced by mock objects.
Paul Stewart2f6c7892015-06-16 13:13:10 -070029 MockModemInfo(ControlInterface* control,
30 EventDispatcher* dispatcher,
31 Metrics* metrics,
32 Manager* manager,
33 GLib* glib);
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070034
Ben Chan5ea763b2014-08-13 11:07:54 -070035 ~MockModemInfo() override;
Paul Stewart8c116a92012-05-02 18:30:03 -070036
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070037 // Replaces data members in ModemInfo by mock objects.
Ben Chanea18c6c2014-09-30 13:08:26 -070038 // The following are relaced by mocks if they are nullptr: control_interface,
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070039 // dispatcher, metrics, manager, glib.
Prathmesh Prabhu3b66bb92014-05-22 11:15:25 -070040 // The following are always replaced by mocks: pending_activation_store.
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070041 void SetMockMembers();
42
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070043 // Accessors for mock objects
Arman Uguray41cc6342013-03-29 16:34:39 -070044 MockPendingActivationStore* mock_pending_activation_store() const {
45 return mock_pending_activation_store_;
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070046 }
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070047 MockControl* mock_control_interface() const {
48 return mock_control_.get();
49 }
50 MockEventDispatcher* mock_dispatcher() const {
51 return mock_dispatcher_.get();
52 }
53 MockMetrics* mock_metrics() const {
54 return mock_metrics_.get();
55 }
56 MockManager* mock_manager() const {
57 return mock_manager_.get();
58 }
59 MockGLib* mock_glib() const {
60 return mock_glib_.get();
61 }
62
Paul Stewart8c116a92012-05-02 18:30:03 -070063 MOCK_METHOD0(Start, void());
64 MOCK_METHOD0(Stop, void());
Paul Stewart2f6c7892015-06-16 13:13:10 -070065 MOCK_METHOD1(OnDeviceInfoAvailable, void(const std::string& link_name));
Paul Stewart8c116a92012-05-02 18:30:03 -070066
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070067 private:
Ben Chanc20ed132014-10-16 12:25:03 -070068 std::unique_ptr<MockControl> mock_control_;
69 std::unique_ptr<MockEventDispatcher> mock_dispatcher_;
70 std::unique_ptr<MockMetrics> mock_metrics_;
71 std::unique_ptr<MockManager> mock_manager_;
72 std::unique_ptr<MockGLib> mock_glib_;
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070073
74 // owned by ModemInfo
Paul Stewart2f6c7892015-06-16 13:13:10 -070075 MockPendingActivationStore* mock_pending_activation_store_;
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070076
Paul Stewart8c116a92012-05-02 18:30:03 -070077 DISALLOW_COPY_AND_ASSIGN(MockModemInfo);
78};
79
80} // namespace shill
81
Ben Chanc54afe52014-11-05 10:28:08 -080082#endif // SHILL_CELLULAR_MOCK_MODEM_INFO_H_