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
3 // found in the LICENSE file.
7 #include "base/command_line.h"
8 #include "chrome/browser/apps/app_browsertest_util.h"
9 #include "chrome/browser/ui/app_list/app_list_service.h"
10 #include "extensions/common/extension.h"
11 #include "extensions/common/switches.h"
12 #include "ui/app_list/app_list_switches.h"
16 // The path of the test application within the "platform_apps" directory.
17 const char kCustomLauncherPagePath
[] = "custom_launcher_page";
19 // The app ID of the test application.
20 const char kCustomLauncherPageID
[] = "lmadimbbgapmngbiclpjjngmdickadpl";
24 // Browser tests for custom launcher pages, platform apps that run as a page in
25 // the app launcher. Within this test class, LoadAndLaunchPlatformApp runs the
26 // app inside the launcher, not as a standalone background page.
28 class CustomLauncherPageBrowserTest
29 : public extensions::PlatformAppBrowserTest
{
31 CustomLauncherPageBrowserTest() {}
33 virtual void SetUpCommandLine(base::CommandLine
* command_line
) OVERRIDE
{
34 PlatformAppBrowserTest::SetUpCommandLine(command_line
);
36 // Custom launcher pages only work in the experimental app list.
37 command_line
->AppendSwitch(app_list::switches::kEnableExperimentalAppList
);
39 // The test app must be whitelisted to use launcher_page.
40 command_line
->AppendSwitchASCII(
41 extensions::switches::kWhitelistedExtensionID
, kCustomLauncherPageID
);
44 // Open the launcher. Ignores the Extension argument (this will simply
45 // activate any loaded launcher pages).
46 virtual void LaunchPlatformApp(
47 const extensions::Extension
* /*unused*/) OVERRIDE
{
48 AppListService
* service
=
49 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE
);
51 service
->ShowForProfile(browser()->profile());
55 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageBrowserTest
);
58 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest
, LoadPageAndOpenLauncher
) {
59 LoadAndLaunchPlatformApp(kCustomLauncherPagePath
, "Launched");