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