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" |
11 #include "chrome/browser/ui/app_list/app_list_service.h" | 11 #include "chrome/browser/ui/app_list/app_list_service.h" |
12 #include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h" | 12 #include "chrome/browser/ui/app_list/test/chrome_app_list_test_support.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/browser_finder.h" | 14 #include "chrome/browser/ui/browser_finder.h" |
15 #include "chrome/browser/ui/host_desktop.h" | 15 #include "chrome/browser/ui/host_desktop.h" |
16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
17 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
| 18 #include "ui/app_list/app_list_item_model.h" |
18 #include "ui/app_list/app_list_model.h" | 19 #include "ui/app_list/app_list_model.h" |
19 #include "ui/app_list/search_box_model.h" | 20 #include "ui/app_list/search_box_model.h" |
20 #include "ui/app_list/search_result.h" | 21 #include "ui/app_list/search_result.h" |
21 #include "ui/app_list/search_result_observer.h" | 22 #include "ui/app_list/search_result_observer.h" |
22 #include "ui/base/models/list_model_observer.h" | 23 #include "ui/base/models/list_model_observer.h" |
23 | 24 |
24 // Browser Test for AppListController that runs on all platforms supporting | 25 // Browser Test for AppListController that runs on all platforms supporting |
25 // app_list. | 26 // app_list. |
26 typedef InProcessBrowserTest AppListControllerBrowserTest; | 27 typedef InProcessBrowserTest AppListControllerBrowserTest; |
27 | 28 |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 EXPECT_EQ(1, item_uninstall_count_); | 157 EXPECT_EQ(1, item_uninstall_count_); |
157 | 158 |
158 // Results should not be immediately refreshed. When they are, the item should | 159 // Results should not be immediately refreshed. When they are, the item should |
159 // be removed from the model. | 160 // be removed from the model. |
160 EXPECT_TRUE(observed_result_); | 161 EXPECT_TRUE(observed_result_); |
161 base::RunLoop().RunUntilIdle(); | 162 base::RunLoop().RunUntilIdle(); |
162 EXPECT_FALSE(observed_result_); | 163 EXPECT_FALSE(observed_result_); |
163 StopWatchingResults(); | 164 StopWatchingResults(); |
164 service->DismissAppList(); | 165 service->DismissAppList(); |
165 } | 166 } |
| 167 |
| 168 // Tests install flow UI updates. |
| 169 IN_PROC_BROWSER_TEST_F(AppListControllerSearchResultsBrowserTest, InstallFlow) { |
| 170 test::SigninProfile(browser()->profile()); |
| 171 base::FilePath test_extension_path; |
| 172 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_extension_path)); |
| 173 test_extension_path = test_extension_path.AppendASCII("extensions") |
| 174 .AppendASCII("platform_apps") |
| 175 .AppendASCII("minimal"); |
| 176 const extensions::Extension* extension = |
| 177 InstallExtension(test_extension_path, |
| 178 1 /* expected_change: new install */); |
| 179 ASSERT_TRUE(extension); |
| 180 |
| 181 AppListService* service = test::GetAppListService(); |
| 182 ASSERT_TRUE(service); |
| 183 service->ShowForProfile(browser()->profile()); |
| 184 |
| 185 app_list::AppListModel* model = test::GetAppListModel(service); |
| 186 |
| 187 app_list::AppListItemModel* item = |
| 188 model->item_list()->FindItem(extension->id()); |
| 189 item->SetIsInstalling(true); |
| 190 item->SetPercentDownloaded(33); |
| 191 base::MessageLoop::current()->Run(); |
| 192 } |
OLD | NEW |