~thomas-voss/location-service/add-snapcraft-setup-next

« back to all changes in this revision

Viewing changes to tests/mock_provider.h

Merge lp:~thomas-voss/location-service/simplify-provider-interface.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
 
25
25
struct MockProvider : public location::Provider
26
26
{
27
 
    MockProvider() : location::Provider()
28
 
    {
29
 
    }
30
 
 
31
 
    MOCK_METHOD1(matches_criteria, bool(const location::Criteria&));
32
 
 
33
 
    MOCK_CONST_METHOD1(supports, bool(const location::Provider::Features&));
34
 
    MOCK_CONST_METHOD1(requires, bool(const location::Provider::Requirements&));
35
 
 
36
 
    // Called by the engine whenever the wifi and cell ID reporting state changes.
37
 
    MOCK_METHOD1(on_wifi_and_cell_reporting_state_changed, void(location::WifiAndCellIdReportingState state));
38
 
 
39
 
    // Called by the engine whenever the reference location changed.
40
 
    MOCK_METHOD1(on_reference_location_updated, void(const location::Update<location::Position>& position));
41
 
 
42
 
    // Called by the engine whenever the reference velocity changed.
43
 
    MOCK_METHOD1(on_reference_velocity_updated, void(const location::Update<location::Velocity>& velocity));
44
 
 
45
 
    // Called by the engine whenever the reference heading changed.
46
 
    MOCK_METHOD1(on_reference_heading_updated, void(const location::Update<location::Heading>& heading));
47
 
 
48
 
    MOCK_METHOD0(start_position_updates, void());
49
 
    MOCK_METHOD0(stop_position_updates, void());
50
 
 
51
 
    MOCK_METHOD0(start_heading_updates, void());
52
 
    MOCK_METHOD0(stop_heading_updates, void());
53
 
 
54
 
    MOCK_METHOD0(start_velocity_updates, void());
55
 
    MOCK_METHOD0(stop_velocity_updates, void());
 
27
    MOCK_METHOD1(on_new_event, void(const location::Event&));
 
28
    MOCK_METHOD0(enable, void());
 
29
    MOCK_METHOD0(disable, void());
 
30
    MOCK_METHOD0(activate, void());
 
31
    MOCK_METHOD0(deactivate, void());
 
32
 
 
33
    MOCK_CONST_METHOD0(requirements, Requirements());
 
34
    MOCK_METHOD1(satisfies, bool(const location::Criteria&));
 
35
    MOCK_CONST_METHOD0(position_updates, const core::Signal<location::Update<location::Position>>&());
 
36
    MOCK_CONST_METHOD0(heading_updates, const core::Signal<location::Update<location::Heading>>&());
 
37
    MOCK_CONST_METHOD0(velocity_updates, const core::Signal<location::Update<location::Velocity>>&());
56
38
 
57
39
    // Inject a position update from the outside.
58
40
    void inject_update(const location::Update<location::Position>& update)
59
41
    {
60
 
        mutable_updates().position(update);
 
42
        updates.position(update);
61
43
    }
62
44
 
63
45
    // Inject a velocity update from the outside.
64
46
    void inject_update(const location::Update<location::Velocity>& update)
65
47
    {
66
 
        mutable_updates().velocity(update);
 
48
        updates.velocity(update);
67
49
    }
68
50
 
69
51
    // Inject a heading update from the outside.
70
52
    void inject_update(const location::Update<location::Heading>& update)
71
53
    {
72
 
        mutable_updates().heading(update);
 
54
        updates.heading(update);
73
55
    }
 
56
 
 
57
    struct
 
58
    {
 
59
        core::Signal<location::Update<location::Position>> position;
 
60
        core::Signal<location::Update<location::Heading>> heading;
 
61
        core::Signal<location::Update<location::Velocity>> velocity;
 
62
    } updates;
74
63
};
75
64
 
76
65
#endif // MOCK_PROVIDER_H_