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 "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/browser/apps/app_browsertest_util.h" | 8 #include "chrome/browser/apps/app_browsertest_util.h" |
9 #include "chrome/browser/ui/app_list/app_list_service.h" | 9 #include "chrome/browser/ui/app_list/app_list_service.h" |
| 10 #include "chrome/browser/ui/app_list/app_list_service_views.h" |
| 11 #include "chrome/browser/ui/app_list/app_list_shower_views.h" |
10 #include "extensions/common/extension.h" | 12 #include "extensions/common/extension.h" |
11 #include "extensions/common/switches.h" | 13 #include "extensions/common/switches.h" |
| 14 #include "extensions/test/extension_test_message_listener.h" |
12 #include "ui/app_list/app_list_switches.h" | 15 #include "ui/app_list/app_list_switches.h" |
| 16 #include "ui/app_list/views/app_list_main_view.h" |
| 17 #include "ui/app_list/views/app_list_view.h" |
| 18 #include "ui/app_list/views/contents_view.h" |
13 | 19 |
14 namespace { | 20 namespace { |
15 | 21 |
16 // The path of the test application within the "platform_apps" directory. | 22 // The path of the test application within the "platform_apps" directory. |
17 const char kCustomLauncherPagePath[] = "custom_launcher_page"; | 23 const char kCustomLauncherPagePath[] = "custom_launcher_page"; |
18 | 24 |
19 // The app ID of the test application. | 25 // The app ID of the test application. |
20 const char kCustomLauncherPageID[] = "lmadimbbgapmngbiclpjjngmdickadpl"; | 26 const char kCustomLauncherPageID[] = "lmadimbbgapmngbiclpjjngmdickadpl"; |
21 | 27 |
22 } // namespace | 28 } // namespace |
(...skipping 25 matching lines...) Expand all Loading... |
48 AppListService* service = | 54 AppListService* service = |
49 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); | 55 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); |
50 DCHECK(service); | 56 DCHECK(service); |
51 service->ShowForProfile(browser()->profile()); | 57 service->ShowForProfile(browser()->profile()); |
52 } | 58 } |
53 | 59 |
54 private: | 60 private: |
55 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageBrowserTest); | 61 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageBrowserTest); |
56 }; | 62 }; |
57 | 63 |
58 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, LoadPageAndOpenLauncher) { | 64 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, |
| 65 OpenLauncherAndSwitchToCustomPage) { |
59 LoadAndLaunchPlatformApp(kCustomLauncherPagePath, "Launched"); | 66 LoadAndLaunchPlatformApp(kCustomLauncherPagePath, "Launched"); |
| 67 |
| 68 AppListServiceViews* service = static_cast<AppListServiceViews*>( |
| 69 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE)); |
| 70 // The app list should have loaded instantly since the profile is already |
| 71 // loaded. |
| 72 EXPECT_TRUE(service->IsAppListVisible()); |
| 73 |
| 74 app_list::ContentsView* contents_view = |
| 75 service->shower().app_list()->app_list_main_view()->contents_view(); |
| 76 |
| 77 ASSERT_TRUE( |
| 78 contents_view->IsStateActive(app_list::AppListModel::STATE_START)); |
| 79 |
| 80 { |
| 81 ExtensionTestMessageListener listener("onPageExpanded", false); |
| 82 contents_view->SetActivePage(contents_view->GetPageIndexForState( |
| 83 app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE)); |
| 84 |
| 85 listener.WaitUntilSatisfied(); |
| 86 } |
| 87 { |
| 88 ExtensionTestMessageListener listener("onPageCollapsed", false); |
| 89 contents_view->SetActivePage(contents_view->GetPageIndexForState( |
| 90 app_list::AppListModel::STATE_START)); |
| 91 |
| 92 listener.WaitUntilSatisfied(); |
| 93 } |
60 } | 94 } |
OLD | NEW |