Unity Scopes API
MockSearchReply.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/CategorisedResult.h>
22 #include <unity/scopes/SearchReply.h>
23 #include <unity/scopes/Department.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 
44 class MockSearchReply : public unity::scopes::SearchReply, public virtual MockObject
45 {
46 public:
48  MockSearchReply() = default;
49 
50  // From Reply
51  MOCK_METHOD0(finished, void());
52  MOCK_METHOD1(error, void(std::exception_ptr));
53  MOCK_METHOD1(info, void(OperationInfo const&));
54 
55  // From SearchReply
56  MOCK_METHOD1(register_departments, void(Department::SCPtr const&));
57  MOCK_METHOD4(register_category,
58  Category::SCPtr(std::string const&,
59  std::string const&,
60  std::string const&,
61  CategoryRenderer const&));
62  MOCK_METHOD5(register_category,
63  Category::SCPtr(std::string const&,
64  std::string const&,
65  std::string const&,
66  CannedQuery const&,
67  CategoryRenderer const&));
68  MOCK_METHOD1(register_category, void(Category::SCPtr category));
69  MOCK_METHOD1(lookup_category, Category::SCPtr(std::string const&));
70  MOCK_METHOD1(push, bool(CategorisedResult const&));
71  MOCK_METHOD2(push, bool(Filters const&, FilterState const&));
72  MOCK_METHOD1(push, bool(Filters const&));
73  MOCK_METHOD1(push, bool(experimental::Annotation const& annotation));
74  MOCK_METHOD0(push_surfacing_results_from_cache, void());
75 
77 };
78 
79 
80 } // namespace testing
81 
82 } // namespace scopes
83 
84 } // namespace unity
virtual void info(OperationInfo const &op_info)=0
Informs the source of a query that additional information regarding the reply is available.
virtual void register_departments(Department::SCPtr const &parent)=0
Register departments for the current search reply and provide the current department.
std::list< FilterBase::SCPtr > Filters
List of filters.
Definition: FilterBase.h:131
A category renderer template in JSON format.
Definition: CategoryRenderer.h:83
Definition: OnlineAccountClient.h:39
virtual Category::SCPtr lookup_category(std::string const &id)=0
Returns a previously registered category.
virtual void push_surfacing_results_from_cache()=0
Push the results that were produced by the most recent surfacing query.
Allows the results of a search query to be sent to the query source.
Definition: SearchReply.h:45
Top-level namespace for all things Unity-related.
Definition: Version.h:49
virtual bool push(CategorisedResult const &result)=0
Sends a single result to the source of a query.
Parameters of a search query.
Definition: CannedQuery.h:49
Stores the state of multiple filters.
Definition: FilterState.h:46
virtual Category::SCPtr register_category(std::string const &id, std::string const &title, std::string const &icon, CategoryRenderer const &renderer_template=CategoryRenderer())=0
Register new category and send it to the source of the query.
virtual void finished()=0
Informs the source of a query that the query results are complete.
Mock for unity::scopes::SearchReply class.
Definition: MockSearchReply.h:44
virtual void error(std::exception_ptr ex)=0
Informs the source of a query that the query was terminated due to an error.
A container for details about something of interest that occurs during the operation of a request...
Definition: OperationInfo.h:42
A result, including the category it belongs to.
Definition: CategorisedResult.h:41