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 
23 #include <unity/scopes/testing/MockObject.h>
24 
25 #include <gmock/gmock.h>
26 
27 namespace unity
28 {
29 
30 namespace scopes
31 {
32 
33 namespace testing
34 {
35 
37 
38 class MockScope : public unity::scopes::Scope, public unity::scopes::testing::MockObject
39 {
40 public:
41  MockScope(std::string const& endpoint = "",
42  std::string const& identity = "")
43  : MockObject(endpoint, identity) {}
44 
45  MOCK_METHOD3(search, QueryCtrlProxy(std::string const&,
46  SearchMetadata const&,
47  SearchListenerBase::SPtr const&));
48  MOCK_METHOD4(search, QueryCtrlProxy(std::string const&,
49  FilterState const&,
50  SearchMetadata const&,
51  SearchListenerBase::SPtr const&));
52  MOCK_METHOD5(search, QueryCtrlProxy(std::string const&,
53  std::string const&,
54  FilterState const&,
55  SearchMetadata const&,
56  SearchListenerBase::SPtr const&));
57  MOCK_METHOD3(activate, QueryCtrlProxy(unity::scopes::Result const&,
58  ActionMetadata const&,
59  ActivationListenerBase::SPtr const&));
60  MOCK_METHOD5(perform_action, QueryCtrlProxy(unity::scopes::Result const&,
61  ActionMetadata const&,
62  std::string const&,
63  std::string const&,
64  ActivationListenerBase::SPtr const&));
65  MOCK_METHOD3(preview, QueryCtrlProxy(unity::scopes::Result const&,
66  ActionMetadata const&,
67  PreviewListenerBase::SPtr const&));
68 
69  MOCK_METHOD0(child_scopes, ChildScopeList());
70 
71  MOCK_METHOD6(search, QueryCtrlProxy(std::string const&,
72  std::string const&,
73  FilterState const&,
74  Variant const&,
75  SearchMetadata const&,
76  SearchListenerBase::SPtr const&));
77 
78  MOCK_METHOD1(set_child_scopes, bool(ChildScopeList const&));
79  MOCK_METHOD4(activate_result_action, QueryCtrlProxy(unity::scopes::Result const&,
80  ActionMetadata const&,
81  std::string const&,
82  ActivationListenerBase::SPtr const&));
83 };
84 
86 
87 } // namespace testing
88 
89 } // namespace scopes
90 
91 } // 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