Merge lp:~alecu/unity-scope-click/a-few-renames into lp:unity-scope-click/devel
- a-few-renames
- Merge into devel
Proposed by
Alejandro J. Cura
Status: | Merged |
---|---|
Approved by: | dobey |
Approved revision: | 291 |
Merged at revision: | 291 |
Proposed branch: | lp:~alecu/unity-scope-click/a-few-renames |
Merge into: | lp:unity-scope-click/devel |
Diff against target: |
696 lines (+106/-97) 14 files modified
libclickscope/click/index.cpp (+3/-3) libclickscope/click/index.h (+1/-1) libclickscope/click/interface.cpp (+16/-14) libclickscope/click/interface.h (+4/-4) libclickscope/click/package.cpp (+3/-3) libclickscope/click/package.h (+11/-4) libclickscope/click/preview.cpp (+21/-22) libclickscope/click/preview.h (+3/-2) libclickscope/tests/test_index.cpp (+12/-12) libclickscope/tests/test_interface.cpp (+18/-18) scope/clickstore/store-query.cpp (+2/-2) scope/tests/click_interface_tool/click_interface_tool.cpp (+2/-2) scope/tests/integration/webclient_integration.cpp (+2/-2) scope/tests/test_query.cpp (+8/-8) |
To merge this branch: | bzr merge lp:~alecu/unity-scope-click/a-few-renames |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
dobey (community) | Approve | ||
PS Jenkins bot (community) | continuous-integration | Approve | |
Review via email: mp+223002@code.launchpad.net |
Commit message
Refactorings splitted from the following branch
Description of the change
To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote : | # |
review:
Approve
(continuous-integration)
Revision history for this message
dobey (dobey) : | # |
review:
Needs Fixing
- 291. By Alejandro J. Cura
-
Removing the hashing function for Package
Revision history for this message
dobey (dobey) : | # |
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1 | === modified file 'libclickscope/click/index.cpp' |
2 | --- libclickscope/click/index.cpp 2014-05-26 14:02:45 +0000 |
3 | +++ libclickscope/click/index.cpp 2014-06-13 19:58:51 +0000 |
4 | @@ -110,7 +110,7 @@ |
5 | }; |
6 | } |
7 | |
8 | -click::web::Cancellable Index::search (const std::string& query, std::function<void(click::PackageList)> callback) |
9 | +click::web::Cancellable Index::search (const std::string& query, std::function<void(click::Packages)> callback) |
10 | { |
11 | click::web::CallParams params; |
12 | const std::string built_query(build_index_query(query)); |
13 | @@ -122,7 +122,7 @@ |
14 | Json::Reader reader; |
15 | Json::Value root; |
16 | |
17 | - click::PackageList pl; |
18 | + click::Packages pl; |
19 | if (reader.parse(reply.toUtf8().constData(), root)) { |
20 | pl = click::package_list_from_json_node(root); |
21 | qDebug() << "found packages:" << pl.size(); |
22 | @@ -131,7 +131,7 @@ |
23 | }); |
24 | QObject::connect(response.data(), &click::web::Response::error, [=](QString /*description*/) { |
25 | qDebug() << "No packages found due to network error"; |
26 | - click::PackageList pl; |
27 | + click::Packages pl; |
28 | qDebug() << "calling callback"; |
29 | callback(pl); |
30 | qDebug() << " ...Done!"; |
31 | |
32 | === modified file 'libclickscope/click/index.h' |
33 | --- libclickscope/click/index.h 2014-05-26 14:02:45 +0000 |
34 | +++ libclickscope/click/index.h 2014-06-13 19:58:51 +0000 |
35 | @@ -71,7 +71,7 @@ |
36 | enum class Error {NoError, CredentialsError, NetworkError}; |
37 | Index(const QSharedPointer<click::web::Client>& client, |
38 | const QSharedPointer<Configuration> configuration=QSharedPointer<Configuration>(new Configuration())); |
39 | - virtual click::web::Cancellable search (const std::string& query, std::function<void(PackageList)> callback); |
40 | + virtual click::web::Cancellable search (const std::string& query, std::function<void(Packages)> callback); |
41 | virtual click::web::Cancellable get_details(const std::string& package_name, std::function<void(PackageDetails, Error)> callback); |
42 | virtual ~Index(); |
43 | |
44 | |
45 | === modified file 'libclickscope/click/interface.cpp' |
46 | --- libclickscope/click/interface.cpp 2014-06-13 15:26:54 +0000 |
47 | +++ libclickscope/click/interface.cpp 2014-06-13 19:58:51 +0000 |
48 | @@ -378,26 +378,28 @@ |
49 | return manifest; |
50 | } |
51 | |
52 | -void Interface::get_manifests(std::function<void(ManifestList, ManifestError)> callback) |
53 | +void Interface::get_manifests(std::function<void(ManifestList, InterfaceError)> callback) |
54 | { |
55 | std::string command = "click list --manifest"; |
56 | qDebug() << "Running command:" << command.c_str(); |
57 | - run_process(command, [callback](int code, const std::string& stdout_data, const std::string&) { |
58 | + run_process(command, [callback](int code, const std::string& stdout_data, const std::string& stderr_data) { |
59 | if (code == 0) { |
60 | try { |
61 | ManifestList manifests = manifest_list_from_json(stdout_data); |
62 | - callback(manifests, ManifestError::NoError); |
63 | + callback(manifests, InterfaceError::NoError); |
64 | } catch (...) { |
65 | - callback(ManifestList(), ManifestError::ParseError); |
66 | + qWarning() << "Can't parse 'click list --manifest' output: " << QString::fromStdString(stdout_data); |
67 | + callback(ManifestList(), InterfaceError::ParseError); |
68 | } |
69 | } else { |
70 | - callback(ManifestList(), ManifestError::CallError); |
71 | + qWarning() << "Error" << code << "running 'click list --manifest': " << QString::fromStdString(stderr_data); |
72 | + callback(ManifestList(), InterfaceError::CallError); |
73 | } |
74 | }); |
75 | } |
76 | |
77 | void Interface::get_manifest_for_app(const std::string &app_id, |
78 | - std::function<void(Manifest, ManifestError)> callback) |
79 | + std::function<void(Manifest, InterfaceError)> callback) |
80 | { |
81 | std::string command = "click info " + app_id; |
82 | qDebug() << "Running command:" << command.c_str(); |
83 | @@ -405,23 +407,23 @@ |
84 | if (code == 0) { |
85 | try { |
86 | Manifest manifest = manifest_from_json(stdout_data); |
87 | - callback(manifest, ManifestError::NoError); |
88 | + callback(manifest, InterfaceError::NoError); |
89 | } catch (...) { |
90 | - callback(Manifest(), ManifestError::ParseError); |
91 | + callback(Manifest(), InterfaceError::ParseError); |
92 | } |
93 | } else { |
94 | - callback(Manifest(), ManifestError::CallError); |
95 | + callback(Manifest(), InterfaceError::CallError); |
96 | } |
97 | }); |
98 | } |
99 | |
100 | void Interface::get_dotdesktop_filename(const std::string &app_id, |
101 | - std::function<void(std::string, ManifestError)> callback) |
102 | + std::function<void(std::string, InterfaceError)> callback) |
103 | { |
104 | - get_manifest_for_app(app_id, [app_id, callback] (Manifest manifest, ManifestError error) { |
105 | + get_manifest_for_app(app_id, [app_id, callback] (Manifest manifest, InterfaceError error) { |
106 | qDebug() << "in get_dotdesktop_filename callback"; |
107 | |
108 | - if (error != ManifestError::NoError){ |
109 | + if (error != InterfaceError::NoError){ |
110 | callback(std::string("Internal Error"), error); |
111 | return; |
112 | } |
113 | @@ -429,10 +431,10 @@ |
114 | |
115 | if (!manifest.name.empty()) { |
116 | std::string ddstr = manifest.name + "_" + manifest.first_app_name + "_" + manifest.version + ".desktop"; |
117 | - callback(ddstr, ManifestError::NoError); |
118 | + callback(ddstr, InterfaceError::NoError); |
119 | } else { |
120 | qCritical() << "Warning: no manifest found for " << app_id.c_str(); |
121 | - callback(std::string("Not found"), ManifestError::CallError); |
122 | + callback(std::string("Not found"), InterfaceError::CallError); |
123 | } |
124 | }); |
125 | } |
126 | |
127 | === modified file 'libclickscope/click/interface.h' |
128 | --- libclickscope/click/interface.h 2014-06-13 15:21:16 +0000 |
129 | +++ libclickscope/click/interface.h 2014-06-13 19:58:51 +0000 |
130 | @@ -62,7 +62,7 @@ |
131 | bool removable = false; |
132 | }; |
133 | |
134 | -enum class ManifestError {NoError, CallError, ParseError}; |
135 | +enum class InterfaceError {NoError, CallError, ParseError}; |
136 | typedef std::list<Manifest> ManifestList; |
137 | |
138 | ManifestList manifest_list_from_json(const std::string& json); |
139 | @@ -88,10 +88,10 @@ |
140 | |
141 | static bool is_icon_identifier(const std::string &icon_id); |
142 | static std::string add_theme_scheme(const std::string &filename); |
143 | - virtual void get_manifests(std::function<void(ManifestList, ManifestError)> callback); |
144 | - virtual void get_manifest_for_app(const std::string &app_id, std::function<void(Manifest, ManifestError)> callback); |
145 | + virtual void get_manifests(std::function<void(ManifestList, InterfaceError)> callback); |
146 | + virtual void get_manifest_for_app(const std::string &app_id, std::function<void(Manifest, InterfaceError)> callback); |
147 | virtual void get_dotdesktop_filename(const std::string &app_id, |
148 | - std::function<void(std::string filename, ManifestError)> callback); |
149 | + std::function<void(std::string filename, InterfaceError)> callback); |
150 | constexpr static const char* ENV_SHOW_DESKTOP_APPS {"CLICK_SCOPE_SHOW_DESKTOP_APPS"}; |
151 | virtual bool is_visible_app(const unity::util::IniParser& keyFile); |
152 | virtual bool show_desktop_apps(); |
153 | |
154 | === modified file 'libclickscope/click/package.cpp' |
155 | --- libclickscope/click/package.cpp 2014-05-26 14:02:45 +0000 |
156 | +++ libclickscope/click/package.cpp 2014-06-13 19:58:51 +0000 |
157 | @@ -80,9 +80,9 @@ |
158 | return p; |
159 | } |
160 | |
161 | -PackageList package_list_from_json_node(const Json::Value& root) |
162 | +Packages package_list_from_json_node(const Json::Value& root) |
163 | { |
164 | - PackageList pl; |
165 | + Packages pl; |
166 | if (root.isObject() && root.isMember(Package::JsonKeys::embedded)) |
167 | { |
168 | auto const emb = root[Package::JsonKeys::embedded]; |
169 | @@ -114,7 +114,7 @@ |
170 | return pl; |
171 | } |
172 | |
173 | -PackageList package_list_from_json(const std::string& json) |
174 | +Packages package_list_from_json(const std::string& json) |
175 | { |
176 | std::istringstream is(json); |
177 | |
178 | |
179 | === modified file 'libclickscope/click/package.h' |
180 | --- libclickscope/click/package.h 2014-05-26 14:02:45 +0000 |
181 | +++ libclickscope/click/package.h 2014-06-13 19:58:51 +0000 |
182 | @@ -30,8 +30,10 @@ |
183 | #ifndef CLICK_PACKAGE_H |
184 | #define CLICK_PACKAGE_H |
185 | |
186 | +#include <list> |
187 | #include <string> |
188 | -#include <list> |
189 | +#include <unordered_set> |
190 | +#include <vector> |
191 | |
192 | #include <json/json.h> |
193 | |
194 | @@ -76,6 +78,11 @@ |
195 | version(version) |
196 | { |
197 | } |
198 | + Package(std::string name, std::string version) : |
199 | + name(name), |
200 | + version(version) |
201 | + { |
202 | + } |
203 | virtual ~Package() = default; |
204 | |
205 | std::string name; // formerly app_id |
206 | @@ -87,11 +94,11 @@ |
207 | void matches (std::string query, std::function<bool> callback); |
208 | }; |
209 | |
210 | -typedef std::list<Package> PackageList; |
211 | +typedef std::vector<Package> Packages; |
212 | |
213 | Package package_from_json_node(const Json::Value& item); |
214 | -PackageList package_list_from_json(const std::string& json); |
215 | -PackageList package_list_from_json_node(const Json::Value& root); |
216 | +Packages package_list_from_json(const std::string& json); |
217 | +Packages package_list_from_json_node(const Json::Value& root); |
218 | |
219 | struct PackageDetails |
220 | { |
221 | |
222 | === modified file 'libclickscope/click/preview.cpp' |
223 | --- libclickscope/click/preview.cpp 2014-06-03 16:36:44 +0000 |
224 | +++ libclickscope/click/preview.cpp 2014-06-13 19:58:51 +0000 |
225 | @@ -431,29 +431,28 @@ |
226 | // Do nothing as we are not submitting a review. |
227 | } |
228 | |
229 | - // Get the removable flag from the click manifest. |
230 | - bool removable = false; |
231 | - std::promise<bool> manifest_promise; |
232 | - std::future<bool> manifest_future = manifest_promise.get_future(); |
233 | + // Get the click manifest. |
234 | + Manifest manifest; |
235 | + std::promise<Manifest> manifest_promise; |
236 | + std::future<Manifest> manifest_future = manifest_promise.get_future(); |
237 | std::string app_name = result["name"].get_string(); |
238 | if (!app_name.empty()) { |
239 | qt::core::world::enter_with_task([&]() { |
240 | click::Interface().get_manifest_for_app(app_name, |
241 | - [&](Manifest manifest, ManifestError error) { |
242 | + [&](Manifest found_manifest, InterfaceError error) { |
243 | qDebug() << "Got manifest for:" << app_name.c_str(); |
244 | - removable = manifest.removable; |
245 | |
246 | // Fill in required data about the package being reviewed. |
247 | - review.package_name = manifest.name; |
248 | - review.package_version = manifest.version; |
249 | + review.package_name = found_manifest.name; |
250 | + review.package_version = found_manifest.version; |
251 | |
252 | - if (error != click::ManifestError::NoError) { |
253 | + if (error != click::InterfaceError::NoError) { |
254 | qDebug() << "There was an error getting the manifest for:" << app_name.c_str(); |
255 | } |
256 | - manifest_promise.set_value(true); |
257 | + manifest_promise.set_value(found_manifest); |
258 | }); |
259 | }); |
260 | - manifest_future.get(); |
261 | + manifest = manifest_future.get(); |
262 | if (review.rating > 0) { |
263 | std::promise<bool> submit_promise; |
264 | std::future<bool> submit_future = submit_promise.get_future(); |
265 | @@ -469,13 +468,13 @@ |
266 | submit_future.get(); |
267 | } |
268 | } |
269 | - getApplicationUri([this, reply, removable, app_name, &review](const std::string& uri) { |
270 | - populateDetails([this, reply, uri, removable, app_name, &review](const PackageDetails &details){ |
271 | + getApplicationUri(manifest, [this, reply, manifest, app_name, &review](const std::string& uri) { |
272 | + populateDetails([this, reply, uri, manifest, app_name, &review](const PackageDetails &details){ |
273 | reply->push(headerWidgets(details)); |
274 | - reply->push(createButtons(uri, removable)); |
275 | + reply->push(createButtons(uri, manifest)); |
276 | reply->push(descriptionWidgets(details)); |
277 | |
278 | - if (review.rating == 0 && removable) { |
279 | + if (review.rating == 0 && manifest.removable) { |
280 | scopes::PreviewWidgetList review_input; |
281 | scopes::PreviewWidget rating("rating", "rating-input"); |
282 | rating.add_attribute_value("required", scopes::Variant("rating")); |
283 | @@ -496,7 +495,7 @@ |
284 | } |
285 | |
286 | scopes::PreviewWidgetList InstalledPreview::createButtons(const std::string& uri, |
287 | - bool removable) |
288 | + const Manifest& manifest) |
289 | { |
290 | scopes::PreviewWidgetList widgets; |
291 | scopes::PreviewWidget buttons("buttons", "actions"); |
292 | @@ -510,21 +509,21 @@ |
293 | {"uri", scopes::Variant(uri)} |
294 | }); |
295 | } |
296 | - if (removable) |
297 | + if (manifest.removable) |
298 | { |
299 | builder.add_tuple({ |
300 | {"id", scopes::Variant(click::Preview::Actions::UNINSTALL_CLICK)}, |
301 | {"label", scopes::Variant(_("Uninstall"))} |
302 | }); |
303 | } |
304 | - if (!uri.empty() || removable) { |
305 | + if (!uri.empty() || manifest.removable) { |
306 | buttons.add_attribute_value("actions", builder.end()); |
307 | widgets.push_back(buttons); |
308 | } |
309 | return widgets; |
310 | } |
311 | |
312 | -void InstalledPreview::getApplicationUri(std::function<void(const std::string&)> callback) |
313 | +void InstalledPreview::getApplicationUri(const Manifest& /*manifest*/, std::function<void(const std::string&)> callback) |
314 | { |
315 | std::string uri; |
316 | QString app_url = QString::fromStdString(result.uri()); |
317 | @@ -533,12 +532,12 @@ |
318 | // this can happen if the app was just installed and we have its http uri from the Result. |
319 | if (!app_url.startsWith("application:///")) { |
320 | const std::string name = result["name"].get_string(); |
321 | - auto ft = qt::core::world::enter_with_task([this, name, callback] () |
322 | + qt::core::world::enter_with_task([this, name, callback] () |
323 | { |
324 | click::Interface().get_dotdesktop_filename(name, |
325 | - [callback] (std::string val, click::ManifestError error) { |
326 | + [callback] (std::string val, click::InterfaceError error) { |
327 | std::string uri; |
328 | - if (error == click::ManifestError::NoError) { |
329 | + if (error == click::InterfaceError::NoError) { |
330 | uri = "application:///" + val; |
331 | } |
332 | callback(uri); |
333 | |
334 | === modified file 'libclickscope/click/preview.h' |
335 | --- libclickscope/click/preview.h 2014-06-03 16:21:22 +0000 |
336 | +++ libclickscope/click/preview.h 2014-06-13 19:58:51 +0000 |
337 | @@ -47,6 +47,7 @@ |
338 | |
339 | namespace click { |
340 | |
341 | +class Manifest; |
342 | class PreviewStrategy; |
343 | |
344 | class Preview : public unity::scopes::PreviewQueryBase |
345 | @@ -164,11 +165,11 @@ |
346 | void run(unity::scopes::PreviewReplyProxy const& reply) override; |
347 | |
348 | protected: |
349 | - void getApplicationUri(std::function<void(const std::string&)> callback); |
350 | + void getApplicationUri(const Manifest& manifest, std::function<void(const std::string&)> callback); |
351 | |
352 | private: |
353 | static scopes::PreviewWidgetList createButtons(const std::string& uri, |
354 | - bool removable); |
355 | + const click::Manifest& manifest); |
356 | scopes::ActionMetadata metadata; |
357 | }; |
358 | |
359 | |
360 | === modified file 'libclickscope/tests/test_index.cpp' |
361 | --- libclickscope/tests/test_index.cpp 2014-05-26 14:27:31 +0000 |
362 | +++ libclickscope/tests/test_index.cpp 2014-06-13 19:58:51 +0000 |
363 | @@ -79,7 +79,7 @@ |
364 | DefaultValue<std::map<std::string, std::string>>::Set(std::map<std::string, std::string>()); |
365 | } |
366 | public: |
367 | - MOCK_METHOD1(search_callback, void(click::PackageList)); |
368 | + MOCK_METHOD1(search_callback, void(click::Packages)); |
369 | MOCK_METHOD2(details_callback, void(click::PackageDetails, click::Index::Error)); |
370 | }; |
371 | |
372 | @@ -100,7 +100,7 @@ |
373 | .Times(1) |
374 | .WillOnce(Return(response)); |
375 | |
376 | - indexPtr->search("", [](click::PackageList) {}); |
377 | + indexPtr->search("", [](click::Packages) {}); |
378 | } |
379 | |
380 | TEST_F(IndexTest, testSearchSendsBuiltQueryAsParam) |
381 | @@ -120,7 +120,7 @@ |
382 | .Times(1) |
383 | .WillOnce(Return(FAKE_BUILT_QUERY)); |
384 | |
385 | - indexPtr->search(FAKE_QUERY, [](click::PackageList) {}); |
386 | + indexPtr->search(FAKE_QUERY, [](click::Packages) {}); |
387 | } |
388 | |
389 | TEST_F(IndexTest, testSearchSendsRightPath) |
390 | @@ -133,7 +133,7 @@ |
391 | .Times(1) |
392 | .WillOnce(Return(response)); |
393 | |
394 | - indexPtr->search("", [](click::PackageList) {}); |
395 | + indexPtr->search("", [](click::Packages) {}); |
396 | } |
397 | |
398 | TEST_F(IndexTest, testSearchCallbackIsCalled) |
399 | @@ -150,7 +150,7 @@ |
400 | .WillOnce(Return(response)); |
401 | EXPECT_CALL(*this, search_callback(_)).Times(1); |
402 | |
403 | - indexPtr->search("", [this](click::PackageList packages){ |
404 | + indexPtr->search("", [this](click::Packages packages){ |
405 | search_callback(packages); |
406 | }); |
407 | response->replyFinished(); |
408 | @@ -168,10 +168,10 @@ |
409 | EXPECT_CALL(*clientPtr, callImpl(_, _, _, _, _, _)) |
410 | .Times(1) |
411 | .WillOnce(Return(response)); |
412 | - click::PackageList empty_package_list; |
413 | + click::Packages empty_package_list; |
414 | EXPECT_CALL(*this, search_callback(empty_package_list)).Times(1); |
415 | |
416 | - indexPtr->search("", [this](click::PackageList packages){ |
417 | + indexPtr->search("", [this](click::Packages packages){ |
418 | search_callback(packages); |
419 | }); |
420 | response->replyFinished(); |
421 | @@ -189,7 +189,7 @@ |
422 | EXPECT_CALL(*clientPtr, callImpl(_, _, _, _, _, _)) |
423 | .Times(1) |
424 | .WillOnce(Return(response)); |
425 | - click::PackageList single_package_list = |
426 | + click::Packages single_package_list = |
427 | { |
428 | click::Package |
429 | { |
430 | @@ -200,7 +200,7 @@ |
431 | }; |
432 | EXPECT_CALL(*this, search_callback(single_package_list)).Times(1); |
433 | |
434 | - indexPtr->search("", [this](click::PackageList packages){ |
435 | + indexPtr->search("", [this](click::Packages packages){ |
436 | search_callback(packages); |
437 | }); |
438 | response->replyFinished(); |
439 | @@ -215,7 +215,7 @@ |
440 | .Times(1) |
441 | .WillOnce(Return(response)); |
442 | |
443 | - auto search_operation = indexPtr->search("", [](click::PackageList) {}); |
444 | + auto search_operation = indexPtr->search("", [](click::Packages) {}); |
445 | EXPECT_CALL(reply.instance, abort()).Times(1); |
446 | search_operation.cancel(); |
447 | } |
448 | @@ -234,11 +234,11 @@ |
449 | .Times(1) |
450 | .WillOnce(Return(response)); |
451 | EXPECT_CALL(reply.instance, errorString()).Times(1).WillOnce(Return("fake error")); |
452 | - indexPtr->search("", [this](click::PackageList packages){ |
453 | + indexPtr->search("", [this](click::Packages packages){ |
454 | search_callback(packages); |
455 | }); |
456 | |
457 | - click::PackageList empty_package_list; |
458 | + click::Packages empty_package_list; |
459 | EXPECT_CALL(*this, search_callback(empty_package_list)).Times(1); |
460 | |
461 | emit reply.instance.error(QNetworkReply::UnknownNetworkError); |
462 | |
463 | === modified file 'libclickscope/tests/test_interface.cpp' |
464 | --- libclickscope/tests/test_interface.cpp 2014-06-13 16:50:15 +0000 |
465 | +++ libclickscope/tests/test_interface.cpp 2014-06-13 19:58:51 +0000 |
466 | @@ -117,8 +117,8 @@ |
467 | |
468 | class ClickInterfaceTest : public ::testing::Test { |
469 | public: |
470 | - MOCK_METHOD2(manifest_callback, void(Manifest, ManifestError)); |
471 | - MOCK_METHOD2(manifests_callback, void(ManifestList, ManifestError)); |
472 | + MOCK_METHOD2(manifest_callback, void(Manifest, InterfaceError)); |
473 | + MOCK_METHOD2(manifests_callback, void(ManifestList, InterfaceError)); |
474 | }; |
475 | |
476 | } |
477 | @@ -453,7 +453,7 @@ |
478 | std::string command = "click info " + FAKE_PACKAGENAME; |
479 | EXPECT_CALL(iface, run_process(command, _)). |
480 | Times(1); |
481 | - iface.get_manifest_for_app(FAKE_PACKAGENAME, [](Manifest, ManifestError){}); |
482 | + iface.get_manifest_for_app(FAKE_PACKAGENAME, [](Manifest, InterfaceError){}); |
483 | } |
484 | |
485 | TEST_F(ClickInterfaceTest, testGetManifestForAppParseError) |
486 | @@ -466,9 +466,9 @@ |
487 | const std::string&)> callback){ |
488 | callback(0, "INVALID JSON", ""); |
489 | })); |
490 | - EXPECT_CALL(*this, manifest_callback(_, ManifestError::ParseError)); |
491 | + EXPECT_CALL(*this, manifest_callback(_, InterfaceError::ParseError)); |
492 | iface.get_manifest_for_app(FAKE_PACKAGENAME, [this](Manifest manifest, |
493 | - ManifestError error){ |
494 | + InterfaceError error){ |
495 | manifest_callback(manifest, error); |
496 | }); |
497 | } |
498 | @@ -483,9 +483,9 @@ |
499 | const std::string&)> callback){ |
500 | callback(-1, "", "CRITICAL: FAIL"); |
501 | })); |
502 | - EXPECT_CALL(*this, manifest_callback(_, ManifestError::CallError)); |
503 | + EXPECT_CALL(*this, manifest_callback(_, InterfaceError::CallError)); |
504 | iface.get_manifest_for_app(FAKE_PACKAGENAME, [this](Manifest manifest, |
505 | - ManifestError error){ |
506 | + InterfaceError error){ |
507 | manifest_callback(manifest, error); |
508 | }); |
509 | } |
510 | @@ -501,8 +501,8 @@ |
511 | callback(0, FAKE_JSON_MANIFEST_REMOVABLE, ""); |
512 | })); |
513 | iface.get_manifest_for_app(FAKE_PACKAGENAME, [](Manifest manifest, |
514 | - ManifestError error){ |
515 | - ASSERT_TRUE(error == ManifestError::NoError); |
516 | + InterfaceError error){ |
517 | + ASSERT_TRUE(error == InterfaceError::NoError); |
518 | ASSERT_TRUE(manifest.removable); |
519 | }); |
520 | } |
521 | @@ -518,8 +518,8 @@ |
522 | callback(0, FAKE_JSON_MANIFEST_NONREMOVABLE, ""); |
523 | })); |
524 | iface.get_manifest_for_app(FAKE_PACKAGENAME, [](Manifest manifest, |
525 | - ManifestError error){ |
526 | - ASSERT_TRUE(error == ManifestError::NoError); |
527 | + InterfaceError error){ |
528 | + ASSERT_TRUE(error == InterfaceError::NoError); |
529 | ASSERT_FALSE(manifest.removable); |
530 | }); |
531 | } |
532 | @@ -530,7 +530,7 @@ |
533 | std::string command = "click list --manifest"; |
534 | EXPECT_CALL(iface, run_process(command, _)). |
535 | Times(1); |
536 | - iface.get_manifests([](ManifestList, ManifestError){}); |
537 | + iface.get_manifests([](ManifestList, InterfaceError){}); |
538 | } |
539 | |
540 | TEST_F(ClickInterfaceTest, testGetManifestsParseError) |
541 | @@ -543,8 +543,8 @@ |
542 | const std::string&)> callback){ |
543 | callback(0, "INVALID JSON", ""); |
544 | })); |
545 | - EXPECT_CALL(*this, manifests_callback(_, ManifestError::ParseError)); |
546 | - iface.get_manifests([this](ManifestList manifests, ManifestError error){ |
547 | + EXPECT_CALL(*this, manifests_callback(_, InterfaceError::ParseError)); |
548 | + iface.get_manifests([this](ManifestList manifests, InterfaceError error){ |
549 | manifests_callback(manifests, error); |
550 | }); |
551 | } |
552 | @@ -559,8 +559,8 @@ |
553 | const std::string&)> callback){ |
554 | callback(-1, "", "CRITICAL: FAIL"); |
555 | })); |
556 | - EXPECT_CALL(*this, manifests_callback(_, ManifestError::CallError)); |
557 | - iface.get_manifests([this](ManifestList manifests, ManifestError error){ |
558 | + EXPECT_CALL(*this, manifests_callback(_, InterfaceError::CallError)); |
559 | + iface.get_manifests([this](ManifestList manifests, InterfaceError error){ |
560 | manifests_callback(manifests, error); |
561 | }); |
562 | } |
563 | @@ -579,8 +579,8 @@ |
564 | const std::string&)> callback){ |
565 | callback(0, expected_str, ""); |
566 | })); |
567 | - iface.get_manifests([expected](ManifestList manifests, ManifestError error){ |
568 | - ASSERT_TRUE(error == ManifestError::NoError); |
569 | + iface.get_manifests([expected](ManifestList manifests, InterfaceError error){ |
570 | + ASSERT_TRUE(error == InterfaceError::NoError); |
571 | ASSERT_TRUE(manifests.size() == expected.size()); |
572 | }); |
573 | } |
574 | |
575 | === modified file 'scope/clickstore/store-query.cpp' |
576 | --- scope/clickstore/store-query.cpp 2014-05-27 09:37:28 +0000 |
577 | +++ scope/clickstore/store-query.cpp 2014-06-13 19:58:51 +0000 |
578 | @@ -28,9 +28,9 @@ |
579 | */ |
580 | |
581 | #include <click/application.h> |
582 | +#include <click/interface.h> |
583 | #include "store-query.h" |
584 | #include <click/qtbridge.h> |
585 | -#include <click/interface.h> |
586 | |
587 | #include <click/key_file_locator.h> |
588 | |
589 | @@ -166,7 +166,7 @@ |
590 | |
591 | run_under_qt([=]() |
592 | { |
593 | - auto search_cb = [this, searchReply, category, locallyInstalledApps](PackageList packages) { |
594 | + auto search_cb = [this, searchReply, category, locallyInstalledApps](click::Packages packages) { |
595 | qDebug("search callback"); |
596 | |
597 | // handle packages data |
598 | |
599 | === modified file 'scope/tests/click_interface_tool/click_interface_tool.cpp' |
600 | --- scope/tests/click_interface_tool/click_interface_tool.cpp 2014-05-13 19:32:29 +0000 |
601 | +++ scope/tests/click_interface_tool/click_interface_tool.cpp 2014-06-13 19:58:51 +0000 |
602 | @@ -51,8 +51,8 @@ |
603 | |
604 | QObject::connect(&timer, &QTimer::timeout, [&]() { |
605 | ci.get_dotdesktop_filename(std::string(argv[1]), |
606 | - [&a] (std::string val, click::ManifestError error){ |
607 | - if (error == click::ManifestError::NoError) { |
608 | + [&a] (std::string val, click::InterfaceError error){ |
609 | + if (error == click::InterfaceError::NoError) { |
610 | std::cout << " Success, got dotdesktop:" << val << std::endl; |
611 | } else { |
612 | std::cout << " Error:" << val << std::endl; |
613 | |
614 | === modified file 'scope/tests/integration/webclient_integration.cpp' |
615 | --- scope/tests/integration/webclient_integration.cpp 2014-04-29 03:17:38 +0000 |
616 | +++ scope/tests/integration/webclient_integration.cpp 2014-06-13 19:58:51 +0000 |
617 | @@ -101,8 +101,8 @@ |
618 | QSharedPointer<click::web::Client> clientPtr( |
619 | new click::web::Client(namPtr)); |
620 | click::Index index(clientPtr); |
621 | - click::PackageList packages; |
622 | - index.search("qr,architecture:armhf", [&, this](click::PackageList found_packages){ |
623 | + click::Packages packages; |
624 | + index.search("qr,architecture:armhf", [&, this](click::Packages found_packages){ |
625 | packages = found_packages; |
626 | Quit(); |
627 | }); |
628 | |
629 | === modified file 'scope/tests/test_query.cpp' |
630 | --- scope/tests/test_query.cpp 2014-06-09 16:49:10 +0000 |
631 | +++ scope/tests/test_query.cpp 2014-06-13 19:58:51 +0000 |
632 | @@ -55,16 +55,16 @@ |
633 | |
634 | |
635 | class MockIndex : public click::Index { |
636 | - click::PackageList packages; |
637 | + click::Packages packages; |
638 | public: |
639 | - MockIndex(click::PackageList packages = click::PackageList()) |
640 | + MockIndex(click::Packages packages = click::Packages()) |
641 | : Index(QSharedPointer<click::web::Client>()), |
642 | packages(packages) |
643 | { |
644 | |
645 | } |
646 | |
647 | - click::web::Cancellable search(const std::string &query, std::function<void (click::PackageList)> callback) override |
648 | + click::web::Cancellable search(const std::string &query, std::function<void (click::Packages)> callback) override |
649 | { |
650 | do_search(query, callback); |
651 | callback(packages); |
652 | @@ -73,7 +73,7 @@ |
653 | |
654 | MOCK_METHOD2(do_search, |
655 | void(const std::string&, |
656 | - std::function<void(click::PackageList)>)); |
657 | + std::function<void(click::Packages)>)); |
658 | }; |
659 | |
660 | class MockQueryBase : public click::Query { |
661 | @@ -158,7 +158,7 @@ |
662 | |
663 | TEST(QueryTest, testAddAvailableAppsPushesResults) |
664 | { |
665 | - click::PackageList packages { |
666 | + click::Packages packages { |
667 | {"name", "title", 0.0, "icon", "uri"} |
668 | }; |
669 | MockIndex mock_index(packages); |
670 | @@ -180,7 +180,7 @@ |
671 | |
672 | TEST(QueryTest, testAddAvailableAppsCallsFinished) |
673 | { |
674 | - click::PackageList packages { |
675 | + click::Packages packages { |
676 | {"name", "title", 0.0, "icon", "uri"} |
677 | }; |
678 | MockIndex mock_index(packages); |
679 | @@ -201,7 +201,7 @@ |
680 | |
681 | TEST(QueryTest, testQueryRunCallsAddAvailableApps) |
682 | { |
683 | - click::PackageList packages { |
684 | + click::Packages packages { |
685 | {"name", "title", 0.0, "icon", "uri"} |
686 | }; |
687 | MockIndex mock_index(packages); |
688 | @@ -218,7 +218,7 @@ |
689 | |
690 | TEST(QueryTest, testDuplicatesFilteredOnPackageName) |
691 | { |
692 | - click::PackageList packages { |
693 | + click::Packages packages { |
694 | {"org.example.app1", "app title1", 0.0, "icon", "uri"}, |
695 | {"org.example.app2", "app title2", 0.0, "icon", "uri"} |
696 | }; |
PASSED: Continuous integration, rev:290 jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- ci/110/ jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- amd64-ci/ 85 jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- armhf-ci/ 84 jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- armhf-ci/ 84/artifact/ work/output/ *zip*/output. zip jenkins. qa.ubuntu. com/job/ unity-team- unity-scope- click-devel- utopic- i386-ci/ 84
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/ 110/rebuild
http://