OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <string> | 5 #include <string> |
6 | 6 |
7 #include "base/memory/scoped_vector.h" | 7 #include "base/memory/scoped_vector.h" |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
243 | 243 |
244 // The second result will still use the original object, but have a different | 244 // The second result will still use the original object, but have a different |
245 // title, since the ID did not change. | 245 // title, since the ID did not change. |
246 EXPECT_EQ(old_ui_result_ids[1], | 246 EXPECT_EQ(old_ui_result_ids[1], |
247 TestSearchResult::GetInstanceId(ui_results.GetItemAt(1))); | 247 TestSearchResult::GetInstanceId(ui_results.GetItemAt(1))); |
248 EXPECT_EQ(kNewAppTitle, ui_results.GetItemAt(1)->title()); | 248 EXPECT_EQ(kNewAppTitle, ui_results.GetItemAt(1)->title()); |
249 | 249 |
250 // The third result will use the original object as the ID did not change. | 250 // The third result will use the original object as the ID did not change. |
251 EXPECT_EQ(old_ui_result_ids[2], | 251 EXPECT_EQ(old_ui_result_ids[2], |
252 TestSearchResult::GetInstanceId(ui_results.GetItemAt(2))); | 252 TestSearchResult::GetInstanceId(ui_results.GetItemAt(2))); |
253 | |
254 // Save the current |ui_results| order which should is app4, app2, app3. | |
255 old_ui_result_ids.clear(); | |
256 for (size_t i = 0; i < ui_results.item_count(); ++i) { | |
257 old_ui_result_ids.push_back( | |
258 TestSearchResult::GetInstanceId(ui_results.GetItemAt(i))); | |
259 } | |
260 | |
261 // Reorder the existing results and add a new one in the second place. | |
262 new_results[0] = Mixer::SortData(result2.get(), 1.0f); | |
263 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.
| |
264 new_results[2] = Mixer::SortData(result3.get(), 1.0f); | |
265 new_results.push_back(Mixer::SortData(result4.get(), 1.0f)); | |
266 | |
267 Mixer::Publish(new_results, &ui_results); | |
268 EXPECT_EQ(4u, ui_results.item_count()); | |
269 | |
270 // The reordered results should use the original objects. | |
271 EXPECT_EQ(old_ui_result_ids[0], | |
272 TestSearchResult::GetInstanceId(ui_results.GetItemAt(3))); | |
273 EXPECT_EQ(old_ui_result_ids[1], | |
274 TestSearchResult::GetInstanceId(ui_results.GetItemAt(0))); | |
275 EXPECT_EQ(old_ui_result_ids[2], | |
276 TestSearchResult::GetInstanceId(ui_results.GetItemAt(2))); | |
253 } | 277 } |
254 | 278 |
255 } // namespace test | 279 } // namespace test |
256 } // namespace app_list | 280 } // namespace app_list |
OLD | NEW |