Unity Scopes API
MockRegistry.h
1 /*
2  * Copyright (C) 2013 Canonical Ltd
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License version 3 as
6  * published by the Free Software Foundation.
7  *
8  * This program is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * GNU Lesser General Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  *
16  * Authored by: Thomas Voß <thomas.voss@canonical.com>
17  */
18 
19 #pragma once
20 
21 #include <unity/scopes/Registry.h>
22 #include <unity/scopes/testing/MockObject.h>
23 
24 #include <gmock/gmock.h>
25 
26 namespace unity
27 {
28 
29 namespace scopes
30 {
31 
32 namespace testing
33 {
34 
36 
37 class MockRegistry : public Registry, public virtual MockObject
38 {
39 public:
40  MockRegistry() = default;
41 
42  MOCK_METHOD1(get_metadata, ScopeMetadata(std::string const&));
43  MOCK_METHOD0(list, MetadataMap());
44  MOCK_METHOD1(list_if, MetadataMap(std::function<bool(ScopeMetadata const&)>));
45  MOCK_METHOD1(is_scope_running, bool(std::string const&));
46  core::ScopedConnection set_scope_state_callback(std::string const&, std::function<void(bool is_running)>) override
47  {
48  return core::Signal<>().connect([]{});
49  }
50  core::ScopedConnection set_list_update_callback(std::function<void()>) override
51  {
52  return core::Signal<>().connect([]{});
53  }
54 };
55 
57 
58 } // namespace testing
59 
60 } // namespace scopes
61 
62 } // namespace unity
Definition: OnlineAccountClient.h:39
Top-level namespace for all things Unity-related.
Definition: Version.h:49
std::map< std::string, ScopeMetadata > MetadataMap
Map for scope ID and metadata pairs.
Definition: Registry.h:43