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 "base/path_service.h" | 5 #include "base/path_service.h" |
6 #include "base/run_loop.h" | 6 #include "base/run_loop.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/extensions/extension_browsertest.h" | 8 #include "chrome/browser/extensions/extension_browsertest.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" | 10 #include "chrome/browser/ui/app_list/app_list_controller_delegate.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Ensure there is at most one. | 83 // Ensure there is at most one. |
84 EXPECT_FALSE(observed_result_); | 84 EXPECT_FALSE(observed_result_); |
85 observed_result_ = observed_results_list_->GetItemAt(i); | 85 observed_result_ = observed_results_list_->GetItemAt(i); |
86 } | 86 } |
87 | 87 |
88 if (observed_result_) | 88 if (observed_result_) |
89 observed_result_->AddObserver(this); | 89 observed_result_->AddObserver(this); |
90 } | 90 } |
91 | 91 |
92 // Overridden from SearchResultObserver: | 92 // Overridden from SearchResultObserver: |
93 virtual void OnIconChanged() override {} | 93 void OnIconChanged() override {} |
94 virtual void OnActionsChanged() override {} | 94 void OnActionsChanged() override {} |
95 virtual void OnIsInstallingChanged() override {} | 95 void OnIsInstallingChanged() override {} |
96 virtual void OnPercentDownloadedChanged() override {} | 96 void OnPercentDownloadedChanged() override {} |
97 virtual void OnItemInstalled() override {} | 97 void OnItemInstalled() override {} |
98 virtual void OnItemUninstalled() override { | 98 void OnItemUninstalled() override { |
99 ++item_uninstall_count_; | 99 ++item_uninstall_count_; |
100 EXPECT_TRUE(observed_result_); | 100 EXPECT_TRUE(observed_result_); |
101 } | 101 } |
102 | 102 |
103 // Overridden from ui::ListModelObserver: | 103 // Overridden from ui::ListModelObserver: |
104 virtual void ListItemsAdded(size_t start, size_t count) override { | 104 void ListItemsAdded(size_t start, size_t count) override { |
105 AttemptToLocateItem(); | 105 AttemptToLocateItem(); |
106 } | 106 } |
107 virtual void ListItemsRemoved(size_t start, size_t count) override { | 107 void ListItemsRemoved(size_t start, size_t count) override { |
108 AttemptToLocateItem(); | 108 AttemptToLocateItem(); |
109 } | 109 } |
110 virtual void ListItemMoved(size_t index, size_t target_index) override {} | 110 void ListItemMoved(size_t index, size_t target_index) override {} |
111 virtual void ListItemsChanged(size_t start, size_t count) override {} | 111 void ListItemsChanged(size_t start, size_t count) override {} |
112 | 112 |
113 app_list::SearchResult* observed_result_; | 113 app_list::SearchResult* observed_result_; |
114 int item_uninstall_count_; | 114 int item_uninstall_count_; |
115 | 115 |
116 private: | 116 private: |
117 base::string16 item_to_observe_; | 117 base::string16 item_to_observe_; |
118 app_list::AppListModel::SearchResults* observed_results_list_; | 118 app_list::AppListModel::SearchResults* observed_results_list_; |
119 | 119 |
120 DISALLOW_COPY_AND_ASSIGN(AppListControllerSearchResultsBrowserTest); | 120 DISALLOW_COPY_AND_ASSIGN(AppListControllerSearchResultsBrowserTest); |
121 }; | 121 }; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 EXPECT_EQ(1, item_uninstall_count_); | 162 EXPECT_EQ(1, item_uninstall_count_); |
163 | 163 |
164 // Results should not be immediately refreshed. When they are, the item should | 164 // Results should not be immediately refreshed. When they are, the item should |
165 // be removed from the model. | 165 // be removed from the model. |
166 EXPECT_TRUE(observed_result_); | 166 EXPECT_TRUE(observed_result_); |
167 base::RunLoop().RunUntilIdle(); | 167 base::RunLoop().RunUntilIdle(); |
168 EXPECT_FALSE(observed_result_); | 168 EXPECT_FALSE(observed_result_); |
169 StopWatchingResults(); | 169 StopWatchingResults(); |
170 service->DismissAppList(); | 170 service->DismissAppList(); |
171 } | 171 } |
OLD | NEW |