| 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 "extensions/common/extension.h" | 10 #include "extensions/common/extension.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 // Browser tests for custom launcher pages, platform apps that run as a page in | 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 | 25 // the app launcher. Within this test class, LoadAndLaunchPlatformApp runs the |
| 26 // app inside the launcher, not as a standalone background page. | 26 // app inside the launcher, not as a standalone background page. |
| 27 // the app launcher. | 27 // the app launcher. |
| 28 class CustomLauncherPageBrowserTest | 28 class CustomLauncherPageBrowserTest |
| 29 : public extensions::PlatformAppBrowserTest { | 29 : public extensions::PlatformAppBrowserTest { |
| 30 public: | 30 public: |
| 31 CustomLauncherPageBrowserTest() {} | 31 CustomLauncherPageBrowserTest() {} |
| 32 | 32 |
| 33 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { | 33 virtual void SetUpCommandLine(base::CommandLine* command_line) override { |
| 34 PlatformAppBrowserTest::SetUpCommandLine(command_line); | 34 PlatformAppBrowserTest::SetUpCommandLine(command_line); |
| 35 | 35 |
| 36 // Custom launcher pages only work in the experimental app list. | 36 // Custom launcher pages only work in the experimental app list. |
| 37 command_line->AppendSwitch(app_list::switches::kEnableExperimentalAppList); | 37 command_line->AppendSwitch(app_list::switches::kEnableExperimentalAppList); |
| 38 | 38 |
| 39 // The test app must be whitelisted to use launcher_page. | 39 // The test app must be whitelisted to use launcher_page. |
| 40 command_line->AppendSwitchASCII( | 40 command_line->AppendSwitchASCII( |
| 41 extensions::switches::kWhitelistedExtensionID, kCustomLauncherPageID); | 41 extensions::switches::kWhitelistedExtensionID, kCustomLauncherPageID); |
| 42 } | 42 } |
| 43 | 43 |
| 44 // Open the launcher. Ignores the Extension argument (this will simply | 44 // Open the launcher. Ignores the Extension argument (this will simply |
| 45 // activate any loaded launcher pages). | 45 // activate any loaded launcher pages). |
| 46 virtual void LaunchPlatformApp( | 46 virtual void LaunchPlatformApp( |
| 47 const extensions::Extension* /*unused*/) OVERRIDE { | 47 const extensions::Extension* /*unused*/) override { |
| 48 AppListService* service = | 48 AppListService* service = |
| 49 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); | 49 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); |
| 50 DCHECK(service); | 50 DCHECK(service); |
| 51 service->ShowForProfile(browser()->profile()); | 51 service->ShowForProfile(browser()->profile()); |
| 52 } | 52 } |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageBrowserTest); | 55 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageBrowserTest); |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, LoadPageAndOpenLauncher) { | 58 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, LoadPageAndOpenLauncher) { |
| 59 LoadAndLaunchPlatformApp(kCustomLauncherPagePath, "Launched"); | 59 LoadAndLaunchPlatformApp(kCustomLauncherPagePath, "Launched"); |
| 60 } | 60 } |
| OLD | NEW |