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

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

Issue 683703002: Notify launcher page with onTransitionChanged event (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@launcher_page_api_show_state_notify
Patch Set: Created 6 years, 1 month 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
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/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
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 OpenLauncherAndShowCustomPage) {
Matt Giuca 2014/10/28 05:41:22 Perhaps s/Show/SwitchTo/
calamity 2014/10/28 06:34:21 Done.
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 {
78 ExtensionTestMessageListener listener("onPageExpand", false);
79 contents_view->SetActivePage(contents_view->GetPageIndexForState(
80 app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE));
81
82 listener.WaitUntilSatisfied();
83 }
84 {
85 ExtensionTestMessageListener listener("onPageCollapse", false);
86 contents_view->SetActivePage(contents_view->GetPageIndexForState(
87 app_list::AppListModel::STATE_START));
88
89 listener.WaitUntilSatisfied();
90 }
60 } 91 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698