| 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 <set> | 5 #include <set> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/memory/scoped_vector.h" | 8 #include "base/memory/scoped_vector.h" |
| 9 #include "base/metrics/field_trial.h" | 9 #include "base/metrics/field_trial.h" |
| 10 #include "base/strings/string16.h" | 10 #include "base/strings/string16.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 base::StringPrintf("%s%d", prefix_.c_str(), static_cast<int>(i)); | 80 base::StringPrintf("%s%d", prefix_.c_str(), static_cast<int>(i)); |
| 81 double relevance = 1.0 - i / 10.0; | 81 double relevance = 1.0 - i / 10.0; |
| 82 // If bad_relevance_range_, change the relevances to give results outside | 82 // If bad_relevance_range_, change the relevances to give results outside |
| 83 // of the canonical [0.0, 1.0] range. | 83 // of the canonical [0.0, 1.0] range. |
| 84 if (bad_relevance_range_) | 84 if (bad_relevance_range_) |
| 85 relevance = 10.0 - i * 10; | 85 relevance = 10.0 - i * 10; |
| 86 TestSearchResult* result = new TestSearchResult(id, relevance); | 86 TestSearchResult* result = new TestSearchResult(id, relevance); |
| 87 result->set_display_type(display_type_); | 87 result->set_display_type(display_type_); |
| 88 if (voice_result_indices.find(i) != voice_result_indices.end()) | 88 if (voice_result_indices.find(i) != voice_result_indices.end()) |
| 89 result->set_voice_result(true); | 89 result->set_voice_result(true); |
| 90 Add(scoped_ptr<SearchResult>(result).Pass()); | 90 Add(scoped_ptr<SearchResult>(result)); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 void Stop() override {} | 93 void Stop() override {} |
| 94 | 94 |
| 95 void set_prefix(const std::string& prefix) { prefix_ = prefix; } | 95 void set_prefix(const std::string& prefix) { prefix_ = prefix; } |
| 96 void set_display_type(SearchResult::DisplayType display_type) { | 96 void set_display_type(SearchResult::DisplayType display_type) { |
| 97 display_type_ = display_type; | 97 display_type_ = display_type; |
| 98 } | 98 } |
| 99 void set_count(size_t count) { count_ = count; } | 99 void set_count(size_t count) { count_ = count; } |
| 100 void set_as_voice_result(size_t index) { voice_result_indices.insert(index); } | 100 void set_as_voice_result(size_t index) { voice_result_indices.insert(index); } |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 527 EXPECT_EQ(old_ui_result_ids[1], | 527 EXPECT_EQ(old_ui_result_ids[1], |
| 528 TestSearchResult::GetInstanceId(ui_results.GetItemAt(0))); | 528 TestSearchResult::GetInstanceId(ui_results.GetItemAt(0))); |
| 529 EXPECT_EQ(old_ui_result_ids[2], | 529 EXPECT_EQ(old_ui_result_ids[2], |
| 530 TestSearchResult::GetInstanceId(ui_results.GetItemAt(2))); | 530 TestSearchResult::GetInstanceId(ui_results.GetItemAt(2))); |
| 531 } | 531 } |
| 532 | 532 |
| 533 INSTANTIATE_TEST_CASE_P(MixerTestInstance, MixerTest, testing::Bool()); | 533 INSTANTIATE_TEST_CASE_P(MixerTestInstance, MixerTest, testing::Bool()); |
| 534 | 534 |
| 535 } // namespace test | 535 } // namespace test |
| 536 } // namespace app_list | 536 } // namespace app_list |
| OLD | NEW |