Unity Scopes API
MockScope.h
1 /*
2  * Copyright (C) 2014 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: James Henstridge <james.henstridge@canonical.com>
17  */
18 
19 #pragma once
20 
21 #include <unity/scopes/Scope.h>
22 #include <unity/scopes/SearchMetadata.h>
23 #include <unity/scopes/ActionMetadata.h>
24 
25 #include <unity/scopes/testing/MockObject.h>
26 
27 #pragma GCC diagnostic push
28 #pragma GCC diagnostic ignored "-Wctor-dtor-privacy"
29 #include <gmock/gmock.h>
30 #pragma GCC diagnostic pop
31 
32 namespace unity
33 {
34 
35 namespace scopes
36 {
37 
38 namespace testing
39 {
40 
42 
43 class MockScope : public unity::scopes::Scope, public unity::scopes::testing::MockObject
44 {
45 public:
46  MockScope(std::string const& endpoint = "",
47  std::string const& identity = "")
48  : MockObject(endpoint, identity) {}
49 
50  MOCK_METHOD3(search, QueryCtrlProxy(std::string const&,
51  SearchMetadata const&,
52  SearchListenerBase::SPtr const&));
53  MOCK_METHOD4(search, QueryCtrlProxy(std::string const&,
54  FilterState const&,
55  SearchMetadata const&,
56  SearchListenerBase::SPtr const&));
57  MOCK_METHOD5(search, QueryCtrlProxy(std::string const&,
58  std::string const&,
59  FilterState const&,
60  SearchMetadata const&,
61  SearchListenerBase::SPtr const&));
62  MOCK_METHOD3(activate, QueryCtrlProxy(unity::scopes::Result const&,
63  ActionMetadata const&,
64  ActivationListenerBase::SPtr const&));
65  MOCK_METHOD5(perform_action, QueryCtrlProxy(unity::scopes::Result const&,
66  ActionMetadata const&,
67  std::string const&,
68  std::string const&,
69  ActivationListenerBase::SPtr const&));
70  MOCK_METHOD3(preview, QueryCtrlProxy(unity::scopes::Result const&,
71  ActionMetadata const&,
72  PreviewListenerBase::SPtr const&));
73 
74  MOCK_METHOD0(child_scopes, ChildScopeList());
75 
76  MOCK_METHOD6(search, QueryCtrlProxy(std::string const&,
77  std::string const&,
78  FilterState const&,
79  Variant const&,
80  SearchMetadata const&,
81  SearchListenerBase::SPtr const&));
82 
83  MOCK_METHOD1(set_child_scopes, bool(ChildScopeList const&));
84  MOCK_METHOD4(activate_result_action, QueryCtrlProxy(unity::scopes::Result const&,
85  ActionMetadata const&,
86  std::string const&,
87  ActivationListenerBase::SPtr const&));
88 };
89 
91 
92 } // namespace testing
93 
94 } // namespace scopes
95 
96 } // namespace unity
The attributes of a result returned by a Scope.
Definition: Result.h:50
Definition: OnlineAccountClient.h:39
Top-level namespace for all things Unity-related.
Definition: Version.h:49
Allows queries, preview requests, and activation requests to be sent to a scope.
Definition: Scope.h:45
std::shared_ptr< QueryCtrl > QueryCtrlProxy
Convenience type definition.
Definition: QueryCtrlProxyFwd.h:33
std::vector< ChildScope > ChildScopeList
A list of child scopes.
Definition: ChildScope.h:33