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

Side by Side Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc

Issue 2290603002: Enhance chrome.app.window API for shelf integration with pinning support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 3 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h" 5 #include "chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "ash/aura/wm_window_aura.h" 9 #include "ash/aura/wm_window_aura.h"
10 #include "ash/common/ash_switches.h" 10 #include "ash/common/ash_switches.h"
(...skipping 2209 matching lines...) Expand 10 before | Expand all | Expand 10 after
2220 2220
2221 test.RunMessageLoopUntilAnimationsDone(); 2221 test.RunMessageLoopUntilAnimationsDone();
2222 EXPECT_FALSE(shelf_->IsShowingOverflowBubble()); 2222 EXPECT_FALSE(shelf_->IsShowingOverflowBubble());
2223 } 2223 }
2224 2224
2225 // Check that a windowed V1 application can navigate away from its domain, but 2225 // Check that a windowed V1 application can navigate away from its domain, but
2226 // still gets detected properly. 2226 // still gets detected properly.
2227 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, V1AppNavigation) { 2227 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, V1AppNavigation) {
2228 // We assume that the web store is always there (which it apparently is). 2228 // We assume that the web store is always there (which it apparently is).
2229 controller_->PinAppWithID(extensions::kWebStoreAppId); 2229 controller_->PinAppWithID(extensions::kWebStoreAppId);
2230 ash::ShelfID id = controller_->GetShelfIDForAppID( 2230 ash::ShelfID id = controller_->GetShelfIDForAppID(extensions::kWebStoreAppId,
2231 extensions::kWebStoreAppId); 2231 extensions::kWebStoreAppId);
2232 ASSERT_NE(0, id); 2232 ASSERT_NE(0, id);
2233 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(id)->status); 2233 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(id)->status);
2234 2234
2235 // Create a windowed application. 2235 // Create a windowed application.
2236 AppLaunchParams params = CreateAppLaunchParamsUserContainer( 2236 AppLaunchParams params = CreateAppLaunchParamsUserContainer(
2237 profile(), GetExtensionForAppID(extensions::kWebStoreAppId, profile()), 2237 profile(), GetExtensionForAppID(extensions::kWebStoreAppId, profile()),
2238 NEW_FOREGROUND_TAB, extensions::SOURCE_TEST); 2238 NEW_FOREGROUND_TAB, extensions::SOURCE_TEST);
2239 params.container = extensions::LAUNCH_CONTAINER_WINDOW; 2239 params.container = extensions::LAUNCH_CONTAINER_WINDOW;
2240 OpenApplication(params); 2240 OpenApplication(params);
2241 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(id)->status); 2241 EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(id)->status);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
2292 } 2292 }
2293 2293
2294 // Check that tabbed hosted and bookmark apps have correct shelf presence. 2294 // Check that tabbed hosted and bookmark apps have correct shelf presence.
2295 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, TabbedHostedAndBookmarkApps) { 2295 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, TabbedHostedAndBookmarkApps) {
2296 // Load and pin a hosted app. 2296 // Load and pin a hosted app.
2297 const Extension* hosted_app = 2297 const Extension* hosted_app =
2298 LoadExtension(test_data_dir_.AppendASCII("app1/")); 2298 LoadExtension(test_data_dir_.AppendASCII("app1/"));
2299 ASSERT_TRUE(hosted_app); 2299 ASSERT_TRUE(hosted_app);
2300 controller_->PinAppWithID(hosted_app->id()); 2300 controller_->PinAppWithID(hosted_app->id());
2301 const ash::ShelfID hosted_app_shelf_id = 2301 const ash::ShelfID hosted_app_shelf_id =
2302 controller_->GetShelfIDForAppID(hosted_app->id()); 2302 controller_->GetShelfIDForAppID(hosted_app->id(), hosted_app->id());
2303 2303
2304 // Load and pin a bookmark app. 2304 // Load and pin a bookmark app.
2305 const Extension* bookmark_app = InstallExtensionWithSourceAndFlags( 2305 const Extension* bookmark_app = InstallExtensionWithSourceAndFlags(
2306 test_data_dir_.AppendASCII("app2/"), 1, extensions::Manifest::INTERNAL, 2306 test_data_dir_.AppendASCII("app2/"), 1, extensions::Manifest::INTERNAL,
2307 extensions::Extension::FROM_BOOKMARK); 2307 extensions::Extension::FROM_BOOKMARK);
2308 ASSERT_TRUE(bookmark_app); 2308 ASSERT_TRUE(bookmark_app);
2309 controller_->PinAppWithID(bookmark_app->id()); 2309 controller_->PinAppWithID(bookmark_app->id());
2310 const ash::ShelfID bookmark_app_shelf_id = 2310 const ash::ShelfID bookmark_app_shelf_id =
2311 controller_->GetShelfIDForAppID(bookmark_app->id()); 2311 controller_->GetShelfIDForAppID(bookmark_app->id(), bookmark_app->id());
2312 2312
2313 // The apps should be closed. 2313 // The apps should be closed.
2314 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(hosted_app_shelf_id)->status); 2314 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(hosted_app_shelf_id)->status);
2315 EXPECT_EQ(ash::STATUS_CLOSED, 2315 EXPECT_EQ(ash::STATUS_CLOSED,
2316 model_->ItemByID(bookmark_app_shelf_id)->status); 2316 model_->ItemByID(bookmark_app_shelf_id)->status);
2317 2317
2318 // Navigate to the app's launch URLs in two tabs. 2318 // Navigate to the app's launch URLs in two tabs.
2319 ui_test_utils::NavigateToURL( 2319 ui_test_utils::NavigateToURL(
2320 browser(), extensions::AppLaunchInfo::GetLaunchWebURL(hosted_app)); 2320 browser(), extensions::AppLaunchInfo::GetLaunchWebURL(hosted_app));
2321 ui_test_utils::NavigateToURLWithDisposition( 2321 ui_test_utils::NavigateToURLWithDisposition(
(...skipping 15 matching lines...) Expand all
2337 } 2337 }
2338 2338
2339 // Check that windowed hosted and bookmark apps have correct shelf presence. 2339 // Check that windowed hosted and bookmark apps have correct shelf presence.
2340 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, WindowedHostedAndBookmarkApps) { 2340 IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, WindowedHostedAndBookmarkApps) {
2341 // Load and pin a hosted app. 2341 // Load and pin a hosted app.
2342 const Extension* hosted_app = 2342 const Extension* hosted_app =
2343 LoadExtension(test_data_dir_.AppendASCII("app1/")); 2343 LoadExtension(test_data_dir_.AppendASCII("app1/"));
2344 ASSERT_TRUE(hosted_app); 2344 ASSERT_TRUE(hosted_app);
2345 controller_->PinAppWithID(hosted_app->id()); 2345 controller_->PinAppWithID(hosted_app->id());
2346 const ash::ShelfID hosted_app_shelf_id = 2346 const ash::ShelfID hosted_app_shelf_id =
2347 controller_->GetShelfIDForAppID(hosted_app->id()); 2347 controller_->GetShelfIDForAppID(hosted_app->id(), hosted_app->id());
2348 2348
2349 // Load and pin a bookmark app. 2349 // Load and pin a bookmark app.
2350 const Extension* bookmark_app = InstallExtensionWithSourceAndFlags( 2350 const Extension* bookmark_app = InstallExtensionWithSourceAndFlags(
2351 test_data_dir_.AppendASCII("app2/"), 1, extensions::Manifest::INTERNAL, 2351 test_data_dir_.AppendASCII("app2/"), 1, extensions::Manifest::INTERNAL,
2352 extensions::Extension::FROM_BOOKMARK); 2352 extensions::Extension::FROM_BOOKMARK);
2353 ASSERT_TRUE(bookmark_app); 2353 ASSERT_TRUE(bookmark_app);
2354 controller_->PinAppWithID(bookmark_app->id()); 2354 controller_->PinAppWithID(bookmark_app->id());
2355 const ash::ShelfID bookmark_app_shelf_id = 2355 const ash::ShelfID bookmark_app_shelf_id =
2356 controller_->GetShelfIDForAppID(bookmark_app->id()); 2356 controller_->GetShelfIDForAppID(bookmark_app->id(), bookmark_app->id());
2357 2357
2358 // Set both apps to open in windows. 2358 // Set both apps to open in windows.
2359 extensions::SetLaunchType(browser()->profile(), hosted_app->id(), 2359 extensions::SetLaunchType(browser()->profile(), hosted_app->id(),
2360 extensions::LAUNCH_TYPE_WINDOW); 2360 extensions::LAUNCH_TYPE_WINDOW);
2361 extensions::SetLaunchType(browser()->profile(), bookmark_app->id(), 2361 extensions::SetLaunchType(browser()->profile(), bookmark_app->id(),
2362 extensions::LAUNCH_TYPE_WINDOW); 2362 extensions::LAUNCH_TYPE_WINDOW);
2363 2363
2364 // The apps should be closed. 2364 // The apps should be closed.
2365 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(hosted_app_shelf_id)->status); 2365 EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(hosted_app_shelf_id)->status);
2366 EXPECT_EQ(ash::STATUS_CLOSED, 2366 EXPECT_EQ(ash::STATUS_CLOSED,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
2403 2403
2404 // Close all windows via the menu item. 2404 // Close all windows via the menu item.
2405 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE); 2405 CloseBrowserWindow(browser(), menu1.get(), LauncherContextMenu::MENU_CLOSE);
2406 EXPECT_EQ(0u, BrowserList::GetInstance()->size()); 2406 EXPECT_EQ(0u, BrowserList::GetInstance()->size());
2407 2407
2408 // Check if "Close" is removed from the context menu. 2408 // Check if "Close" is removed from the context menu.
2409 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu(); 2409 std::unique_ptr<LauncherContextMenu> menu2 = CreateBrowserItemContextMenu();
2410 ASSERT_FALSE( 2410 ASSERT_FALSE(
2411 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE)); 2411 IsItemPresentInMenu(menu2.get(), LauncherContextMenu::MENU_CLOSE));
2412 } 2412 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698