#include "chrome/browser/ui/ash/launcher/chrome_launcher_controller.h"
-#include "apps/shell_window.h"
-#include "apps/shell_window_registry.h"
+#include "apps/app_window.h"
+#include "apps/app_window_registry.h"
#include "apps/ui/native_app_window.h"
#include "ash/ash_switches.h"
#include "ash/display/display_controller.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/extensions/extension_function_test_utils.h"
#include "chrome/browser/extensions/extension_service.h"
-#include "chrome/browser/extensions/extension_system.h"
#include "chrome/browser/extensions/extension_test_message_listener.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/app_list_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
+#include "extensions/browser/extension_system.h"
#include "extensions/common/constants.h"
#include "extensions/common/switches.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/aura/window.h"
#include "ui/events/event.h"
-using apps::ShellWindow;
+using apps::AppWindow;
using extensions::Extension;
using content::WebContents;
DISALLOW_COPY_AND_ASSIGN(TestEvent);
};
-class TestShellWindowRegistryObserver
- : public apps::ShellWindowRegistry::Observer {
+class TestAppWindowRegistryObserver : public apps::AppWindowRegistry::Observer {
public:
- explicit TestShellWindowRegistryObserver(Profile* profile)
- : profile_(profile),
- icon_updates_(0) {
- apps::ShellWindowRegistry::Get(profile_)->AddObserver(this);
+ explicit TestAppWindowRegistryObserver(Profile* profile)
+ : profile_(profile), icon_updates_(0) {
+ apps::AppWindowRegistry::Get(profile_)->AddObserver(this);
}
- virtual ~TestShellWindowRegistryObserver() {
- apps::ShellWindowRegistry::Get(profile_)->RemoveObserver(this);
+ virtual ~TestAppWindowRegistryObserver() {
+ apps::AppWindowRegistry::Get(profile_)->RemoveObserver(this);
}
- // Overridden from ShellWindowRegistry::Observer:
- virtual void OnShellWindowAdded(ShellWindow* shell_window) OVERRIDE {}
+ // Overridden from AppWindowRegistry::Observer:
+ virtual void OnAppWindowAdded(AppWindow* app_window) OVERRIDE {}
- virtual void OnShellWindowIconChanged(ShellWindow* shell_window) OVERRIDE {
+ virtual void OnAppWindowIconChanged(AppWindow* app_window) OVERRIDE {
++icon_updates_;
}
- virtual void OnShellWindowRemoved(ShellWindow* shell_window) OVERRIDE {}
+ virtual void OnAppWindowRemoved(AppWindow* app_window) OVERRIDE {}
int icon_updates() { return icon_updates_; }
Profile* profile_;
int icon_updates_;
- DISALLOW_COPY_AND_ASSIGN(TestShellWindowRegistryObserver);
+ DISALLOW_COPY_AND_ASSIGN(TestAppWindowRegistryObserver);
};
} // namespace
return ash::test::ShellTestApi(ash::Shell::GetInstance()).shelf_model();
}
- ash::LauncherID CreateAppShortcutLauncherItem(const std::string& name) {
+ ash::ShelfID CreateAppShortcutLauncherItem(const std::string& name) {
return controller_->CreateAppShortcutLauncherItem(
name, controller_->model()->item_count());
}
- const ash::LauncherItem& GetLastLauncherItem() {
+ const ash::ShelfItem& GetLastLauncherItem() {
// Unless there are any panels, the item at index [count - 1] will be
// the desired item.
return shelf_model()->items()[shelf_model()->item_count() - 1];
}
- const ash::LauncherItem& GetLastLauncherPanelItem() {
+ const ash::ShelfItem& GetLastLauncherPanelItem() {
// Panels show up on the right side of the shelf, so the desired item
// will be the last one.
return shelf_model()->items()[shelf_model()->item_count() - 1];
}
- LauncherItemController* GetItemController(ash::LauncherID id) {
+ LauncherItemController* GetItemController(ash::ShelfID id) {
return controller_->id_to_item_controller_map_[id];
}
// Returns the number of menu items, ignoring separators.
- int GetNumApplicationMenuItems(const ash::LauncherItem& item) {
+ int GetNumApplicationMenuItems(const ash::ShelfItem& item) {
const int event_flags = 0;
scoped_ptr<ash::ShelfMenuModel> menu(new LauncherApplicationMenuItemModel(
controller_->GetApplicationList(item, event_flags)));
return extension;
}
- ash::LauncherID CreateShortcut(const char* name) {
+ ash::ShelfID CreateShortcut(const char* name) {
ExtensionService* service = extensions::ExtensionSystem::Get(
profile())->extension_service();
LoadExtension(test_data_dir_.AppendASCII(name));
// Then create a shortcut.
int item_count = model_->item_count();
- ash::LauncherID shortcut_id = controller_->CreateAppShortcutLauncherItem(
+ ash::ShelfID shortcut_id = controller_->CreateAppShortcutLauncherItem(
app_id,
item_count);
controller_->PersistPinnedState();
EXPECT_EQ(++item_count, model_->item_count());
- const ash::LauncherItem& item = *model_->ItemByID(shortcut_id);
+ const ash::ShelfItem& item = *model_->ItemByID(shortcut_id);
EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type);
return item.id;
}
- void RemoveShortcut(ash::LauncherID id) {
+ void RemoveShortcut(ash::ShelfID id) {
controller_->Unpin(id);
}
shelf_->ActivateShelfItem(id);
}
- ash::LauncherID PinFakeApp(const std::string& name) {
+ ash::ShelfID PinFakeApp(const std::string& name) {
return controller_->CreateAppShortcutLauncherItem(
name, model_->item_count());
}
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchUnpinned) {
int item_count = shelf_model()->item_count();
const Extension* extension = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window = CreateShellWindow(extension);
+ AppWindow* window = CreateAppWindow(extension);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
- const ash::LauncherItem& item = GetLastLauncherItem();
+ const ash::ShelfItem& item = GetLastLauncherItem();
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item.status);
- CloseShellWindow(window);
+ CloseAppWindow(window);
--item_count;
EXPECT_EQ(item_count, shelf_model()->item_count());
}
const std::string app_id = extension->id();
// Then create a shortcut.
- ash::LauncherID shortcut_id = CreateAppShortcutLauncherItem(app_id);
+ ash::ShelfID shortcut_id = CreateAppShortcutLauncherItem(app_id);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
- ash::LauncherItem item = *shelf_model()->ItemByID(shortcut_id);
+ ash::ShelfItem item = *shelf_model()->ItemByID(shortcut_id);
EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type);
EXPECT_EQ(ash::STATUS_CLOSED, item.status);
// Open a window. Confirm the item is now running.
- ShellWindow* window = CreateShellWindow(extension);
+ AppWindow* window = CreateAppWindow(extension);
ash::wm::ActivateWindow(window->GetNativeWindow());
ASSERT_EQ(item_count, shelf_model()->item_count());
item = *shelf_model()->ItemByID(shortcut_id);
EXPECT_EQ(ash::STATUS_ACTIVE, item.status);
// Then close it, make sure there's still an item.
- CloseShellWindow(window);
+ CloseAppWindow(window);
ASSERT_EQ(item_count, shelf_model()->item_count());
item = *shelf_model()->ItemByID(shortcut_id);
EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type);
// Run.
int item_count = shelf_model()->item_count();
const Extension* extension = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window = CreateShellWindow(extension);
+ AppWindow* window = CreateAppWindow(extension);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
- const ash::LauncherItem& item1 = GetLastLauncherItem();
- ash::LauncherID id = item1.id;
+ const ash::ShelfItem& item1 = GetLastLauncherItem();
+ ash::ShelfID id = item1.id;
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Create a shortcut. The app item should be after it.
- ash::LauncherID foo_id = CreateAppShortcutLauncherItem("foo");
+ ash::ShelfID foo_id = CreateAppShortcutLauncherItem("foo");
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
EXPECT_LT(shelf_model()->ItemIndexByID(foo_id),
// Pin the app. The item should remain.
controller_->Pin(id);
ASSERT_EQ(item_count, shelf_model()->item_count());
- const ash::LauncherItem& item2 = *shelf_model()->ItemByID(id);
+ const ash::ShelfItem& item2 = *shelf_model()->ItemByID(id);
EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item2.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item2.status);
// New shortcuts should come after the item.
- ash::LauncherID bar_id = CreateAppShortcutLauncherItem("bar");
+ ash::ShelfID bar_id = CreateAppShortcutLauncherItem("bar");
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
EXPECT_LT(shelf_model()->ItemIndexByID(id),
shelf_model()->ItemIndexByID(bar_id));
// Then close it, make sure the item remains.
- CloseShellWindow(window);
+ CloseAppWindow(window);
ASSERT_EQ(item_count, shelf_model()->item_count());
}
const std::string app_id = extension->id();
// Then create a shortcut.
- ash::LauncherID shortcut_id = CreateAppShortcutLauncherItem(app_id);
+ ash::ShelfID shortcut_id = CreateAppShortcutLauncherItem(app_id);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
- ash::LauncherItem item = *shelf_model()->ItemByID(shortcut_id);
+ ash::ShelfItem item = *shelf_model()->ItemByID(shortcut_id);
EXPECT_EQ(ash::TYPE_APP_SHORTCUT, item.type);
EXPECT_EQ(ash::STATUS_CLOSED, item.status);
// Create a second shortcut. This will be needed to force the first one to
// move once it gets unpinned.
- ash::LauncherID foo_id = CreateAppShortcutLauncherItem("foo");
+ ash::ShelfID foo_id = CreateAppShortcutLauncherItem("foo");
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
EXPECT_LT(shelf_model()->ItemIndexByID(shortcut_id),
shelf_model()->ItemIndexByID(foo_id));
// Open a window. Confirm the item is now running.
- ShellWindow* window = CreateShellWindow(extension);
+ AppWindow* window = CreateAppWindow(extension);
ash::wm::ActivateWindow(window->GetNativeWindow());
ASSERT_EQ(item_count, shelf_model()->item_count());
item = *shelf_model()->ItemByID(shortcut_id);
shelf_model()->ItemIndexByID(foo_id));
// Then close it, make sure the item's gone.
- CloseShellWindow(window);
+ CloseAppWindow(window);
--item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
}
// First run app.
const Extension* extension = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window1 = CreateShellWindow(extension);
+ AppWindow* window1 = CreateAppWindow(extension);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
- const ash::LauncherItem& item1 = GetLastLauncherItem();
- ash::LauncherID item_id = item1.id;
+ const ash::ShelfItem& item1 = GetLastLauncherItem();
+ ash::ShelfID item_id = item1.id;
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
EXPECT_EQ(2, GetNumApplicationMenuItems(item1)); // Title + 1 window
// Add second window.
- ShellWindow* window2 = CreateShellWindow(extension);
+ AppWindow* window2 = CreateAppWindow(extension);
// Confirm item stays.
ASSERT_EQ(item_count, shelf_model()->item_count());
- const ash::LauncherItem& item2 = *shelf_model()->ItemByID(item_id);
+ const ash::ShelfItem& item2 = *shelf_model()->ItemByID(item_id);
EXPECT_EQ(ash::STATUS_ACTIVE, item2.status);
EXPECT_EQ(3, GetNumApplicationMenuItems(item2)); // Title + 2 windows
// Close second window.
- CloseShellWindow(window2);
+ CloseAppWindow(window2);
// Confirm item stays.
ASSERT_EQ(item_count, shelf_model()->item_count());
- const ash::LauncherItem& item3 = *shelf_model()->ItemByID(item_id);
+ const ash::ShelfItem& item3 = *shelf_model()->ItemByID(item_id);
EXPECT_EQ(ash::STATUS_ACTIVE, item3.status);
EXPECT_EQ(2, GetNumApplicationMenuItems(item3)); // Title + 1 window
// Close first window.
- CloseShellWindow(window1);
+ CloseAppWindow(window1);
// Confirm item is removed.
--item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
// First run app.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window1 = CreateShellWindow(extension1);
+ AppWindow* window1 = CreateAppWindow(extension1);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
- const ash::LauncherItem& item1 = GetLastLauncherItem();
- ash::LauncherID item_id1 = item1.id;
+ const ash::ShelfItem& item1 = GetLastLauncherItem();
+ ash::ShelfID item_id1 = item1.id;
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Then run second app.
const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2");
- ShellWindow* window2 = CreateShellWindow(extension2);
+ AppWindow* window2 = CreateAppWindow(extension2);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
- const ash::LauncherItem& item2 = GetLastLauncherItem();
- ash::LauncherID item_id2 = item2.id;
+ const ash::ShelfItem& item2 = GetLastLauncherItem();
+ ash::ShelfID item_id2 = item2.id;
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item2.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item2.status);
EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status);
// Close second app.
- CloseShellWindow(window2);
+ CloseAppWindow(window2);
--item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
// First app should be active again.
EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status);
// Close first app.
- CloseShellWindow(window1);
+ CloseAppWindow(window1);
--item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
}
// First run app.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window1 = CreateShellWindow(extension1);
+ AppWindow* window1 = CreateAppWindow(extension1);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
- const ash::LauncherItem& item1 = GetLastLauncherItem();
- ash::LauncherID item_id1 = item1.id;
+ const ash::ShelfItem& item1 = GetLastLauncherItem();
+ ash::ShelfID item_id1 = item1.id;
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Then run second app.
const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2");
- ShellWindow* window2 = CreateShellWindow(extension2);
+ AppWindow* window2 = CreateAppWindow(extension2);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
- const ash::LauncherItem& item2 = GetLastLauncherItem();
- ash::LauncherID item_id2 = item2.id;
+ const ash::ShelfItem& item2 = GetLastLauncherItem();
+ ash::ShelfID item_id2 = item2.id;
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item2.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item2.status);
EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow()));
// Add window for app1. This will activate it.
- ShellWindow* window1b = CreateShellWindow(extension1);
+ AppWindow* window1b = CreateAppWindow(extension1);
ash::wm::ActivateWindow(window1b->GetNativeWindow());
EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow()));
EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow()));
EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow()));
// Close second app.
- CloseShellWindow(window2);
+ CloseAppWindow(window2);
--item_count;
EXPECT_EQ(item_count, shelf_model()->item_count());
// First app should be active again.
EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status);
// Close first app.
- CloseShellWindow(window1b);
- CloseShellWindow(window1);
+ CloseAppWindow(window1b);
+ CloseAppWindow(window1);
--item_count;
EXPECT_EQ(item_count, shelf_model()->item_count());
}
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserNoMinimizeOnClick, AppClickBehavior) {
// Launch a platform app and create a window for it.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window1 = CreateShellWindow(extension1);
+ AppWindow* window1 = CreateAppWindow(extension1);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
// Confirm that a controller item was created and is the correct state.
- const ash::LauncherItem& item1 = GetLastLauncherItem();
+ const ash::ShelfItem& item1 = GetLastLauncherItem();
LauncherItemController* item1_controller = GetItemController(item1.id);
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
PackagedAppClickBehaviorInMinimizeMode) {
// Launch one platform app and create a window for it.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- ShellWindow* window1 = CreateShellWindow(extension1);
+ AppWindow* window1 = CreateAppWindow(extension1);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
// Confirm that a controller item was created and is the correct state.
- const ash::LauncherItem& item1 = GetLastLauncherItem();
+ const ash::ShelfItem& item1 = GetLastLauncherItem();
LauncherItemController* item1_controller = GetItemController(item1.id);
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Creating a second window of the same type should change the behavior so
// that a click does not change the activation state.
- ShellWindow* window1a = CreateShellWindow(extension1);
+ AppWindow* window1a = CreateAppWindow(extension1);
EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1a->GetBaseWindow()->IsActive());
// The first click does nothing.
extensions::switches::kEnableExperimentalExtensionApis);
// Launch a platform app and create a panel window for it.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- ShellWindow::CreateParams params;
- params.window_type = ShellWindow::WINDOW_TYPE_PANEL;
+ AppWindow::CreateParams params;
+ params.window_type = AppWindow::WINDOW_TYPE_PANEL;
params.focused = false;
- ShellWindow* panel = CreateShellWindowFromParams(extension1, params);
+ AppWindow* panel = CreateAppWindowFromParams(extension1, params);
EXPECT_TRUE(panel->GetNativeWindow()->IsVisible());
// Panels should not be active by default.
EXPECT_FALSE(panel->GetBaseWindow()->IsActive());
// Confirm that a controller item was created and is the correct state.
- const ash::LauncherItem& item1 = GetLastLauncherPanelItem();
+ const ash::ShelfItem& item1 = GetLastLauncherPanelItem();
LauncherItemController* item1_controller = GetItemController(item1.id);
EXPECT_EQ(ash::TYPE_APP_PANEL, item1.type);
EXPECT_EQ(ash::STATUS_RUNNING, item1.status);
// First run app.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- CreateShellWindow(extension1);
+ CreateAppWindow(extension1);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
- const ash::LauncherItem& item1 = GetLastLauncherItem();
- ash::LauncherID item_id1 = item1.id;
+ const ash::ShelfItem& item1 = GetLastLauncherItem();
+ ash::ShelfID item_id1 = item1.id;
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Test that opening an app sets the correct icon
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, SetIcon) {
- TestShellWindowRegistryObserver test_observer(browser()->profile());
+ TestAppWindowRegistryObserver test_observer(browser()->profile());
// Enable experimental APIs to allow panel creation.
CommandLine::ForCurrentProcess()->AppendSwitch(
run_loop.RunUntilIdle();
}
- // This test creates one shell window and one panel window.
+ // This test creates one app window and one panel window.
int shelf_item_count = shelf_model()->item_count();
ASSERT_EQ(base_shelf_item_count + 2, shelf_item_count);
// The Panel will be the last item, the app second-to-last.
- const ash::LauncherItem& app_item =
+ const ash::ShelfItem& app_item =
shelf_model()->items()[shelf_item_count - 2];
- const ash::LauncherItem& panel_item =
+ const ash::ShelfItem& panel_item =
shelf_model()->items()[shelf_item_count - 1];
const LauncherItemController* app_item_controller =
GetItemController(app_item.id);
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchPinned) {
TabStripModel* tab_strip = browser()->tab_strip_model();
int tab_count = tab_strip->count();
- ash::LauncherID shortcut_id = CreateShortcut("app1");
+ ash::ShelfID shortcut_id = CreateShortcut("app1");
EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status);
ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(++tab_count, tab_strip->count());
LoadAndLaunchExtension("app1", extensions::LAUNCH_CONTAINER_TAB,
NEW_FOREGROUND_TAB);
EXPECT_EQ(++tab_count, tab_strip->count());
- ash::LauncherID shortcut_id = CreateShortcut("app1");
+ ash::ShelfID shortcut_id = CreateShortcut("app1");
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
WebContents* tab = tab_strip->GetActiveWebContents();
content::WebContentsDestroyedWatcher destroyed_watcher(tab);
int tab_count = tab_strip->count();
ash::wm::GetWindowState(window2)->Maximize();
- ash::LauncherID shortcut_id = CreateShortcut("app1");
+ ash::ShelfID shortcut_id = CreateShortcut("app1");
ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(++tab_count, tab_strip->count());
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
int item_count = model_->item_count();
TabStripModel* tab_strip = browser()->tab_strip_model();
int tab_count = tab_strip->count();
- ash::LauncherID shortcut1 = CreateShortcut("app1");
+ ash::ShelfID shortcut1 = CreateShortcut("app1");
EXPECT_EQ(++item_count, model_->item_count());
- ash::LauncherID shortcut2 = CreateShortcut("app2");
+ ash::ShelfID shortcut2 = CreateShortcut("app2");
EXPECT_EQ(++item_count, model_->item_count());
// Launch first app.
// Confirm that a page can be navigated from and to while maintaining the
// correct running state.
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, Navigation) {
- ash::LauncherID shortcut_id = CreateShortcut("app1");
+ ash::ShelfID shortcut_id = CreateShortcut("app1");
EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status);
ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
// Create a shortcut for app1.
- ash::LauncherID shortcut_id = CreateShortcut("app1");
+ ash::ShelfID shortcut_id = CreateShortcut("app1");
EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status);
EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status);
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleOwnedTabs) {
TabStripModel* tab_strip = browser()->tab_strip_model();
int tab_count = tab_strip->count();
- ash::LauncherID shortcut_id = CreateShortcut("app1");
+ ash::ShelfID shortcut_id = CreateShortcut("app1");
ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(++tab_count, tab_strip->count());
EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status);
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilter) {
TabStripModel* tab_strip = browser()->tab_strip_model();
int tab_count = tab_strip->count();
- ash::LauncherID shortcut_id = CreateShortcut("app1");
+ ash::ShelfID shortcut_id = CreateShortcut("app1");
ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(++tab_count, tab_strip->count());
EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status);
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilterLaunch) {
TabStripModel* tab_strip = browser()->tab_strip_model();
int tab_count = tab_strip->count();
- ash::LauncherID shortcut_id = CreateShortcut("app1");
+ ash::ShelfID shortcut_id = CreateShortcut("app1");
controller_->SetRefocusURLPatternForTest(
shortcut_id, GURL("http://www.example.com/path1/*"));
// Even though we are just comming up, the browser should be active.
EXPECT_EQ(ash::STATUS_ACTIVE, model_->items()[browser_index].status);
- ash::LauncherID shortcut_id = CreateShortcut("app1");
+ ash::ShelfID shortcut_id = CreateShortcut("app1");
controller_->SetRefocusURLPatternForTest(
shortcut_id, GURL("http://www.example.com/path1/*"));
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, AsyncActivationStateCheck) {
TabStripModel* tab_strip = browser()->tab_strip_model();
- ash::LauncherID shortcut_id = CreateShortcut("app1");
+ ash::ShelfID shortcut_id = CreateShortcut("app1");
controller_->SetRefocusURLPatternForTest(
shortcut_id, GURL("http://www.example.com/path1/*"));
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, AltNumberTabsTabbing) {
TabStripModel* tab_strip = browser()->tab_strip_model();
- ash::LauncherID shortcut_id = CreateShortcut("app");
+ ash::ShelfID shortcut_id = CreateShortcut("app");
controller_->SetRefocusURLPatternForTest(
shortcut_id, GURL("http://www.example.com/path/*"));
std::string url = "http://www.example.com/path/bla";
AltNumberAppsTabbing) {
// First run app.
const Extension* extension1 = LoadAndLaunchPlatformApp("launch");
- ui::BaseWindow* window1 = CreateShellWindow(extension1)->GetBaseWindow();
- const ash::LauncherItem& item1 = GetLastLauncherItem();
- ash::LauncherID app_id = item1.id;
+ ui::BaseWindow* window1 = CreateAppWindow(extension1)->GetBaseWindow();
+ const ash::ShelfItem& item1 = GetLastLauncherItem();
+ ash::ShelfID app_id = item1.id;
int app_index = shelf_model()->ItemIndexByID(app_id);
EXPECT_EQ(ash::TYPE_PLATFORM_APP, item1.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
const Extension* extension2 = LoadAndLaunchPlatformApp("launch_2");
- ui::BaseWindow* window2 = CreateShellWindow(extension2)->GetBaseWindow();
+ ui::BaseWindow* window2 = CreateAppWindow(extension2)->GetBaseWindow();
// By now the browser should be active. Issue Alt keystrokes several times to
// see that we stay on that application.
ActivateShelfItem(app_index);
EXPECT_TRUE(window1->IsActive());
- ui::BaseWindow* window1a = CreateShellWindow(extension1)->GetBaseWindow();
+ ui::BaseWindow* window1a = CreateAppWindow(extension1)->GetBaseWindow();
EXPECT_TRUE(window1a->IsActive());
EXPECT_FALSE(window1->IsActive());
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, LaunchPanelWindow) {
int item_count = shelf_model()->item_count();
const Extension* extension = LoadAndLaunchPlatformApp("launch");
- ShellWindow::CreateParams params;
- params.window_type = ShellWindow::WINDOW_TYPE_PANEL;
+ AppWindow::CreateParams params;
+ params.window_type = AppWindow::WINDOW_TYPE_PANEL;
params.focused = false;
- ShellWindow* window = CreateShellWindowFromParams(extension, params);
+ AppWindow* window = CreateAppWindowFromParams(extension, params);
++item_count;
ASSERT_EQ(item_count, shelf_model()->item_count());
- const ash::LauncherItem& item = GetLastLauncherPanelItem();
+ const ash::ShelfItem& item = GetLastLauncherPanelItem();
EXPECT_EQ(ash::TYPE_APP_PANEL, item.type);
// Opening a panel does not activate it.
EXPECT_EQ(ash::STATUS_RUNNING, item.status);
- CloseShellWindow(window);
+ CloseAppWindow(window);
--item_count;
EXPECT_EQ(item_count, shelf_model()->item_count());
}
// Test attention states of windows.
IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowAttentionStatus) {
const Extension* extension = LoadAndLaunchPlatformApp("launch");
- ShellWindow::CreateParams params;
- params.window_type = ShellWindow::WINDOW_TYPE_PANEL;
+ AppWindow::CreateParams params;
+ params.window_type = AppWindow::WINDOW_TYPE_PANEL;
params.focused = false;
- ShellWindow* panel = CreateShellWindowFromParams(extension, params);
+ AppWindow* panel = CreateAppWindowFromParams(extension, params);
EXPECT_TRUE(panel->GetNativeWindow()->IsVisible());
// Panels should not be active by default.
EXPECT_FALSE(panel->GetBaseWindow()->IsActive());
// Confirm that a controller item was created and is the correct state.
- const ash::LauncherItem& item = GetLastLauncherPanelItem();
+ const ash::ShelfItem& item = GetLastLauncherPanelItem();
LauncherItemController* item_controller = GetItemController(item.id);
EXPECT_EQ(ash::TYPE_APP_PANEL, item.type);
EXPECT_EQ(ash::STATUS_RUNNING, item.status);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
// Create a known application.
- ash::LauncherID shortcut_id = CreateShortcut("app1");
+ ash::ShelfID shortcut_id = CreateShortcut("app1");
// Create a new browser - without activating it - and load an "app" into it.
Browser::CreateParams params =
// Test #5: Uninstalling an application while it is being ripped off should
// not crash.
- ash::LauncherID app_id = CreateShortcut("app2");
+ ash::ShelfID app_id = CreateShortcut("app2");
test.RunMessageLoopUntilAnimationsDone();
int app2_index = GetIndexOfShelfItemType(ash::TYPE_APP_SHORTCUT);
EXPECT_EQ(3, model_->item_count()); // And it remains that way.
EXPECT_FALSE(window_state->IsMinimized());
}
-// Check that GetLauncherIDForWindow() returns |LauncherID| of the active tab.
-IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MatchingLauncherIDandActiveTab) {
+// Check that GetShelfIDForWindow() returns |ShelfID| of the active tab.
+IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MatchingShelfIDandActiveTab) {
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
EXPECT_EQ(1, browser()->tab_strip_model()->count());
EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
aura::Window* window = browser()->window()->GetNativeWindow();
int browser_index = GetIndexOfShelfItemType(ash::TYPE_BROWSER_SHORTCUT);
- ash::LauncherID browser_id = model_->items()[browser_index].id;
- EXPECT_EQ(browser_id, ash::GetLauncherIDForWindow(window));
+ ash::ShelfID browser_id = model_->items()[browser_index].id;
+ EXPECT_EQ(browser_id, ash::GetShelfIDForWindow(window));
- ash::LauncherID app_id = CreateShortcut("app1");
+ ash::ShelfID app_id = CreateShortcut("app1");
EXPECT_EQ(3, model_->item_count());
- // Creates a new tab for "app1" and checks that GetLauncherIDForWindow()
- // returns |LauncherID| of "app1".
+ // Creates a new tab for "app1" and checks that GetShelfIDForWindow()
+ // returns |ShelfID| of "app1".
ActivateShelfItem(model_->ItemIndexByID(app_id));
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
- EXPECT_EQ(app_id, ash::GetLauncherIDForWindow(window));
+ EXPECT_EQ(app_id, ash::GetShelfIDForWindow(window));
// Makes tab at index 0(NTP) as an active tab and checks that
- // GetLauncherIDForWindow() returns |LauncherID| of browser shortcut.
+ // GetShelfIDForWindow() returns |ShelfID| of browser shortcut.
browser()->tab_strip_model()->ActivateTabAt(0, false);
EXPECT_EQ(0, browser()->tab_strip_model()->active_index());
- EXPECT_EQ(browser_id, ash::GetLauncherIDForWindow(window));
+ EXPECT_EQ(browser_id, ash::GetShelfIDForWindow(window));
}
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, OverflowBubble) {
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, V1AppNavigation) {
// We assume that the web store is always there (which it apparently is).
controller_->PinAppWithID(extension_misc::kWebStoreAppId);
- ash::LauncherID id = controller_->GetLauncherIDForAppID(
+ ash::ShelfID id = controller_->GetShelfIDForAppID(
extension_misc::kWebStoreAppId);
ASSERT_NE(0, id);
EXPECT_EQ(ash::STATUS_CLOSED, model_->ItemByID(id)->status);