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

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: address tapted@'s comments 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 24 matching lines...) Expand all
47 AppListService* service = 53 AppListService* service =
48 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE); 54 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE);
49 DCHECK(service); 55 DCHECK(service);
50 service->ShowForProfile(browser()->profile()); 56 service->ShowForProfile(browser()->profile());
51 } 57 }
52 58
53 private: 59 private:
54 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageBrowserTest); 60 DISALLOW_COPY_AND_ASSIGN(CustomLauncherPageBrowserTest);
55 }; 61 };
56 62
57 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest, LoadPageAndOpenLauncher) { 63 IN_PROC_BROWSER_TEST_F(CustomLauncherPageBrowserTest,
64 OpenLauncherAndSwitchToCustomPage) {
58 LoadAndLaunchPlatformApp(kCustomLauncherPagePath, "Launched"); 65 LoadAndLaunchPlatformApp(kCustomLauncherPagePath, "Launched");
66
67 AppListServiceViews* service = static_cast<AppListServiceViews*>(
68 AppListService::Get(chrome::HOST_DESKTOP_TYPE_NATIVE));
69 // The app list should have loaded instantly since the profile is already
70 // loaded.
71 EXPECT_TRUE(service->IsAppListVisible());
72
73 app_list::ContentsView* contents_view =
74 service->shower().app_list()->app_list_main_view()->contents_view();
75
76 ASSERT_TRUE(
77 contents_view->IsStateActive(app_list::AppListModel::STATE_START));
78
79 {
80 ExtensionTestMessageListener listener("onPageExpanded", false);
81 contents_view->SetActivePage(contents_view->GetPageIndexForState(
82 app_list::AppListModel::STATE_CUSTOM_LAUNCHER_PAGE));
83
84 listener.WaitUntilSatisfied();
85 }
86 {
87 ExtensionTestMessageListener listener("onPageCollapsed", false);
88 contents_view->SetActivePage(contents_view->GetPageIndexForState(
tapted 2014/11/07 05:34:56 You might run into a problem here on ChromeOS that
calamity 2014/11/10 03:38:30 Added and implemented the disable-app-list-on-blur
89 app_list::AppListModel::STATE_START));
90
91 listener.WaitUntilSatisfied();
92 }
59 } 93 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698