| 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/string16.h" | 8 #include "base/string16.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| 11 #include "chrome/browser/ui/app_list/search/chrome_search_result.h" | 11 #include "chrome/browser/ui/app_list/search/chrome_search_result.h" |
| 12 #include "chrome/browser/ui/app_list/search/history_types.h" |
| 12 #include "chrome/browser/ui/app_list/search/mixer.h" | 13 #include "chrome/browser/ui/app_list/search/mixer.h" |
| 13 #include "chrome/browser/ui/app_list/search/search_provider.h" | 14 #include "chrome/browser/ui/app_list/search/search_provider.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "ui/app_list/app_list_model.h" | 16 #include "ui/app_list/app_list_model.h" |
| 16 | 17 |
| 17 namespace app_list { | 18 namespace app_list { |
| 18 namespace test { | 19 namespace test { |
| 19 | 20 |
| 20 class TestSearchResult : public ChromeSearchResult { | 21 class TestSearchResult : public ChromeSearchResult { |
| 21 public: | 22 public: |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 } | 90 } |
| 90 | 91 |
| 91 void RunQuery() { | 92 void RunQuery() { |
| 92 const string16 query; | 93 const string16 query; |
| 93 | 94 |
| 94 for (size_t i = 0; i < providers_.size(); ++i) { | 95 for (size_t i = 0; i < providers_.size(); ++i) { |
| 95 providers_[i]->Start(query); | 96 providers_[i]->Start(query); |
| 96 providers_[i]->Stop(); | 97 providers_[i]->Stop(); |
| 97 } | 98 } |
| 98 | 99 |
| 99 mixer_->MixAndPublish(); | 100 mixer_->MixAndPublish(KnownResults()); |
| 100 } | 101 } |
| 101 | 102 |
| 102 std::string GetResults() const { | 103 std::string GetResults() const { |
| 103 std::string result; | 104 std::string result; |
| 104 for (size_t i = 0; i < results_->item_count(); ++i) { | 105 for (size_t i = 0; i < results_->item_count(); ++i) { |
| 105 if (!result.empty()) | 106 if (!result.empty()) |
| 106 result += ','; | 107 result += ','; |
| 107 | 108 |
| 108 result += UTF16ToUTF8(results_->GetItemAt(i)->title()); | 109 result += UTF16ToUTF8(results_->GetItemAt(i)->title()); |
| 109 } | 110 } |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 webstore_provider()->set_count(1); | 173 webstore_provider()->set_count(1); |
| 173 | 174 |
| 174 RunQuery(); | 175 RunQuery(); |
| 175 | 176 |
| 176 // Only three results with unique id are kept. | 177 // Only three results with unique id are kept. |
| 177 EXPECT_EQ("dup0,dup1,dup2", GetResults()); | 178 EXPECT_EQ("dup0,dup1,dup2", GetResults()); |
| 178 } | 179 } |
| 179 | 180 |
| 180 } // namespace test | 181 } // namespace test |
| 181 } // namespace app_list | 182 } // namespace app_list |
| OLD | NEW |