Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Unified Diff: ui/app_list/search/mixer_unittest.cc

Issue 906913002: app_list: Added MixerTest.KnownResultsPriority test case. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@applist-mixer-forloops
Patch Set: Swap test order. Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/search/mixer_unittest.cc
diff --git a/ui/app_list/search/mixer_unittest.cc b/ui/app_list/search/mixer_unittest.cc
index 8397a98e58ef1c2ad3ae33db0cfd1946d6b54aeb..565b81bdf1e965b843b3a4211e609958b64e249b 100644
--- a/ui/app_list/search/mixer_unittest.cc
+++ b/ui/app_list/search/mixer_unittest.cc
@@ -120,7 +120,7 @@ class MixerTest : public testing::Test {
providers_[i]->Stop();
}
- mixer_->MixAndPublish(is_voice_query_, KnownResults());
+ mixer_->MixAndPublish(is_voice_query_, known_results_);
}
std::string GetResults() const {
@@ -146,9 +146,14 @@ class MixerTest : public testing::Test {
is_voice_query_ = is_voice_query;
}
+ void AddKnownResult(const std::string& id, KnownResultType type) {
+ known_results_[id] = type;
+ }
+
private:
scoped_ptr<Mixer> mixer_;
scoped_ptr<AppListModel::SearchResults> results_;
+ KnownResults known_results_;
bool is_voice_query_;
@@ -218,6 +223,25 @@ TEST_F(MixerTest, RemoveDuplicates) {
EXPECT_EQ("dup0,dup1,dup2", GetResults());
}
+// Tests that "known results" have priority over others.
+TEST_F(MixerTest, KnownResultsPriority) {
+ // This gives omnibox 0 -- 5.
+ omnibox_provider()->set_count(6);
+
+ // omnibox 1 -- 4 are "known results".
+ AddKnownResult("omnibox1", PREFIX_SECONDARY);
+ AddKnownResult("omnibox2", PERFECT_SECONDARY);
+ AddKnownResult("omnibox3", PREFIX_PRIMARY);
+ AddKnownResult("omnibox4", PERFECT_PRIMARY);
+
+ RunQuery();
+
+ // omnibox 1 -- 4 should be prioritised over the others. They should be
+ // ordered 4, 3, 2, 1 (in order of match quality).
+ EXPECT_EQ("omnibox4,omnibox3,omnibox2,omnibox1,omnibox0,omnibox5",
+ GetResults());
+}
+
TEST_F(MixerTest, VoiceQuery) {
omnibox_provider()->set_count(3);
RunQuery();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698