Index: chrome/browser/ui/app_list/search/mixer_unittest.cc |
diff --git a/chrome/browser/ui/app_list/search/mixer_unittest.cc b/chrome/browser/ui/app_list/search/mixer_unittest.cc |
index 2627a6dec54c6ed67e715c9b23e02dc9ec7945f1..f606b0094a37ea8ca34c8184726e77045f9dbda4 100644 |
--- a/chrome/browser/ui/app_list/search/mixer_unittest.cc |
+++ b/chrome/browser/ui/app_list/search/mixer_unittest.cc |
@@ -250,6 +250,30 @@ TEST_F(MixerTest, Publish) { |
// The third result will use the original object as the ID did not change. |
EXPECT_EQ(old_ui_result_ids[2], |
TestSearchResult::GetInstanceId(ui_results.GetItemAt(2))); |
+ |
+ // Save the current |ui_results| order which should is app4, app2, app3. |
+ old_ui_result_ids.clear(); |
+ for (size_t i = 0; i < ui_results.item_count(); ++i) { |
+ old_ui_result_ids.push_back( |
+ TestSearchResult::GetInstanceId(ui_results.GetItemAt(i))); |
+ } |
+ |
+ // Reorder the existing results and add a new one in the second place. |
+ new_results[0] = Mixer::SortData(result2.get(), 1.0f); |
+ new_results[1] = Mixer::SortData(result1.get(), 1.0f); |
Matt Giuca
2014/07/09 01:30:54
I think this is the "new one", correct? (Because r
calamity
2014/07/09 03:03:48
Done.
|
+ new_results[2] = Mixer::SortData(result3.get(), 1.0f); |
+ new_results.push_back(Mixer::SortData(result4.get(), 1.0f)); |
+ |
+ Mixer::Publish(new_results, &ui_results); |
+ EXPECT_EQ(4u, ui_results.item_count()); |
+ |
+ // The reordered results should use the original objects. |
+ EXPECT_EQ(old_ui_result_ids[0], |
+ TestSearchResult::GetInstanceId(ui_results.GetItemAt(3))); |
+ EXPECT_EQ(old_ui_result_ids[1], |
+ TestSearchResult::GetInstanceId(ui_results.GetItemAt(0))); |
+ EXPECT_EQ(old_ui_result_ids[2], |
+ TestSearchResult::GetInstanceId(ui_results.GetItemAt(2))); |
} |
} // namespace test |