Merge lp:~dobey/unity-scope-click/recommends into lp:unity-scope-click/devel
- recommends
- Merge into devel
Status: | Merged |
---|---|
Approved by: | Alejandro J. Cura |
Approved revision: | 309 |
Merged at revision: | 304 |
Proposed branch: | lp:~dobey/unity-scope-click/recommends |
Merge into: | lp:unity-scope-click/devel |
Diff against target: |
643 lines (+241/-78) 13 files modified
libclickscope/click/highlights.cpp (+2/-1) libclickscope/click/index.cpp (+31/-11) libclickscope/click/index.h (+2/-1) libclickscope/click/package.cpp (+6/-30) libclickscope/click/package.h (+1/-1) libclickscope/tests/CMakeLists.txt (+4/-3) libclickscope/tests/fake_json.h (+52/-0) libclickscope/tests/test_index.cpp (+35/-17) libclickscope/tests/test_package.cpp (+74/-0) po/unity-scope-click.pot (+6/-3) scope/clickstore/store-query.cpp (+13/-2) scope/tests/integration/webclient_integration.cpp (+2/-1) scope/tests/test_query.cpp (+13/-8) |
To merge this branch: | bzr merge lp:~dobey/unity-scope-click/recommends |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
PS Jenkins bot (community) | continuous-integration | Approve | |
Alejandro J. Cura (community) | Approve | ||
Review via email: mp+224507@code.launchpad.net |
Commit message
Parse and show recommendations from the server in search results.
Description of the change
PS Jenkins bot (ps-jenkins) wrote : | # |
Alejandro J. Cura (alecu) wrote : | # |
This branch is lacking many tests.
Here's a non exhaustive list of tests that would make sense adding:
- package_
- Highlight:
----
Please add names to make the callback parameters more obvious, eg:
std::function<
std::function<
----
Please refactor the following block out of Index::search into a new method, and add tests for it:
34 + if (root.isObject() && root.isMember(
35 + auto const emb = root[Package:
36 + if (emb.isObject() && emb.isMember(
37 + auto const pkg = emb[Package:
38 + pl = click::
39 +
40 + if (emb.isMember(
41 + auto const rec = emb[Package:
42 + recommends = click::
43 + }
44 + }
45 + } else if (root.isArray()) {
46 + qDebug() << "Fell back to old array mode.";
47 + pl = click::
48 + }
Also, please check if the old Array mode is really needed, and if not let's get rid of it.
---
Why are you not using push_package in 375 and below?
371 foreach (auto p, packages) {
372 push_package(
373 }
374 + foreach (auto r, recommends) {
375 + try {
If there's any reason not to use push_package, lines 375 and below should be refactored to a new method and tested.
---
Please check with design if installed packages should be shown or not on recommendations, and let's open a bug if they should be filtered.
- 302. By dobey
-
Merged tip of devel.
- 303. By dobey
-
Factor the parsing of search results and recommends to a new function.
List variable names in the callback declaration. - 304. By dobey
-
Drop the old plain array mode resource_url json key.
- 305. By dobey
-
Initial tests for package_
list_from_ json_node. - 306. By dobey
-
Use push_package instead of duplicating code.
- 307. By dobey
-
Fix up the translation template.
- 308. By dobey
-
A little more refactoring.
- 309. By dobey
-
Change the refactored function to return a pair instead of take a callback.
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:303
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
PS Jenkins bot (ps-jenkins) wrote : | # |
PASSED: Continuous integration, rev:309
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild:
http://
Preview Diff
1 | === modified file 'libclickscope/click/highlights.cpp' | |||
2 | --- libclickscope/click/highlights.cpp 2014-06-18 17:37:13 +0000 | |||
3 | +++ libclickscope/click/highlights.cpp 2014-06-26 18:57:41 +0000 | |||
4 | @@ -69,7 +69,8 @@ | |||
5 | 69 | if (item.isObject() && item.isMember(Highlight::JsonKeys::name)) | 69 | if (item.isObject() && item.isMember(Highlight::JsonKeys::name)) |
6 | 70 | { | 70 | { |
7 | 71 | auto name = item[Highlight::JsonKeys::name].asString(); | 71 | auto name = item[Highlight::JsonKeys::name].asString(); |
9 | 72 | auto pkgs = package_list_from_json_node(item); | 72 | auto pkg_node = item[Package::JsonKeys::embedded][Package::JsonKeys::ci_package]; |
10 | 73 | auto pkgs = package_list_from_json_node(pkg_node); | ||
11 | 73 | highlights.push_back(Highlight(name, pkgs)); | 74 | highlights.push_back(Highlight(name, pkgs)); |
12 | 74 | } | 75 | } |
13 | 75 | } | 76 | } |
14 | 76 | 77 | ||
15 | === modified file 'libclickscope/click/index.cpp' | |||
16 | --- libclickscope/click/index.cpp 2014-06-23 10:25:44 +0000 | |||
17 | +++ libclickscope/click/index.cpp 2014-06-26 18:57:41 +0000 | |||
18 | @@ -114,7 +114,32 @@ | |||
19 | 114 | }; | 114 | }; |
20 | 115 | } | 115 | } |
21 | 116 | 116 | ||
23 | 117 | click::web::Cancellable Index::search (const std::string& query, std::function<void(click::Packages)> callback) | 117 | std::pair<Packages, Packages> Index::package_lists_from_json(const std::string& json) |
24 | 118 | { | ||
25 | 119 | Json::Reader reader; | ||
26 | 120 | Json::Value root; | ||
27 | 121 | |||
28 | 122 | click::Packages pl; | ||
29 | 123 | click::Packages recommends; | ||
30 | 124 | if (reader.parse(json, root)) { | ||
31 | 125 | if (root.isObject() && root.isMember(Package::JsonKeys::embedded)) { | ||
32 | 126 | auto const emb = root[Package::JsonKeys::embedded]; | ||
33 | 127 | if (emb.isObject() && emb.isMember(Package::JsonKeys::ci_package)) { | ||
34 | 128 | auto const pkg = emb[Package::JsonKeys::ci_package]; | ||
35 | 129 | pl = click::package_list_from_json_node(pkg); | ||
36 | 130 | |||
37 | 131 | if (emb.isMember(Package::JsonKeys::ci_recommends)) { | ||
38 | 132 | auto const rec = emb[Package::JsonKeys::ci_recommends]; | ||
39 | 133 | recommends = click::package_list_from_json_node(rec); | ||
40 | 134 | } | ||
41 | 135 | } | ||
42 | 136 | } | ||
43 | 137 | } | ||
44 | 138 | return std::pair<Packages, Packages>(pl, recommends); | ||
45 | 139 | } | ||
46 | 140 | |||
47 | 141 | click::web::Cancellable Index::search (const std::string& query, | ||
48 | 142 | std::function<void(click::Packages search_results, click::Packages recommendations)> callback) | ||
49 | 118 | { | 143 | { |
50 | 119 | click::web::CallParams params; | 144 | click::web::CallParams params; |
51 | 120 | const std::string built_query(build_index_query(query, "")); | 145 | const std::string built_query(build_index_query(query, "")); |
52 | @@ -123,21 +148,16 @@ | |||
53 | 123 | get_base_url() + click::SEARCH_PATH, "GET", false, build_headers(), "", params)); | 148 | get_base_url() + click::SEARCH_PATH, "GET", false, build_headers(), "", params)); |
54 | 124 | 149 | ||
55 | 125 | QObject::connect(response.data(), &click::web::Response::finished, [=](QString reply) { | 150 | QObject::connect(response.data(), &click::web::Response::finished, [=](QString reply) { |
65 | 126 | Json::Reader reader; | 151 | std::pair<Packages, Packages> package_lists; |
66 | 127 | Json::Value root; | 152 | package_lists = package_lists_from_json(reply.toUtf8().constData()); |
67 | 128 | 153 | callback(package_lists.first, package_lists.second); | |
59 | 129 | click::Packages pl; | ||
60 | 130 | if (reader.parse(reply.toUtf8().constData(), root)) { | ||
61 | 131 | pl = click::package_list_from_json_node(root); | ||
62 | 132 | qDebug() << "found packages:" << pl.size(); | ||
63 | 133 | } | ||
64 | 134 | callback(pl); | ||
68 | 135 | }); | 154 | }); |
69 | 136 | QObject::connect(response.data(), &click::web::Response::error, [=](QString /*description*/) { | 155 | QObject::connect(response.data(), &click::web::Response::error, [=](QString /*description*/) { |
70 | 137 | qDebug() << "No packages found due to network error"; | 156 | qDebug() << "No packages found due to network error"; |
71 | 138 | click::Packages pl; | 157 | click::Packages pl; |
72 | 158 | click::Packages recommends; | ||
73 | 139 | qDebug() << "calling callback"; | 159 | qDebug() << "calling callback"; |
75 | 140 | callback(pl); | 160 | callback(pl, recommends); |
76 | 141 | qDebug() << " ...Done!"; | 161 | qDebug() << " ...Done!"; |
77 | 142 | }); | 162 | }); |
78 | 143 | return click::web::Cancellable(response); | 163 | return click::web::Cancellable(response); |
79 | 144 | 164 | ||
80 | === modified file 'libclickscope/click/index.h' | |||
81 | --- libclickscope/click/index.h 2014-06-23 10:25:44 +0000 | |||
82 | +++ libclickscope/click/index.h 2014-06-26 18:57:41 +0000 | |||
83 | @@ -74,7 +74,8 @@ | |||
84 | 74 | enum class Error {NoError, CredentialsError, NetworkError}; | 74 | enum class Error {NoError, CredentialsError, NetworkError}; |
85 | 75 | Index(const QSharedPointer<click::web::Client>& client, | 75 | Index(const QSharedPointer<click::web::Client>& client, |
86 | 76 | const QSharedPointer<Configuration> configuration=QSharedPointer<Configuration>(new Configuration())); | 76 | const QSharedPointer<Configuration> configuration=QSharedPointer<Configuration>(new Configuration())); |
88 | 77 | virtual click::web::Cancellable search (const std::string& query, std::function<void(Packages)> callback); | 77 | virtual std::pair<Packages, Packages> package_lists_from_json(const std::string& json); |
89 | 78 | virtual click::web::Cancellable search (const std::string& query, std::function<void(Packages, Packages)> callback); | ||
90 | 78 | virtual click::web::Cancellable get_details(const std::string& package_name, std::function<void(PackageDetails, Error)> callback); | 79 | virtual click::web::Cancellable get_details(const std::string& package_name, std::function<void(PackageDetails, Error)> callback); |
91 | 79 | virtual click::web::Cancellable bootstrap(std::function<void(const DepartmentList&, const HighlightList&, Error, int)> callback); | 80 | virtual click::web::Cancellable bootstrap(std::function<void(const DepartmentList&, const HighlightList&, Error, int)> callback); |
92 | 80 | virtual click::web::Cancellable departments(const std::string& department_href, std::function<void(const DepartmentList&, const HighlightList&, Error, int)> callback); | 81 | virtual click::web::Cancellable departments(const std::string& department_href, std::function<void(const DepartmentList&, const HighlightList&, Error, int)> callback); |
93 | 81 | 82 | ||
94 | === modified file 'libclickscope/click/package.cpp' | |||
95 | --- libclickscope/click/package.cpp 2014-06-18 18:18:14 +0000 | |||
96 | +++ libclickscope/click/package.cpp 2014-06-26 18:57:41 +0000 | |||
97 | @@ -75,42 +75,18 @@ | |||
98 | 75 | p.price = item[Package::JsonKeys::price].asDouble(); | 75 | p.price = item[Package::JsonKeys::price].asDouble(); |
99 | 76 | p.icon_url = item[Package::JsonKeys::icon_url].asString(); | 76 | p.icon_url = item[Package::JsonKeys::icon_url].asString(); |
100 | 77 | p.url = item[Package::JsonKeys::links][Package::JsonKeys::self][Package::JsonKeys::href].asString(); | 77 | p.url = item[Package::JsonKeys::links][Package::JsonKeys::self][Package::JsonKeys::href].asString(); |
101 | 78 | if (p.url.empty()) { | ||
102 | 79 | p.url = item[Package::JsonKeys::resource_url].asString(); | ||
103 | 80 | } | ||
104 | 81 | return p; | 78 | return p; |
105 | 82 | } | 79 | } |
106 | 83 | 80 | ||
107 | 84 | Packages package_list_from_json_node(const Json::Value& root) | 81 | Packages package_list_from_json_node(const Json::Value& root) |
108 | 85 | { | 82 | { |
109 | 86 | Packages pl; | 83 | Packages pl; |
137 | 87 | if (root.isObject() && root.isMember(Package::JsonKeys::embedded)) | 84 | for (uint i = 0; i < root.size(); i++) |
138 | 88 | { | 85 | { |
139 | 89 | auto const emb = root[Package::JsonKeys::embedded]; | 86 | Package p; |
140 | 90 | if (emb.isObject() && emb.isMember(Package::JsonKeys::ci_package)) | 87 | const json::Value item = root[i]; |
141 | 91 | { | 88 | p = package_from_json_node(item); |
142 | 92 | auto const pkg = emb[Package::JsonKeys::ci_package]; | 89 | pl.push_back(p); |
116 | 93 | for (uint i = 0; i < pkg.size(); i++) | ||
117 | 94 | { | ||
118 | 95 | Package p; | ||
119 | 96 | const json::Value item = pkg[i]; | ||
120 | 97 | p = package_from_json_node(item); | ||
121 | 98 | pl.push_back(p); | ||
122 | 99 | } | ||
123 | 100 | } | ||
124 | 101 | } | ||
125 | 102 | else if (root.isArray()) | ||
126 | 103 | { | ||
127 | 104 | qDebug() << "Fell back to old array mode."; | ||
128 | 105 | qDebug() << root.size() << "packages returned."; | ||
129 | 106 | for (uint i = 0; i < root.size(); i++) | ||
130 | 107 | { | ||
131 | 108 | |||
132 | 109 | Package p; | ||
133 | 110 | const json::Value item = root[i]; | ||
134 | 111 | p = package_from_json_node(item); | ||
135 | 112 | pl.push_back(p); | ||
136 | 113 | } | ||
143 | 114 | } | 90 | } |
144 | 115 | return pl; | 91 | return pl; |
145 | 116 | } | 92 | } |
146 | 117 | 93 | ||
147 | === modified file 'libclickscope/click/package.h' | |||
148 | --- libclickscope/click/package.h 2014-06-18 09:01:20 +0000 | |||
149 | +++ libclickscope/click/package.h 2014-06-26 18:57:41 +0000 | |||
150 | @@ -54,11 +54,11 @@ | |||
151 | 54 | constexpr static const char* self{"self"}; | 54 | constexpr static const char* self{"self"}; |
152 | 55 | constexpr static const char* href{"href"}; | 55 | constexpr static const char* href{"href"}; |
153 | 56 | constexpr static const char* ci_package {"clickindex:package"}; | 56 | constexpr static const char* ci_package {"clickindex:package"}; |
154 | 57 | constexpr static const char* ci_recommends {"clickindex:recommendation"}; | ||
155 | 57 | constexpr static const char* name{"name"}; | 58 | constexpr static const char* name{"name"}; |
156 | 58 | constexpr static const char* title{"title"}; | 59 | constexpr static const char* title{"title"}; |
157 | 59 | constexpr static const char* price{"price"}; | 60 | constexpr static const char* price{"price"}; |
158 | 60 | constexpr static const char* icon_url{"icon_url"}; | 61 | constexpr static const char* icon_url{"icon_url"}; |
159 | 61 | constexpr static const char* resource_url{"resource_url"}; | ||
160 | 62 | }; | 62 | }; |
161 | 63 | 63 | ||
162 | 64 | Package() = default; | 64 | Package() = default; |
163 | 65 | 65 | ||
164 | === modified file 'libclickscope/tests/CMakeLists.txt' | |||
165 | --- libclickscope/tests/CMakeLists.txt 2014-06-18 11:29:58 +0000 | |||
166 | +++ libclickscope/tests/CMakeLists.txt 2014-06-26 18:57:41 +0000 | |||
167 | @@ -21,15 +21,16 @@ | |||
168 | 21 | mock_ubuntuone_credentials.h | 21 | mock_ubuntuone_credentials.h |
169 | 22 | mock_webclient.h | 22 | mock_webclient.h |
170 | 23 | 23 | ||
171 | 24 | test_bootstrap.cpp | ||
172 | 25 | test_configuration.cpp | ||
173 | 26 | test_departments.cpp | ||
174 | 24 | test_download_manager.cpp | 27 | test_download_manager.cpp |
175 | 25 | test_index.cpp | 28 | test_index.cpp |
176 | 26 | test_interface.cpp | 29 | test_interface.cpp |
178 | 27 | test_configuration.cpp | 30 | test_package.cpp |
179 | 28 | test_reviews.cpp | 31 | test_reviews.cpp |
180 | 29 | test_smartconnect.cpp | 32 | test_smartconnect.cpp |
181 | 30 | test_webclient.cpp | 33 | test_webclient.cpp |
182 | 31 | test_bootstrap.cpp | ||
183 | 32 | test_departments.cpp | ||
184 | 33 | 34 | ||
185 | 34 | ${CMAKE_CURRENT_BINARY_DIR}/test_data.cpp | 35 | ${CMAKE_CURRENT_BINARY_DIR}/test_data.cpp |
186 | 35 | ) | 36 | ) |
187 | 36 | 37 | ||
188 | === modified file 'libclickscope/tests/fake_json.h' | |||
189 | --- libclickscope/tests/fake_json.h 2014-06-23 11:33:55 +0000 | |||
190 | +++ libclickscope/tests/fake_json.h 2014-06-26 18:57:41 +0000 | |||
191 | @@ -74,6 +74,24 @@ | |||
192 | 74 | } | 74 | } |
193 | 75 | )foo"; | 75 | )foo"; |
194 | 76 | 76 | ||
195 | 77 | const std::string FAKE_JSON_SEARCH_RESULT_MISSING_DATA = R"foo({ | ||
196 | 78 | "_embedded": { | ||
197 | 79 | "clickindex:package": [ | ||
198 | 80 | { | ||
199 | 81 | "name": "org.example.awesomelauncher", | ||
200 | 82 | "title": "Awesome Launcher", | ||
201 | 83 | "description": "This is an awesome launcher.", | ||
202 | 84 | "_links": { | ||
203 | 85 | "self": { | ||
204 | 86 | "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher" | ||
205 | 87 | } | ||
206 | 88 | } | ||
207 | 89 | } | ||
208 | 90 | ] | ||
209 | 91 | } | ||
210 | 92 | } | ||
211 | 93 | )foo"; | ||
212 | 94 | |||
213 | 77 | const std::string FAKE_JSON_SEARCH_RESULT_MANY = R"foo({ | 95 | const std::string FAKE_JSON_SEARCH_RESULT_MANY = R"foo({ |
214 | 78 | "_embedded": { | 96 | "_embedded": { |
215 | 79 | "clickindex:package": [ | 97 | "clickindex:package": [ |
216 | @@ -118,6 +136,40 @@ | |||
217 | 118 | } | 136 | } |
218 | 119 | )foo"; | 137 | )foo"; |
219 | 120 | 138 | ||
220 | 139 | const std::string FAKE_JSON_SEARCH_RESULT_RECOMMENDS = R"foo({ | ||
221 | 140 | "_embedded": { | ||
222 | 141 | "clickindex:package": [ | ||
223 | 142 | { | ||
224 | 143 | "name": "org.example.awesomelauncher", | ||
225 | 144 | "title": "Awesome Launcher", | ||
226 | 145 | "description": "This is an awesome launcher.", | ||
227 | 146 | "price": 1.99, | ||
228 | 147 | "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png", | ||
229 | 148 | "_links": { | ||
230 | 149 | "self": { | ||
231 | 150 | "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher" | ||
232 | 151 | } | ||
233 | 152 | } | ||
234 | 153 | } | ||
235 | 154 | ], | ||
236 | 155 | "clickindex:recommendation": [ | ||
237 | 156 | { | ||
238 | 157 | "name": "org.example.awesomelauncher2", | ||
239 | 158 | "title": "Awesome Launcher 2", | ||
240 | 159 | "description": "This is an another awesome launcher.", | ||
241 | 160 | "price": 1.99, | ||
242 | 161 | "icon_url": "http://software-center.ubuntu.com/site_media/appmedia/2012/09/SPAZ.png", | ||
243 | 162 | "_links": { | ||
244 | 163 | "self": { | ||
245 | 164 | "href": "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher2" | ||
246 | 165 | } | ||
247 | 166 | } | ||
248 | 167 | } | ||
249 | 168 | ] | ||
250 | 169 | } | ||
251 | 170 | } | ||
252 | 171 | )foo"; | ||
253 | 172 | |||
254 | 121 | const std::string FAKE_JSON_PACKAGE_DETAILS = R"foo( | 173 | const std::string FAKE_JSON_PACKAGE_DETAILS = R"foo( |
255 | 122 | { | 174 | { |
256 | 123 | "name": "ar.com.beuno.wheather-touch", | 175 | "name": "ar.com.beuno.wheather-touch", |
257 | 124 | 176 | ||
258 | === modified file 'libclickscope/tests/test_index.cpp' | |||
259 | --- libclickscope/tests/test_index.cpp 2014-06-23 10:25:44 +0000 | |||
260 | +++ libclickscope/tests/test_index.cpp 2014-06-26 18:57:41 +0000 | |||
261 | @@ -79,7 +79,7 @@ | |||
262 | 79 | DefaultValue<std::map<std::string, std::string>>::Set(std::map<std::string, std::string>()); | 79 | DefaultValue<std::map<std::string, std::string>>::Set(std::map<std::string, std::string>()); |
263 | 80 | } | 80 | } |
264 | 81 | public: | 81 | public: |
266 | 82 | MOCK_METHOD1(search_callback, void(click::Packages)); | 82 | MOCK_METHOD2(search_callback, void(click::Packages, click::Packages)); |
267 | 83 | MOCK_METHOD2(details_callback, void(click::PackageDetails, click::Index::Error)); | 83 | MOCK_METHOD2(details_callback, void(click::PackageDetails, click::Index::Error)); |
268 | 84 | }; | 84 | }; |
269 | 85 | 85 | ||
270 | @@ -100,7 +100,7 @@ | |||
271 | 100 | .Times(1) | 100 | .Times(1) |
272 | 101 | .WillOnce(Return(response)); | 101 | .WillOnce(Return(response)); |
273 | 102 | 102 | ||
275 | 103 | indexPtr->search("", [](click::Packages) {}); | 103 | indexPtr->search("", [](click::Packages, click::Packages) {}); |
276 | 104 | } | 104 | } |
277 | 105 | 105 | ||
278 | 106 | TEST_F(IndexTest, testSearchSendsBuiltQueryAsParam) | 106 | TEST_F(IndexTest, testSearchSendsBuiltQueryAsParam) |
279 | @@ -120,7 +120,7 @@ | |||
280 | 120 | .Times(1) | 120 | .Times(1) |
281 | 121 | .WillOnce(Return(FAKE_BUILT_QUERY)); | 121 | .WillOnce(Return(FAKE_BUILT_QUERY)); |
282 | 122 | 122 | ||
284 | 123 | indexPtr->search(FAKE_QUERY, [](click::Packages) {}); | 123 | indexPtr->search(FAKE_QUERY, [](click::Packages, click::Packages) {}); |
285 | 124 | } | 124 | } |
286 | 125 | 125 | ||
287 | 126 | TEST_F(IndexTest, testSearchSendsRightPath) | 126 | TEST_F(IndexTest, testSearchSendsRightPath) |
288 | @@ -133,7 +133,7 @@ | |||
289 | 133 | .Times(1) | 133 | .Times(1) |
290 | 134 | .WillOnce(Return(response)); | 134 | .WillOnce(Return(response)); |
291 | 135 | 135 | ||
293 | 136 | indexPtr->search("", [](click::Packages) {}); | 136 | indexPtr->search("", [](click::Packages, click::Packages) {}); |
294 | 137 | } | 137 | } |
295 | 138 | 138 | ||
296 | 139 | TEST_F(IndexTest, testSearchCallbackIsCalled) | 139 | TEST_F(IndexTest, testSearchCallbackIsCalled) |
297 | @@ -148,10 +148,11 @@ | |||
298 | 148 | EXPECT_CALL(*clientPtr, callImpl(_, _, _, _, _, _)) | 148 | EXPECT_CALL(*clientPtr, callImpl(_, _, _, _, _, _)) |
299 | 149 | .Times(1) | 149 | .Times(1) |
300 | 150 | .WillOnce(Return(response)); | 150 | .WillOnce(Return(response)); |
302 | 151 | EXPECT_CALL(*this, search_callback(_)).Times(1); | 151 | EXPECT_CALL(*this, search_callback(_, _)).Times(1); |
303 | 152 | 152 | ||
306 | 153 | indexPtr->search("", [this](click::Packages packages){ | 153 | indexPtr->search("", [this](click::Packages packages, |
307 | 154 | search_callback(packages); | 154 | click::Packages recommends){ |
308 | 155 | search_callback(packages, recommends); | ||
309 | 155 | }); | 156 | }); |
310 | 156 | response->replyFinished(); | 157 | response->replyFinished(); |
311 | 157 | } | 158 | } |
312 | @@ -169,10 +170,11 @@ | |||
313 | 169 | .Times(1) | 170 | .Times(1) |
314 | 170 | .WillOnce(Return(response)); | 171 | .WillOnce(Return(response)); |
315 | 171 | click::Packages empty_package_list; | 172 | click::Packages empty_package_list; |
317 | 172 | EXPECT_CALL(*this, search_callback(empty_package_list)).Times(1); | 173 | EXPECT_CALL(*this, search_callback(empty_package_list, _)).Times(1); |
318 | 173 | 174 | ||
321 | 174 | indexPtr->search("", [this](click::Packages packages){ | 175 | indexPtr->search("", [this](click::Packages packages, |
322 | 175 | search_callback(packages); | 176 | click::Packages recommends){ |
323 | 177 | search_callback(packages, recommends); | ||
324 | 176 | }); | 178 | }); |
325 | 177 | response->replyFinished(); | 179 | response->replyFinished(); |
326 | 178 | } | 180 | } |
327 | @@ -198,10 +200,11 @@ | |||
328 | 198 | "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher" | 200 | "http://search.apps.ubuntu.com/api/v1/package/org.example.awesomelauncher" |
329 | 199 | } | 201 | } |
330 | 200 | }; | 202 | }; |
332 | 201 | EXPECT_CALL(*this, search_callback(single_package_list)).Times(1); | 203 | EXPECT_CALL(*this, search_callback(single_package_list, _)).Times(1); |
333 | 202 | 204 | ||
336 | 203 | indexPtr->search("", [this](click::Packages packages){ | 205 | indexPtr->search("", [this](click::Packages packages, |
337 | 204 | search_callback(packages); | 206 | click::Packages recommends){ |
338 | 207 | search_callback(packages, recommends); | ||
339 | 205 | }); | 208 | }); |
340 | 206 | response->replyFinished(); | 209 | response->replyFinished(); |
341 | 207 | } | 210 | } |
342 | @@ -215,7 +218,8 @@ | |||
343 | 215 | .Times(1) | 218 | .Times(1) |
344 | 216 | .WillOnce(Return(response)); | 219 | .WillOnce(Return(response)); |
345 | 217 | 220 | ||
347 | 218 | auto search_operation = indexPtr->search("", [](click::Packages) {}); | 221 | auto search_operation = indexPtr->search("", [](click::Packages, |
348 | 222 | click::Packages) {}); | ||
349 | 219 | EXPECT_CALL(reply.instance, abort()).Times(1); | 223 | EXPECT_CALL(reply.instance, abort()).Times(1); |
350 | 220 | search_operation.cancel(); | 224 | search_operation.cancel(); |
351 | 221 | } | 225 | } |
352 | @@ -234,12 +238,13 @@ | |||
353 | 234 | .Times(1) | 238 | .Times(1) |
354 | 235 | .WillOnce(Return(response)); | 239 | .WillOnce(Return(response)); |
355 | 236 | EXPECT_CALL(reply.instance, errorString()).Times(1).WillOnce(Return("fake error")); | 240 | EXPECT_CALL(reply.instance, errorString()).Times(1).WillOnce(Return("fake error")); |
358 | 237 | indexPtr->search("", [this](click::Packages packages){ | 241 | indexPtr->search("", [this](click::Packages packages, |
359 | 238 | search_callback(packages); | 242 | click::Packages recommends){ |
360 | 243 | search_callback(packages, recommends); | ||
361 | 239 | }); | 244 | }); |
362 | 240 | 245 | ||
363 | 241 | click::Packages empty_package_list; | 246 | click::Packages empty_package_list; |
365 | 242 | EXPECT_CALL(*this, search_callback(empty_package_list)).Times(1); | 247 | EXPECT_CALL(*this, search_callback(empty_package_list, _)).Times(1); |
366 | 243 | 248 | ||
367 | 244 | emit reply.instance.error(QNetworkReply::UnknownNetworkError); | 249 | emit reply.instance.error(QNetworkReply::UnknownNetworkError); |
368 | 245 | } | 250 | } |
369 | @@ -441,6 +446,19 @@ | |||
370 | 441 | ASSERT_TRUE(unsetenv(click::SEARCH_BASE_URL_ENVVAR.c_str()) == 0); | 446 | ASSERT_TRUE(unsetenv(click::SEARCH_BASE_URL_ENVVAR.c_str()) == 0); |
371 | 442 | } | 447 | } |
372 | 443 | 448 | ||
373 | 449 | TEST_F(IndexTest, testPackageListsFromJsonNodeNoRecommends) | ||
374 | 450 | { | ||
375 | 451 | auto lists = indexPtr->package_lists_from_json(FAKE_JSON_SEARCH_RESULT_ONE); | ||
376 | 452 | EXPECT_EQ(1, lists.first.size()); | ||
377 | 453 | EXPECT_EQ(0, lists.second.size()); | ||
378 | 454 | } | ||
379 | 455 | |||
380 | 456 | TEST_F(IndexTest, testPackageListsFromJsonNodeHasRecommends) | ||
381 | 457 | { | ||
382 | 458 | auto lists = indexPtr->package_lists_from_json(FAKE_JSON_SEARCH_RESULT_RECOMMENDS); | ||
383 | 459 | EXPECT_EQ(1, lists.second.size()); | ||
384 | 460 | } | ||
385 | 461 | |||
386 | 444 | TEST_F(MockPackageManager, testUninstallCommandCorrect) | 462 | TEST_F(MockPackageManager, testUninstallCommandCorrect) |
387 | 445 | { | 463 | { |
388 | 446 | click::Package package = { | 464 | click::Package package = { |
389 | 447 | 465 | ||
390 | === added file 'libclickscope/tests/test_package.cpp' | |||
391 | --- libclickscope/tests/test_package.cpp 1970-01-01 00:00:00 +0000 | |||
392 | +++ libclickscope/tests/test_package.cpp 2014-06-26 18:57:41 +0000 | |||
393 | @@ -0,0 +1,74 @@ | |||
394 | 1 | /* | ||
395 | 2 | * Copyright (C) 2014 Canonical Ltd. | ||
396 | 3 | * | ||
397 | 4 | * This program is free software: you can redistribute it and/or modify it | ||
398 | 5 | * under the terms of the GNU General Public License version 3, as published | ||
399 | 6 | * by the Free Software Foundation. | ||
400 | 7 | * | ||
401 | 8 | * This program is distributed in the hope that it will be useful, but | ||
402 | 9 | * WITHOUT ANY WARRANTY; without even the implied warranties of | ||
403 | 10 | * MERCHANTABILITY, SATISFACTORY QUALITY, or FITNESS FOR A PARTICULAR | ||
404 | 11 | * PURPOSE. See the GNU General Public License for more details. | ||
405 | 12 | * | ||
406 | 13 | * You should have received a copy of the GNU General Public License along | ||
407 | 14 | * with this program. If not, see <http://www.gnu.org/licenses/>. | ||
408 | 15 | * | ||
409 | 16 | * In addition, as a special exception, the copyright holders give | ||
410 | 17 | * permission to link the code of portions of this program with the | ||
411 | 18 | * OpenSSL library under certain conditions as described in each | ||
412 | 19 | * individual source file, and distribute linked combinations | ||
413 | 20 | * including the two. | ||
414 | 21 | * You must obey the GNU General Public License in all respects | ||
415 | 22 | * for all of the code used other than OpenSSL. If you modify | ||
416 | 23 | * file(s) with this exception, you may extend this exception to your | ||
417 | 24 | * version of the file(s), but you are not obligated to do so. If you | ||
418 | 25 | * do not wish to do so, delete this exception statement from your | ||
419 | 26 | * version. If you delete this exception statement from all source | ||
420 | 27 | * files in the program, then also delete it here. | ||
421 | 28 | */ | ||
422 | 29 | |||
423 | 30 | #include <click/package.h> | ||
424 | 31 | |||
425 | 32 | #include <gtest/gtest.h> | ||
426 | 33 | |||
427 | 34 | #include "fake_json.h" | ||
428 | 35 | |||
429 | 36 | using namespace click; | ||
430 | 37 | |||
431 | 38 | |||
432 | 39 | class PackageTest : public ::testing::Test { | ||
433 | 40 | }; | ||
434 | 41 | |||
435 | 42 | TEST_F(PackageTest, testPackageListFromJsonNodeSingle) | ||
436 | 43 | { | ||
437 | 44 | Json::Value root; | ||
438 | 45 | Json::Reader().parse(FAKE_JSON_SEARCH_RESULT_ONE, root); | ||
439 | 46 | auto const embedded = root[Package::JsonKeys::embedded]; | ||
440 | 47 | auto const ci_package = embedded[Package::JsonKeys::ci_package]; | ||
441 | 48 | |||
442 | 49 | Packages pl = package_list_from_json_node(ci_package); | ||
443 | 50 | ASSERT_EQ(1, pl.size()); | ||
444 | 51 | } | ||
445 | 52 | |||
446 | 53 | TEST_F(PackageTest, testPackageListFromJsonNodeMany) | ||
447 | 54 | { | ||
448 | 55 | Json::Value root; | ||
449 | 56 | Json::Reader().parse(FAKE_JSON_SEARCH_RESULT_MANY, root); | ||
450 | 57 | auto const embedded = root[Package::JsonKeys::embedded]; | ||
451 | 58 | auto const ci_package = embedded[Package::JsonKeys::ci_package]; | ||
452 | 59 | |||
453 | 60 | Packages pl = package_list_from_json_node(ci_package); | ||
454 | 61 | ASSERT_GT(pl.size(), 1); | ||
455 | 62 | } | ||
456 | 63 | |||
457 | 64 | TEST_F(PackageTest, testPackageListFromJsonNodeMissingData) | ||
458 | 65 | { | ||
459 | 66 | Json::Value root; | ||
460 | 67 | Json::Reader().parse(FAKE_JSON_SEARCH_RESULT_MISSING_DATA, root); | ||
461 | 68 | auto const embedded = root[Package::JsonKeys::embedded]; | ||
462 | 69 | auto const ci_package = embedded[Package::JsonKeys::ci_package]; | ||
463 | 70 | |||
464 | 71 | Packages pl = package_list_from_json_node(ci_package); | ||
465 | 72 | ASSERT_EQ(1, pl.size()); | ||
466 | 73 | } | ||
467 | 74 | |||
468 | 0 | 75 | ||
469 | === modified file 'po/unity-scope-click.pot' | |||
470 | --- po/unity-scope-click.pot 2014-06-25 13:43:08 +0000 | |||
471 | +++ po/unity-scope-click.pot 2014-06-26 18:57:41 +0000 | |||
472 | @@ -8,7 +8,7 @@ | |||
473 | 8 | msgstr "" | 8 | msgstr "" |
474 | 9 | "Project-Id-Version: PACKAGE VERSION\n" | 9 | "Project-Id-Version: PACKAGE VERSION\n" |
475 | 10 | "Report-Msgid-Bugs-To: \n" | 10 | "Report-Msgid-Bugs-To: \n" |
477 | 11 | "POT-Creation-Date: 2014-06-25 09:42-0400\n" | 11 | "POT-Creation-Date: 2014-06-26 14:08-0400\n" |
478 | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" | 12 | "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" |
479 | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" | 13 | "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" |
480 | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" | 14 | "Language-Team: LANGUAGE <LL@li.org>\n" |
481 | @@ -107,11 +107,14 @@ | |||
482 | 107 | msgid "✔ INSTALLED" | 107 | msgid "✔ INSTALLED" |
483 | 108 | msgstr "" | 108 | msgstr "" |
484 | 109 | 109 | ||
487 | 110 | #. TODO: get the real price from the webservice (upcoming branch) | 110 | #: ../scope/clickstore/store-query.cpp:235 |
486 | 111 | #: ../scope/clickstore/store-query.cpp:236 | ||
488 | 112 | msgid "FREE" | 111 | msgid "FREE" |
489 | 113 | msgstr "" | 112 | msgstr "" |
490 | 114 | 113 | ||
491 | 115 | #: ../scope/clickstore/store-query.cpp:331 | 114 | #: ../scope/clickstore/store-query.cpp:331 |
492 | 116 | msgid "Available" | 115 | msgid "Available" |
493 | 117 | msgstr "" | 116 | msgstr "" |
494 | 117 | |||
495 | 118 | #: ../scope/clickstore/store-query.cpp:335 | ||
496 | 119 | msgid "Recommended" | ||
497 | 120 | msgstr "" | ||
498 | 118 | 121 | ||
499 | === modified file 'scope/clickstore/store-query.cpp' | |||
500 | --- scope/clickstore/store-query.cpp 2014-06-24 16:44:03 +0000 | |||
501 | +++ scope/clickstore/store-query.cpp 2014-06-26 18:57:41 +0000 | |||
502 | @@ -232,8 +232,8 @@ | |||
503 | 232 | res[click::Query::ResultKeys::VERSION] = installed->version; | 232 | res[click::Query::ResultKeys::VERSION] = installed->version; |
504 | 233 | } else { | 233 | } else { |
505 | 234 | res[click::Query::ResultKeys::INSTALLED] = false; | 234 | res[click::Query::ResultKeys::INSTALLED] = false; |
506 | 235 | res["subtitle"] = _("FREE"); | ||
507 | 235 | // TODO: get the real price from the webservice (upcoming branch) | 236 | // TODO: get the real price from the webservice (upcoming branch) |
508 | 236 | res["subtitle"] = _("FREE"); | ||
509 | 237 | } | 237 | } |
510 | 238 | 238 | ||
511 | 239 | this->push_result(searchReply, res); | 239 | this->push_result(searchReply, res); |
512 | @@ -330,17 +330,28 @@ | |||
513 | 330 | scopes::CategoryRenderer categoryRenderer(categoryTemplate); | 330 | scopes::CategoryRenderer categoryRenderer(categoryTemplate); |
514 | 331 | auto category = register_category(searchReply, "appstore", _("Available"), "", categoryRenderer); | 331 | auto category = register_category(searchReply, "appstore", _("Available"), "", categoryRenderer); |
515 | 332 | 332 | ||
516 | 333 | scopes::CategoryRenderer recommendsCatRenderer(categoryTemplate); | ||
517 | 334 | auto recommendsCategory = register_category(searchReply, "recommends", | ||
518 | 335 | _("Recommended"), "", | ||
519 | 336 | recommendsCatRenderer); | ||
520 | 337 | |||
521 | 333 | assert(searchReply); | 338 | assert(searchReply); |
522 | 334 | 339 | ||
523 | 335 | run_under_qt([=]() | 340 | run_under_qt([=]() |
524 | 336 | { | 341 | { |
526 | 337 | auto search_cb = [this, searchReply, category, installedPackages](Packages packages) { | 342 | auto search_cb = [this, searchReply, |
527 | 343 | category, recommendsCategory, | ||
528 | 344 | installedPackages](Packages packages, Packages recommends) { | ||
529 | 338 | qDebug("search callback"); | 345 | qDebug("search callback"); |
530 | 339 | 346 | ||
531 | 340 | // handle packages data | 347 | // handle packages data |
532 | 341 | foreach (auto p, packages) { | 348 | foreach (auto p, packages) { |
533 | 342 | push_package(searchReply, category, installedPackages, p); | 349 | push_package(searchReply, category, installedPackages, p); |
534 | 343 | } | 350 | } |
535 | 351 | foreach (auto r, recommends) { | ||
536 | 352 | push_package(searchReply, recommendsCategory, | ||
537 | 353 | installedPackages, r); | ||
538 | 354 | } | ||
539 | 344 | qDebug() << "search completed"; | 355 | qDebug() << "search completed"; |
540 | 345 | this->finished(searchReply); //FIXME: this shouldn't be needed | 356 | this->finished(searchReply); //FIXME: this shouldn't be needed |
541 | 346 | }; | 357 | }; |
542 | 347 | 358 | ||
543 | === modified file 'scope/tests/integration/webclient_integration.cpp' | |||
544 | --- scope/tests/integration/webclient_integration.cpp 2014-06-23 10:25:44 +0000 | |||
545 | +++ scope/tests/integration/webclient_integration.cpp 2014-06-26 18:57:41 +0000 | |||
546 | @@ -103,7 +103,8 @@ | |||
547 | 103 | new click::web::Client(namPtr)); | 103 | new click::web::Client(namPtr)); |
548 | 104 | click::Index index(clientPtr); | 104 | click::Index index(clientPtr); |
549 | 105 | click::Packages packages; | 105 | click::Packages packages; |
551 | 106 | index.search("qr,architecture:armhf", [&, this](click::Packages found_packages){ | 106 | index.search("qr", [&, this](click::Packages found_packages, |
552 | 107 | click::Packages){ | ||
553 | 107 | packages = found_packages; | 108 | packages = found_packages; |
554 | 108 | Quit(); | 109 | Quit(); |
555 | 109 | }); | 110 | }); |
556 | 110 | 111 | ||
557 | === modified file 'scope/tests/test_query.cpp' | |||
558 | --- scope/tests/test_query.cpp 2014-06-23 10:25:44 +0000 | |||
559 | +++ scope/tests/test_query.cpp 2014-06-26 18:57:41 +0000 | |||
560 | @@ -58,9 +58,11 @@ | |||
561 | 58 | 58 | ||
562 | 59 | class MockIndex : public click::Index { | 59 | class MockIndex : public click::Index { |
563 | 60 | click::Packages packages; | 60 | click::Packages packages; |
564 | 61 | click::Packages recommends; | ||
565 | 61 | click::DepartmentList departments; | 62 | click::DepartmentList departments; |
566 | 62 | click::DepartmentList bootstrap_departments; | 63 | click::DepartmentList bootstrap_departments; |
567 | 63 | click::HighlightList bootstrap_highlights; | 64 | click::HighlightList bootstrap_highlights; |
568 | 65 | |||
569 | 64 | public: | 66 | public: |
570 | 65 | MockIndex(click::Packages packages = click::Packages(), | 67 | MockIndex(click::Packages packages = click::Packages(), |
571 | 66 | click::DepartmentList departments = click::DepartmentList(), | 68 | click::DepartmentList departments = click::DepartmentList(), |
572 | @@ -73,20 +75,23 @@ | |||
573 | 73 | 75 | ||
574 | 74 | } | 76 | } |
575 | 75 | 77 | ||
577 | 76 | click::web::Cancellable search(const std::string &query, std::function<void (click::Packages)> callback) override | 78 | click::web::Cancellable search(const std::string &query, std::function<void (click::Packages, click::Packages)> callback) override |
578 | 77 | { | 79 | { |
579 | 78 | do_search(query, callback); | 80 | do_search(query, callback); |
581 | 79 | callback(packages); | 81 | callback(packages, recommends); |
582 | 80 | return click::web::Cancellable(); | 82 | return click::web::Cancellable(); |
583 | 81 | } | 83 | } |
584 | 82 | 84 | ||
585 | 85 | |||
586 | 83 | click::web::Cancellable bootstrap(std::function<void(const click::DepartmentList&, const click::HighlightList&, Error, int)> callback) override | 86 | click::web::Cancellable bootstrap(std::function<void(const click::DepartmentList&, const click::HighlightList&, Error, int)> callback) override |
587 | 84 | { | 87 | { |
588 | 85 | callback(bootstrap_departments, bootstrap_highlights, click::Index::Error::NoError, 0); | 88 | callback(bootstrap_departments, bootstrap_highlights, click::Index::Error::NoError, 0); |
589 | 86 | return click::web::Cancellable(); | 89 | return click::web::Cancellable(); |
590 | 87 | } | 90 | } |
591 | 88 | 91 | ||
593 | 89 | MOCK_METHOD2(do_search, void(const std::string&, std::function<void(click::Packages)>)); | 92 | MOCK_METHOD2(do_search, |
594 | 93 | void(const std::string&, | ||
595 | 94 | std::function<void(click::Packages, click::Packages)>)); | ||
596 | 90 | }; | 95 | }; |
597 | 91 | 96 | ||
598 | 92 | class MockQueryBase : public click::Query { | 97 | class MockQueryBase : public click::Query { |
599 | @@ -178,7 +183,7 @@ | |||
600 | 178 | 183 | ||
601 | 179 | scopes::CategoryRenderer renderer("{}"); | 184 | scopes::CategoryRenderer renderer("{}"); |
602 | 180 | auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer); | 185 | auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer); |
604 | 181 | EXPECT_CALL(q, register_category(_, _, _, _, _)).WillOnce(Return(ptrCat)); | 186 | EXPECT_CALL(q, register_category(_, _, _, _, _)).Times(2).WillRepeatedly(Return(ptrCat)); |
605 | 182 | q.wrap_add_available_apps(reply, no_installed_packages, FAKE_CATEGORY_TEMPLATE); | 187 | q.wrap_add_available_apps(reply, no_installed_packages, FAKE_CATEGORY_TEMPLATE); |
606 | 183 | } | 188 | } |
607 | 184 | 189 | ||
608 | @@ -198,7 +203,7 @@ | |||
609 | 198 | 203 | ||
610 | 199 | scopes::CategoryRenderer renderer("{}"); | 204 | scopes::CategoryRenderer renderer("{}"); |
611 | 200 | auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer); | 205 | auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer); |
613 | 201 | EXPECT_CALL(q, register_category(_, _, _, _, _)).WillOnce(Return(ptrCat)); | 206 | EXPECT_CALL(q, register_category(_, _, _, _, _)).Times(2).WillRepeatedly(Return(ptrCat)); |
614 | 202 | 207 | ||
615 | 203 | scopes::testing::MockSearchReply mock_reply; | 208 | scopes::testing::MockSearchReply mock_reply; |
616 | 204 | scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){}); | 209 | scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){}); |
617 | @@ -224,7 +229,7 @@ | |||
618 | 224 | 229 | ||
619 | 225 | scopes::CategoryRenderer renderer("{}"); | 230 | scopes::CategoryRenderer renderer("{}"); |
620 | 226 | auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer); | 231 | auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer); |
622 | 227 | EXPECT_CALL(q, register_category(_, _, _, _, _)).WillOnce(Return(ptrCat)); | 232 | EXPECT_CALL(q, register_category(_, _, _, _, _)).Times(2).WillRepeatedly(Return(ptrCat)); |
623 | 228 | 233 | ||
624 | 229 | scopes::testing::MockSearchReply mock_reply; | 234 | scopes::testing::MockSearchReply mock_reply; |
625 | 230 | scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){}); | 235 | scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){}); |
626 | @@ -273,7 +278,7 @@ | |||
627 | 273 | 278 | ||
628 | 274 | scopes::CategoryRenderer renderer("{}"); | 279 | scopes::CategoryRenderer renderer("{}"); |
629 | 275 | auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer); | 280 | auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer); |
631 | 276 | EXPECT_CALL(q, register_category(_, _, _, _, _)).WillOnce(Return(ptrCat)); | 281 | EXPECT_CALL(q, register_category(_, _, _, _, _)).Times(2).WillRepeatedly(Return(ptrCat)); |
632 | 277 | 282 | ||
633 | 278 | scopes::testing::MockSearchReply mock_reply; | 283 | scopes::testing::MockSearchReply mock_reply; |
634 | 279 | scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){}); | 284 | scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){}); |
635 | @@ -303,7 +308,7 @@ | |||
636 | 303 | 308 | ||
637 | 304 | scopes::CategoryRenderer renderer("{}"); | 309 | scopes::CategoryRenderer renderer("{}"); |
638 | 305 | auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer); | 310 | auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer); |
640 | 306 | EXPECT_CALL(q, register_category(_, _, _, _, _)).WillOnce(Return(ptrCat)); | 311 | EXPECT_CALL(q, register_category(_, _, _, _, _)).Times(2).WillRepeatedly(Return(ptrCat)); |
641 | 307 | 312 | ||
642 | 308 | scopes::testing::MockSearchReply mock_reply; | 313 | scopes::testing::MockSearchReply mock_reply; |
643 | 309 | scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){}); | 314 | scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){}); |
PASSED: Continuous integration, rev:301 jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- ci/149/ jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- amd64-ci/ 124 jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- armhf-ci/ 123 jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- armhf-ci/ 123/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- i386-ci/ 123
http://
Executed test runs:
SUCCESS: http://
SUCCESS: http://
deb: http://
SUCCESS: http://
Click here to trigger a rebuild: s-jenkins. ubuntu- ci:8080/ job/unity- team-unity- scope-click- devel-ci/ 149/rebuild
http://