Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(372)

Side by Side Diff: chrome/browser/apps/custom_launcher_page_browsertest_views.cc

Issue 475543004: Added 'launcher_page' field to extension manifest.json format. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Formatting. Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/app_list_view_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/common/chrome_switches.h"
11 #include "extensions/common/extension.h" 10 #include "extensions/common/extension.h"
11 #include "extensions/common/switches.h"
12 #include "ui/app_list/app_list_switches.h" 12 #include "ui/app_list/app_list_switches.h"
13 13
14 namespace { 14 namespace {
15 15
16 // The path of the test application within the "platform_apps" directory. 16 // The path of the test application within the "platform_apps" directory.
17 const char kCustomLauncherPagePath[] = "custom_launcher_page"; 17 const char kCustomLauncherPagePath[] = "custom_launcher_page";
18 18
19 // The app ID and URL of the test application. 19 // The app ID of the test application.
20 const char kCustomLauncherPageUrl[] = 20 const char kCustomLauncherPageID[] = "lmadimbbgapmngbiclpjjngmdickadpl";
21 "chrome-extension://lmadimbbgapmngbiclpjjngmdickadpl/main.html";
22 21
23 } // namespace 22 } // namespace
24 23
25 // 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
26 // the app launcher. Within this test class, LoadAndLaunchPlatformApp runs the 25 // the app launcher. Within this test class, LoadAndLaunchPlatformApp runs the
27 // app inside the launcher, not as a standalone background page. 26 // app inside the launcher, not as a standalone background page.
28 // the app launcher. 27 // the app launcher.
29 class CustomLauncherPageBrowserTest 28 class CustomLauncherPageBrowserTest
30 : public extensions::PlatformAppBrowserTest { 29 : public extensions::PlatformAppBrowserTest {
31 public: 30 public:
32 CustomLauncherPageBrowserTest() {} 31 CustomLauncherPageBrowserTest() {}
33 32
34 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE { 33 virtual void SetUpCommandLine(base::CommandLine* command_line) OVERRIDE {
35 PlatformAppBrowserTest::SetUpCommandLine(command_line); 34 PlatformAppBrowserTest::SetUpCommandLine(command_line);
36 35
37 // Custom launcher pages only work in the experimental app list. 36 // Custom launcher pages only work in the experimental app list.
38 command_line->AppendSwitch(app_list::switches::kEnableExperimentalAppList); 37 command_line->AppendSwitch(app_list::switches::kEnableExperimentalAppList);
39 command_line->AppendSwitchASCII(switches::kCustomLauncherPage, 38
40 kCustomLauncherPageUrl); 39 // The test app must be whitelisted to use launcher_page.
40 command_line->AppendSwitchASCII(
41 extensions::switches::kWhitelistedExtensionID, kCustomLauncherPageID);
41 } 42 }
42 43
43 // Open the launcher. Ignores the Extension argument (this will simply 44 // Open the launcher. Ignores the Extension argument (this will simply
44 // activate any loaded launcher pages). 45 // activate any loaded launcher pages).
45 virtual void LaunchPlatformApp( 46 virtual void LaunchPlatformApp(
46 const extensions::Extension* /*unused*/) OVERRIDE { 47 const extensions::Extension* /*unused*/) OVERRIDE {
47 AppListService* service = 48 AppListService* service =
48 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); 49 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE);
49 DCHECK(service); 50 DCHECK(service);
50 service->ShowForProfile(browser()->profile()); 51 service->ShowForProfile(browser()->profile());
51 } 52 }
52 53
53 private: 54 private:
54 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageBrowserTest); 55 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageBrowserTest);
55 }; 56 };
56 57
57 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, LoadPageAndOpenLauncher) { 58 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, LoadPageAndOpenLauncher) {
58 LoadAndLaunchPlatformApp(kCustomLauncherPagePath, "Launched"); 59 LoadAndLaunchPlatformApp(kCustomLauncherPagePath, "Launched");
59 } 60 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/app_list/app_list_view_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698