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