126
127
const unity::scopes::CannedQuery query("foo.scope", "FooBar", "");
127
128
const unity::scopes::CannedQuery query2("foo.scope", "Metallica", "");
129
click::apps::Query q(query, nullptr, metadata);
130
click::apps::Query q2(query2, nullptr, metadata);
130
auto clickif = std::make_shared<MockClickInterface>();
132
MockAppsQuery q(query, nullptr, metadata, clickif);
133
MockAppsQuery q2(query2, nullptr, metadata, clickif);
132
135
scopes::testing::MockSearchReply mock_reply;
133
136
scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){});
134
137
scopes::CategoryRenderer renderer("{}");
135
138
auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer);
137
const unity::scopes::CannedQuery target_query("com.canonical.scopes.clickstore", "FooBar", "");
140
EXPECT_CALL(q, isStoreScopeInstalled()).WillOnce(Return(true));
141
const unity::scopes::CannedQuery target_query("snappy-store", "FooBar", "");
139
143
EXPECT_CALL(mock_reply, register_category("store", CategoryTitleContains("FooBar"), _, _)).WillOnce(Return(ptrCat));
140
144
EXPECT_CALL(mock_reply, push(Matcher<const unity::scopes::CategorisedResult&>(ResultUriMatchesCannedQuery(target_query))));
142
146
scopes::testing::MockSearchReply mock_reply2;
143
147
scopes::SearchReplyProxy reply2(&mock_reply2, [](unity::scopes::SearchReply*){});
145
const unity::scopes::CannedQuery target_query2("com.canonical.scopes.clickstore", "Metallica", "");
149
EXPECT_CALL(q2, isStoreScopeInstalled()).WillOnce(Return(false));
147
EXPECT_CALL(mock_reply2, register_category("store", CategoryTitleContains("Metallica"), _, _)).WillOnce(Return(ptrCat));
148
EXPECT_CALL(mock_reply2, push(Matcher<const unity::scopes::CategorisedResult&>(ResultUriMatchesCannedQuery(target_query2))));
151
EXPECT_CALL(mock_reply2, register_category("store", _, _, _)).Times(0);
150
153
q.add_fake_store_app(reply);
151
154
q2.add_fake_store_app(reply2);
156
159
const scopes::SearchMetadata metadata("en_EN", "phone");
157
160
const unity::scopes::CannedQuery query("foo.scope", "", "music-department");
159
click::apps::Query q(query, nullptr, metadata);
162
auto clickif = std::make_shared<MockClickInterface>();
164
MockAppsQuery q(query, nullptr, metadata, clickif);
161
166
scopes::CategoryRenderer renderer("{}");
162
167
auto ptrCat = std::make_shared<FakeCategory>("id", "", "", renderer);
164
169
scopes::testing::MockSearchReply mock_reply;
165
170
scopes::SearchReplyProxy reply(&mock_reply, [](unity::scopes::SearchReply*){});
167
const unity::scopes::CannedQuery target_query("com.canonical.scopes.clickstore", "", "music-department");
172
const unity::scopes::CannedQuery target_query("snappy-store", "", "music-department");
174
EXPECT_CALL(q, isStoreScopeInstalled()).WillOnce(Return(true));
169
175
EXPECT_CALL(mock_reply, register_category("store", _, _, _)).WillOnce(Return(ptrCat));
170
176
EXPECT_CALL(mock_reply, push(Matcher<const unity::scopes::CategorisedResult&>(ResultUriMatchesCannedQuery(target_query))));