| 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "chrome/browser/apps/app_browsertest_util.h" | 10 #include "chrome/browser/apps/app_browsertest_util.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 app_list::switches::kDisableAppListDismissOnBlur); | 57 app_list::switches::kDisableAppListDismissOnBlur); |
| 58 | 58 |
| 59 // The test app must be whitelisted to use launcher_page. | 59 // The test app must be whitelisted to use launcher_page. |
| 60 command_line->AppendSwitchASCII( | 60 command_line->AppendSwitchASCII( |
| 61 extensions::switches::kWhitelistedExtensionID, kCustomLauncherPageID); | 61 extensions::switches::kWhitelistedExtensionID, kCustomLauncherPageID); |
| 62 } | 62 } |
| 63 | 63 |
| 64 // Open the launcher. Ignores the Extension argument (this will simply | 64 // Open the launcher. Ignores the Extension argument (this will simply |
| 65 // activate any loaded launcher pages). | 65 // activate any loaded launcher pages). |
| 66 void LaunchPlatformApp(const extensions::Extension* /*unused*/) override { | 66 void LaunchPlatformApp(const extensions::Extension* /*unused*/) override { |
| 67 AppListService* service = | 67 AppListService* service = AppListService::Get(ui::HOST_DESKTOP_TYPE_NATIVE); |
| 68 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); | |
| 69 DCHECK(service); | 68 DCHECK(service); |
| 70 service->ShowForProfile(browser()->profile()); | 69 service->ShowForProfile(browser()->profile()); |
| 71 } | 70 } |
| 72 | 71 |
| 73 app_list::AppListView* GetAppListView() { | 72 app_list::AppListView* GetAppListView() { |
| 74 app_list::AppListView* app_list_view = nullptr; | 73 app_list::AppListView* app_list_view = nullptr; |
| 75 #if defined(OS_CHROMEOS) | 74 #if defined(OS_CHROMEOS) |
| 76 ash::Shell* shell = ash::Shell::GetInstance(); | 75 ash::Shell* shell = ash::Shell::GetInstance(); |
| 77 app_list_view = shell->GetAppListView(); | 76 app_list_view = shell->GetAppListView(); |
| 78 EXPECT_TRUE(shell->GetAppListTargetVisibility()); | 77 EXPECT_TRUE(shell->GetAppListTargetVisibility()); |
| 79 #else | 78 #else |
| 80 AppListServiceViews* service = static_cast<AppListServiceViews*>( | 79 AppListServiceViews* service = static_cast<AppListServiceViews*>( |
| 81 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)); | 80 AppListService::Get(ui::HOST_DESKTOP_TYPE_NATIVE)); |
| 82 // The app list should have loaded instantly since the profile is already | 81 // The app list should have loaded instantly since the profile is already |
| 83 // loaded. | 82 // loaded. |
| 84 EXPECT_TRUE(service->IsAppListVisible()); | 83 EXPECT_TRUE(service->IsAppListVisible()); |
| 85 app_list_view = service->shower().app_list(); | 84 app_list_view = service->shower().app_list(); |
| 86 #endif | 85 #endif |
| 87 return app_list_view; | 86 return app_list_view; |
| 88 } | 87 } |
| 89 | 88 |
| 90 // Set the active page on the app list, according to |state|. Does not wait | 89 // Set the active page on the app list, according to |state|. Does not wait |
| 91 // for any animation or custom page to complete. | 90 // for any animation or custom page to complete. |
| (...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 // And in reverse. | 453 // And in reverse. |
| 455 EXPECT_EQ( | 454 EXPECT_EQ( |
| 456 search_box_textfield, | 455 search_box_textfield, |
| 457 app_list_view->GetFocusManager()->GetNextFocusableView( | 456 app_list_view->GetFocusManager()->GetNextFocusableView( |
| 458 custom_page_webview, custom_page_webview->GetWidget(), true, false)); | 457 custom_page_webview, custom_page_webview->GetWidget(), true, false)); |
| 459 EXPECT_EQ(custom_page_webview, | 458 EXPECT_EQ(custom_page_webview, |
| 460 app_list_view->GetFocusManager()->GetNextFocusableView( | 459 app_list_view->GetFocusManager()->GetNextFocusableView( |
| 461 search_box_textfield, search_box_textfield->GetWidget(), true, | 460 search_box_textfield, search_box_textfield->GetWidget(), true, |
| 462 false)); | 461 false)); |
| 463 } | 462 } |
| OLD | NEW |