Merge lp:~mterry/unity-scope-click/allow-legacy into lp:unity-scope-click

Proposed by Michael Terry
Status: Work in progress
Proposed branch: lp:~mterry/unity-scope-click/allow-legacy
Merge into: lp:unity-scope-click
Prerequisite: lp:~mterry/unity-scope-click/gmock
Diff against target: 152 lines (+0/-92)
3 files modified
libclickscope/click/interface.cpp (+0/-41)
libclickscope/click/interface.h (+0/-5)
libclickscope/tests/test_interface.cpp (+0/-46)
To merge this branch: bzr merge lp:~mterry/unity-scope-click/allow-legacy
Reviewer Review Type Date Requested Status
Unity API Team Pending
Review via email: mp+312383@code.launchpad.net

Commit message

WIP

Description of the change

WIP

To post a comment you must log in.

Unmerged revisions

506. By Michael Terry

Merge gmock branch

505. By Michael Terry

Remove some now-unneeded code and fix gmock usage

504. By Michael Terry

Don't ignore legacy apps

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'libclickscope/click/interface.cpp'
2--- libclickscope/click/interface.cpp 2016-10-04 17:35:15 +0000
3+++ libclickscope/click/interface.cpp 2016-12-02 18:42:36 +0000
4@@ -93,28 +93,6 @@
5
6 namespace click {
7
8-const std::unordered_set<std::string>& nonClickDesktopFiles()
9-{
10- static std::unordered_set<std::string> set =
11- {
12- "address-book-app.desktop",
13- "camera-app.desktop",
14- "click-update-manager.desktop",
15- "com.ubuntu.terminal.desktop",
16- "dialer-app.desktop",
17- "friends-app.desktop",
18- "gallery-app.desktop",
19- "mediaplayer-app.desktop",
20- "messaging-app.desktop",
21- "music-app.desktop",
22- "ubuntu-filemanager-app.desktop",
23- "ubuntu-system-settings.desktop",
24- "webbrowser-app.desktop",
25- };
26-
27- return set;
28-}
29-
30 static const std::string DESKTOP_FILE_GROUP("Desktop Entry");
31 static const std::string DESKTOP_FILE_KEY_NAME("Name");
32 static const std::string DESKTOP_FILE_KEY_ICON("Icon");
33@@ -221,15 +199,6 @@
34 // Get the .desktop file info from UAL, since we're not ignoring
35 try {
36 auto appinfo = ualapp->info();
37-
38- // Only skip legacy apps that don't support Ubuntu Lifecycle
39- if (app.version.empty() &&
40- !is_non_click_app(app.name) &&
41- !appinfo->supportsUbuntuLifecycle()) {
42- qDebug() << "Skipping legacy app:" << QString::fromStdString(app.name);
43- continue;
44- }
45-
46 app.title = appinfo->name();
47 app.description = appinfo->description();
48 app.icon_url = appinfo->iconPath();
49@@ -310,16 +279,6 @@
50 return sort_apps(result);
51 }
52
53-/* is_non_click_app()
54- *
55- * Tests that @filename is one of the special-cased filenames for apps
56- * which are not packaged as clicks, but required on Ubuntu Touch.
57- */
58-bool Interface::is_non_click_app(const std::string& app_id)
59-{
60- return click::nonClickDesktopFiles().count(app_id) > 0;
61-}
62-
63 /*
64 * is_icon_identifier()
65 *
66
67=== modified file 'libclickscope/click/interface.h'
68--- libclickscope/click/interface.h 2016-09-02 21:29:13 +0000
69+++ libclickscope/click/interface.h 2016-12-02 18:42:36 +0000
70@@ -49,9 +49,6 @@
71 class KeyFileLocator;
72 class DepartmentsDb;
73
74-// Hash map of desktop files that are not yet click packages
75-const std::unordered_set<std::string>& nonClickDesktopFiles();
76-
77 struct Manifest
78 {
79 Manifest() = default;
80@@ -92,8 +89,6 @@
81 const std::string& current_department = "",
82 const std::shared_ptr<click::DepartmentsDb>& depts_db = nullptr);
83
84- static bool is_non_click_app(const std::string& app_id);
85-
86 static bool is_icon_identifier(const std::string &icon_id);
87 static std::string add_theme_scheme(const std::string &filename);
88 virtual void get_installed_packages(std::function<void(PackageSet, InterfaceError)> callback);
89
90=== modified file 'libclickscope/tests/test_interface.cpp'
91--- libclickscope/tests/test_interface.cpp 2016-12-02 18:42:36 +0000
92+++ libclickscope/tests/test_interface.cpp 2016-12-02 18:42:36 +0000
93@@ -118,21 +118,6 @@
94 MOCK_CONST_METHOD0(installed_apps, std::list<std::shared_ptr<ual::Application>>());
95 };
96
97-TEST(ClickInterface, testIsNonClickAppFalse)
98-{
99- EXPECT_FALSE(Interface::is_non_click_app("unknown-app.desktop"));
100-}
101-
102-TEST(ClickInterface, testIsNonClickAppNoRegression)
103-{
104- // Loop through and check that all filenames are non-click filenames
105- // If this ever breaks, something is very very wrong.
106- for (const auto& element : nonClickDesktopFiles())
107- {
108- EXPECT_TRUE(Interface::is_non_click_app(element));
109- }
110-}
111-
112 TEST(ClickInterface, testFindAppsInDirEmpty)
113 {
114 FakeClickInterface iface;
115@@ -207,37 +192,6 @@
116 EXPECT_EQ("application:///messaging-app.desktop", results.begin()->url);
117 }
118
119-TEST_F(ClickInterfaceTest, testFindLegacyAppSkipped)
120-{
121- FakeClickInterface iface;
122-
123- EXPECT_CALL(iface, installed_apps()).Times(1).
124- WillOnce(Return(std::list<std::shared_ptr<ual::Application>>{
125- MockUALApplication::create(ual::AppID::find("skipped-app"),
126- std::shared_ptr<MockUALApplication::MockInfo>{new MockUALApplication::MockInfo("Skipped", "An app that's skipped", "skipped-app")})
127- }));
128- auto results = iface.search("");
129- ASSERT_EQ(0u, results.size());
130-}
131-
132-TEST_F(ClickInterfaceTest, testFindLegacyAppNotSkipped)
133-{
134- FakeClickInterface iface;
135-
136- std::shared_ptr<MockUALApplication::MockInfo> mockinfo{new MockUALApplication::MockInfo("Validity", "Valid app", "valid-app")};
137- EXPECT_CALL(iface, installed_apps()).Times(1).
138- WillOnce(Return(std::list<std::shared_ptr<ual::Application>>{
139- MockUALApplication::create(ual::AppID::find("valid-app"),
140- mockinfo)
141- }));
142- EXPECT_CALL(*mockinfo, supportsUbuntuLifecycle()).Times(1).
143- WillOnce(Return(ual::Application::Info::UbuntuLifecycle::from_raw(true)));
144-
145- auto results = iface.search("Valid");
146- ASSERT_EQ(1u, results.size());
147- EXPECT_EQ("application:///valid-app.desktop", results.begin()->url);
148-}
149-
150 // test that application with a default department id key in the desktop
151 // file is returned when department matches
152 TEST_F(ClickInterfaceTest, testFindAppsWithAppWithDefaultDepartmentId)

Subscribers

People subscribed via source and target branches

to all changes: