OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/app_list/views/search_result_list_view.h" | 5 #include "ui/app_list/views/search_result_list_view.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "ui/app_list/app_list_model.h" | 10 #include "ui/app_list/app_list_model.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 int kDefaultSearchItems = 5; | 22 int kDefaultSearchItems = 5; |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 class SearchResultListViewTest : public views::ViewsTestBase, | 25 class SearchResultListViewTest : public views::ViewsTestBase, |
26 public SearchResultListViewDelegate { | 26 public SearchResultListViewDelegate { |
27 public: | 27 public: |
28 SearchResultListViewTest() {} | 28 SearchResultListViewTest() {} |
29 virtual ~SearchResultListViewTest() {} | 29 virtual ~SearchResultListViewTest() {} |
30 | 30 |
31 // Overridden from testing::Test: | 31 // Overridden from testing::Test: |
32 virtual void SetUp() OVERRIDE { | 32 virtual void SetUp() override { |
33 views::ViewsTestBase::SetUp(); | 33 views::ViewsTestBase::SetUp(); |
34 view_.reset(new SearchResultListView(this, &view_delegate_)); | 34 view_.reset(new SearchResultListView(this, &view_delegate_)); |
35 view_->SetResults(view_delegate_.GetModel()->results()); | 35 view_->SetResults(view_delegate_.GetModel()->results()); |
36 view_->SetSelectedIndex(0); | 36 view_->SetSelectedIndex(0); |
37 } | 37 } |
38 | 38 |
39 protected: | 39 protected: |
40 SearchResultListView* view() { return view_.get(); } | 40 SearchResultListView* view() { return view_.get(); } |
41 | 41 |
42 AppListModel::SearchResults* GetResults() { | 42 AppListModel::SearchResults* GetResults() { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 for (size_t i = 0; i < results->item_count(); ++i) { | 104 for (size_t i = 0; i < results->item_count(); ++i) { |
105 EXPECT_EQ(results->GetItemAt(i), view_->GetResultViewAt(i)->result()); | 105 EXPECT_EQ(results->GetItemAt(i), view_->GetResultViewAt(i)->result()); |
106 } | 106 } |
107 } | 107 } |
108 | 108 |
109 ProgressBarView* GetProgressBarAt(size_t index) { | 109 ProgressBarView* GetProgressBarAt(size_t index) { |
110 return view()->GetResultViewAt(index)->progress_bar_; | 110 return view()->GetResultViewAt(index)->progress_bar_; |
111 } | 111 } |
112 | 112 |
113 private: | 113 private: |
114 virtual void OnResultInstalled(SearchResult* result) OVERRIDE {} | 114 virtual void OnResultInstalled(SearchResult* result) override {} |
115 virtual void OnResultUninstalled(SearchResult* result) OVERRIDE {} | 115 virtual void OnResultUninstalled(SearchResult* result) override {} |
116 | 116 |
117 AppListTestViewDelegate view_delegate_; | 117 AppListTestViewDelegate view_delegate_; |
118 scoped_ptr<SearchResultListView> view_; | 118 scoped_ptr<SearchResultListView> view_; |
119 | 119 |
120 DISALLOW_COPY_AND_ASSIGN(SearchResultListViewTest); | 120 DISALLOW_COPY_AND_ASSIGN(SearchResultListViewTest); |
121 }; | 121 }; |
122 | 122 |
123 TEST_F(SearchResultListViewTest, Basic) { | 123 TEST_F(SearchResultListViewTest, Basic) { |
124 SetUpSearchResults(); | 124 SetUpSearchResults(); |
125 | 125 |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 EXPECT_EQ(0.0f, GetProgressBarAt(0)->current_value()); | 223 EXPECT_EQ(0.0f, GetProgressBarAt(0)->current_value()); |
224 GetResults()->GetItemAt(0)->SetPercentDownloaded(10); | 224 GetResults()->GetItemAt(0)->SetPercentDownloaded(10); |
225 | 225 |
226 DeleteResultAt(0); | 226 DeleteResultAt(0); |
227 RunPendingMessages(); | 227 RunPendingMessages(); |
228 EXPECT_EQ(0.0f, GetProgressBarAt(0)->current_value()); | 228 EXPECT_EQ(0.0f, GetProgressBarAt(0)->current_value()); |
229 } | 229 } |
230 | 230 |
231 } // namespace test | 231 } // namespace test |
232 } // namespace app_list | 232 } // namespace app_list |
OLD | NEW |