blob: 61496304d0d365c0c171b1bc040ca95831612e60 [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
5#ifndef SHILL_MOCK_MODEM_INFO_
6#define SHILL_MOCK_MODEM_INFO_
7
8#include <base/basictypes.h>
9#include <gmock/gmock.h>
10
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070011#include "shill/mock_cellular_operator_info.h"
12#include "shill/mock_control.h"
13#include "shill/mock_event_dispatcher.h"
14#include "shill/mock_glib.h"
15#include "shill/mock_manager.h"
16#include "shill/mock_metrics.h"
Arman Uguray41cc6342013-03-29 16:34:39 -070017#include "shill/mock_pending_activation_store.h"
Paul Stewart8c116a92012-05-02 18:30:03 -070018#include "shill/modem_info.h"
19
20namespace shill {
21
22class MockModemInfo : public ModemInfo {
23 public:
24 MockModemInfo();
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070025
26 // All NULL parameters are replaced by mock objects.
27 MockModemInfo(ControlInterface *control,
28 EventDispatcher *dispatcher,
29 Metrics *metrics,
30 Manager *manager,
31 GLib *glib);
32
Paul Stewart8c116a92012-05-02 18:30:03 -070033 virtual ~MockModemInfo();
34
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070035 // Replaces data members in ModemInfo by mock objects.
36 // The following are relaced by mocks if they are NULL: control_interface,
37 // dispatcher, metrics, manager, glib.
Arman Uguray41cc6342013-03-29 16:34:39 -070038 // The following are always replaced by mocks: pending_activation_store,
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070039 // cellular_operator_info.
40 void SetMockMembers();
41
42 // Create a new provider_db and set it in ModemInfo.
43 // ModemInfo takes ownership.
44 void SetProviderDB(const char *provider_db_path);
45
46 // Accessors for mock objects
Arman Uguray41cc6342013-03-29 16:34:39 -070047 MockPendingActivationStore* mock_pending_activation_store() const {
48 return mock_pending_activation_store_;
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070049 }
50 MockCellularOperatorInfo* mock_cellular_operator_info() const {
51 return mock_cellular_operator_info_;
52 }
53 MockControl* mock_control_interface() const {
54 return mock_control_.get();
55 }
56 MockEventDispatcher* mock_dispatcher() const {
57 return mock_dispatcher_.get();
58 }
59 MockMetrics* mock_metrics() const {
60 return mock_metrics_.get();
61 }
62 MockManager* mock_manager() const {
63 return mock_manager_.get();
64 }
65 MockGLib* mock_glib() const {
66 return mock_glib_.get();
67 }
68
Paul Stewart8c116a92012-05-02 18:30:03 -070069 MOCK_METHOD0(Start, void());
70 MOCK_METHOD0(Stop, void());
71 MOCK_METHOD1(OnDeviceInfoAvailable, void(const std::string &link_name));
72
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070073 private:
74 scoped_ptr<MockControl> mock_control_;
75 scoped_ptr<MockEventDispatcher> mock_dispatcher_;
76 scoped_ptr<MockMetrics> mock_metrics_;
77 scoped_ptr<MockManager> mock_manager_;
78 scoped_ptr<MockGLib> mock_glib_;
79
80 // owned by ModemInfo
Arman Uguray41cc6342013-03-29 16:34:39 -070081 MockPendingActivationStore *mock_pending_activation_store_;
Prathmesh Prabhu27526f12013-03-25 19:42:18 -070082 MockCellularOperatorInfo *mock_cellular_operator_info_;
83
Paul Stewart8c116a92012-05-02 18:30:03 -070084 DISALLOW_COPY_AND_ASSIGN(MockModemInfo);
85};
86
87} // namespace shill
88
89#endif // SHILL_MOCK_MODEM_INFO_