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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 | 10 |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "ui/app_list/app_list_model.h" | 14 #include "ui/app_list/app_list_model.h" |
15 #include "ui/app_list/test/app_list_test_view_delegate.h" | 15 #include "ui/app_list/test/app_list_test_view_delegate.h" |
16 #include "ui/app_list/test/test_search_result.h" | 16 #include "ui/app_list/test/test_search_result.h" |
17 #include "ui/app_list/views/progress_bar_view.h" | |
18 #include "ui/app_list/views/search_result_list_view_delegate.h" | 17 #include "ui/app_list/views/search_result_list_view_delegate.h" |
19 #include "ui/app_list/views/search_result_view.h" | 18 #include "ui/app_list/views/search_result_view.h" |
| 19 #include "ui/views/controls/progress_bar.h" |
20 #include "ui/views/test/views_test_base.h" | 20 #include "ui/views/test/views_test_base.h" |
21 | 21 |
22 namespace app_list { | 22 namespace app_list { |
23 namespace test { | 23 namespace test { |
24 | 24 |
25 namespace { | 25 namespace { |
26 int kDefaultSearchItems = 5; | 26 int kDefaultSearchItems = 5; |
27 } // namespace | 27 } // namespace |
28 | 28 |
29 class SearchResultListViewTest : public views::ViewsTestBase, | 29 class SearchResultListViewTest : public views::ViewsTestBase, |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 void ExpectConsistent() { | 109 void ExpectConsistent() { |
110 // Adding results will schedule Update(). | 110 // Adding results will schedule Update(). |
111 RunPendingMessages(); | 111 RunPendingMessages(); |
112 | 112 |
113 AppListModel::SearchResults* results = GetResults(); | 113 AppListModel::SearchResults* results = GetResults(); |
114 for (size_t i = 0; i < results->item_count(); ++i) { | 114 for (size_t i = 0; i < results->item_count(); ++i) { |
115 EXPECT_EQ(results->GetItemAt(i), GetResultViewAt(i)->result()); | 115 EXPECT_EQ(results->GetItemAt(i), GetResultViewAt(i)->result()); |
116 } | 116 } |
117 } | 117 } |
118 | 118 |
119 ProgressBarView* GetProgressBarAt(size_t index) { | 119 views::ProgressBar* GetProgressBarAt(size_t index) { |
120 return GetResultViewAt(index)->progress_bar_; | 120 return GetResultViewAt(index)->progress_bar_; |
121 } | 121 } |
122 | 122 |
123 private: | 123 private: |
124 void OnResultInstalled(SearchResult* result) override {} | 124 void OnResultInstalled(SearchResult* result) override {} |
125 | 125 |
126 AppListTestViewDelegate view_delegate_; | 126 AppListTestViewDelegate view_delegate_; |
127 std::unique_ptr<SearchResultListView> view_; | 127 std::unique_ptr<SearchResultListView> view_; |
128 | 128 |
129 DISALLOW_COPY_AND_ASSIGN(SearchResultListViewTest); | 129 DISALLOW_COPY_AND_ASSIGN(SearchResultListViewTest); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 EXPECT_EQ(0.0f, GetProgressBarAt(0)->current_value()); | 246 EXPECT_EQ(0.0f, GetProgressBarAt(0)->current_value()); |
247 GetResults()->GetItemAt(0)->SetPercentDownloaded(10); | 247 GetResults()->GetItemAt(0)->SetPercentDownloaded(10); |
248 | 248 |
249 DeleteResultAt(0); | 249 DeleteResultAt(0); |
250 RunPendingMessages(); | 250 RunPendingMessages(); |
251 EXPECT_EQ(0.0f, GetProgressBarAt(0)->current_value()); | 251 EXPECT_EQ(0.0f, GetProgressBarAt(0)->current_value()); |
252 } | 252 } |
253 | 253 |
254 } // namespace test | 254 } // namespace test |
255 } // namespace app_list | 255 } // namespace app_list |
OLD | NEW |