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" | |
8 #include "base/command_line.h" | 7 #include "base/command_line.h" |
9 #include "base/macros.h" | 8 #include "base/macros.h" |
10 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
11 #include "build/build_config.h" | 10 #include "build/build_config.h" |
12 #include "chrome/browser/apps/app_browsertest_util.h" | 11 #include "chrome/browser/apps/app_browsertest_util.h" |
13 #include "chrome/browser/ui/app_list/app_list_service.h" | 12 #include "chrome/browser/ui/app_list/app_list_service.h" |
14 #include "chrome/browser/ui/app_list/app_list_service_views.h" | 13 #include "chrome/browser/ui/app_list/app_list_service_views.h" |
15 #include "chrome/browser/ui/app_list/app_list_shower_views.h" | 14 #include "chrome/browser/ui/app_list/app_list_shower_views.h" |
16 #include "content/public/browser/render_frame_host.h" | 15 #include "content/public/browser/render_frame_host.h" |
17 #include "content/public/browser/web_contents.h" | 16 #include "content/public/browser/web_contents.h" |
18 #include "extensions/common/extension.h" | 17 #include "extensions/common/extension.h" |
19 #include "extensions/common/switches.h" | 18 #include "extensions/common/switches.h" |
20 #include "extensions/test/extension_test_message_listener.h" | 19 #include "extensions/test/extension_test_message_listener.h" |
21 #include "ui/app_list/app_list_switches.h" | 20 #include "ui/app_list/app_list_switches.h" |
22 #include "ui/app_list/views/app_list_main_view.h" | 21 #include "ui/app_list/views/app_list_main_view.h" |
23 #include "ui/app_list/views/app_list_view.h" | 22 #include "ui/app_list/views/app_list_view.h" |
24 #include "ui/app_list/views/contents_view.h" | 23 #include "ui/app_list/views/contents_view.h" |
25 #include "ui/app_list/views/custom_launcher_page_view.h" | 24 #include "ui/app_list/views/custom_launcher_page_view.h" |
26 #include "ui/app_list/views/search_box_view.h" | 25 #include "ui/app_list/views/search_box_view.h" |
| 26 #include "ui/aura/window.h" |
27 #include "ui/events/test/event_generator.h" | 27 #include "ui/events/test/event_generator.h" |
28 #include "ui/views/controls/textfield/textfield.h" | 28 #include "ui/views/controls/textfield/textfield.h" |
29 #include "ui/views/controls/webview/webview.h" | 29 #include "ui/views/controls/webview/webview.h" |
30 #include "ui/views/focus/focus_manager.h" | 30 #include "ui/views/focus/focus_manager.h" |
31 | 31 |
| 32 #if defined(OS_CHROMEOS) |
| 33 #include "chrome/browser/ui/ash/app_list/test/app_list_service_ash_test_api.h" |
| 34 #include "ui/app_list/shower/app_list_shower_impl.h" |
| 35 #endif |
| 36 |
32 namespace { | 37 namespace { |
33 | 38 |
34 // The path of the test application within the "platform_apps" directory. | 39 // The path of the test application within the "platform_apps" directory. |
35 const char kCustomLauncherPagePath[] = "custom_launcher_page"; | 40 const char kCustomLauncherPagePath[] = "custom_launcher_page"; |
36 | 41 |
37 // The app ID of the test application. | 42 // The app ID of the test application. |
38 const char kCustomLauncherPageID[] = "lmadimbbgapmngbiclpjjngmdickadpl"; | 43 const char kCustomLauncherPageID[] = "lmadimbbgapmngbiclpjjngmdickadpl"; |
39 | 44 |
40 } // namespace | 45 } // namespace |
41 | 46 |
(...skipping 25 matching lines...) Expand all Loading... |
67 // activate any loaded launcher pages). | 72 // activate any loaded launcher pages). |
68 void LaunchPlatformApp(const extensions::Extension* /*unused*/) override { | 73 void LaunchPlatformApp(const extensions::Extension* /*unused*/) override { |
69 AppListService* service = AppListService::Get(); | 74 AppListService* service = AppListService::Get(); |
70 DCHECK(service); | 75 DCHECK(service); |
71 service->ShowForProfile(browser()->profile()); | 76 service->ShowForProfile(browser()->profile()); |
72 } | 77 } |
73 | 78 |
74 app_list::AppListView* GetAppListView() { | 79 app_list::AppListView* GetAppListView() { |
75 app_list::AppListView* app_list_view = nullptr; | 80 app_list::AppListView* app_list_view = nullptr; |
76 #if defined(OS_CHROMEOS) | 81 #if defined(OS_CHROMEOS) |
77 ash::Shell* shell = ash::Shell::GetInstance(); | 82 AppListServiceAshTestApi service_test; |
78 app_list_view = shell->GetAppListView(); | 83 app_list_view = service_test.GetAppListView(); |
79 EXPECT_TRUE(shell->GetAppListTargetVisibility()); | 84 EXPECT_TRUE(service_test.GetAppListShower()->GetTargetVisibility()); |
80 #else | 85 #else |
81 AppListServiceViews* service = | 86 AppListServiceViews* service = |
82 static_cast<AppListServiceViews*>(AppListService::Get()); | 87 static_cast<AppListServiceViews*>(AppListService::Get()); |
83 // The app list should have loaded instantly since the profile is already | 88 // The app list should have loaded instantly since the profile is already |
84 // loaded. | 89 // loaded. |
85 EXPECT_TRUE(service->IsAppListVisible()); | 90 EXPECT_TRUE(service->IsAppListVisible()); |
86 app_list_view = service->shower().app_list(); | 91 app_list_view = service->shower().app_list(); |
87 #endif | 92 #endif |
88 return app_list_view; | 93 return app_list_view; |
89 } | 94 } |
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 // And in reverse. | 460 // And in reverse. |
456 EXPECT_EQ( | 461 EXPECT_EQ( |
457 search_box_textfield, | 462 search_box_textfield, |
458 app_list_view->GetFocusManager()->GetNextFocusableView( | 463 app_list_view->GetFocusManager()->GetNextFocusableView( |
459 custom_page_webview, custom_page_webview->GetWidget(), true, false)); | 464 custom_page_webview, custom_page_webview->GetWidget(), true, false)); |
460 EXPECT_EQ(custom_page_webview, | 465 EXPECT_EQ(custom_page_webview, |
461 app_list_view->GetFocusManager()->GetNextFocusableView( | 466 app_list_view->GetFocusManager()->GetNextFocusableView( |
462 search_box_textfield, search_box_textfield->GetWidget(), true, | 467 search_box_textfield, search_box_textfield->GetWidget(), true, |
463 false)); | 468 false)); |
464 } | 469 } |
OLD | NEW |