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

Unified Diff: chrome/browser/ui/app_list/search/mixer.h

Issue 372843003: Add unit test for Mixer::Publish. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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
Index: chrome/browser/ui/app_list/search/mixer.h
diff --git a/chrome/browser/ui/app_list/search/mixer.h b/chrome/browser/ui/app_list/search/mixer.h
index b195d6371a842ff4ba2d554ee6a3f19aa4713845..f47c2d923866c7afe393266a0d0325dd4c2fd95a 100644
--- a/chrome/browser/ui/app_list/search/mixer.h
+++ b/chrome/browser/ui/app_list/search/mixer.h
@@ -12,6 +12,7 @@
namespace app_list {
+class ChromeSearchResult;
class SearchProvider;
// Mixer collects results from providers, sorts them and publishes them to the
@@ -22,6 +23,17 @@ class SearchProvider;
// slots. The omnibox group takes all the remaining slots.
class Mixer {
public:
+ // Used for sorting and mixing results.
+ struct SortData {
+ SortData();
+ SortData(ChromeSearchResult* result, double score);
+
+ bool operator<(const SortData& other) const;
+
+ ChromeSearchResult* result; // Not owned.
+ double score;
+ };
+
// The enum represents mixer groups. Note this must matches the order
// of group creation in Init().
enum GroupId {
@@ -43,6 +55,11 @@ class Mixer {
// Collects the results, sorts and publishes them.
void MixAndPublish(const KnownResults& known_results);
+ // Publishes the given |results| to |ui_results|. Reuse existing ones to avoid
+ // flickering.
+ static void Publish(const std::vector<SortData>& results,
Matt Giuca 2014/07/08 01:48:23 I think the standard practice here would be to mak
calamity 2014/07/08 04:23:00 Done-ish. SortData still needs to be public to be
Matt Giuca 2014/07/08 05:31:45 Use FRIEND_TEST_ALL_PREFIXES to actually friend th
+ AppListModel::SearchResults* ui_results);
+
private:
class Group;
typedef ScopedVector<Group> Groups;
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/search/mixer.cc » ('j') | chrome/browser/ui/app_list/search/mixer_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698