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

Unified Diff: chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc

Issue 2899253002: chromeos: Rename ash::WmShelf to Shelf (Closed)
Patch Set: rebase Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
index 5ab7c5e74ba2166a67680261b465b3b27d16efd1..2f4fc9a9823c578403dae293ccdd580bc970212d 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
@@ -9,12 +9,12 @@
#include "ash/public/cpp/shelf_item_delegate.h"
#include "ash/public/cpp/window_properties.h"
#include "ash/shelf/app_list_button.h"
+#include "ash/shelf/shelf.h"
#include "ash/shelf/shelf_button.h"
#include "ash/shelf/shelf_constants.h"
#include "ash/shelf/shelf_model.h"
#include "ash/shelf/shelf_view.h"
#include "ash/shelf/shelf_widget.h"
-#include "ash/shelf/wm_shelf.h"
#include "ash/shell.h"
#include "ash/shell_port.h"
#include "ash/test/shelf_view_test_api.h"
@@ -83,7 +83,7 @@
#include "ui/events/event_constants.h"
#include "ui/events/test/event_generator.h"
-using ash::WmShelf;
+using ash::Shelf;
using extensions::AppWindow;
using extensions::Extension;
using content::WebContents;
@@ -278,7 +278,7 @@ class ShelfAppBrowserTest : public ExtensionBrowserTest {
// Ensure ash starts the session and creates the shelf and controller.
SessionControllerClient::FlushForTesting();
- shelf_ = ash::WmShelf::ForWindow(ash::Shell::GetPrimaryRootWindow());
+ shelf_ = Shelf::ForWindow(ash::Shell::GetPrimaryRootWindow());
model_ = ash::Shell::Get()->shelf_model();
controller_ = ChromeLauncherController::instance();
ASSERT_TRUE(controller_);
@@ -375,7 +375,7 @@ class ShelfAppBrowserTest : public ExtensionBrowserTest {
int index = model_->GetItemIndexForType(ash::TYPE_BROWSER_SHORTCUT);
DCHECK_GE(index, 0);
ash::ShelfItem item = model_->items()[index];
- ash::WmShelf* shelf = ash::WmShelf::ForWindow(CurrentContext());
+ Shelf* shelf = ash::Shelf::ForWindow(CurrentContext());
std::unique_ptr<LauncherContextMenu> menu(
LauncherContextMenu::Create(controller_, &item, shelf));
return menu;
@@ -391,7 +391,7 @@ class ShelfAppBrowserTest : public ExtensionBrowserTest {
return menu->GetIndexOfCommandId(command_id) != -1;
}
- ash::WmShelf* shelf_;
+ Shelf* shelf_;
ash::ShelfModel* model_;
ChromeLauncherController* controller_;
@@ -653,14 +653,14 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) {
EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status);
// Activate first one.
- WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1));
+ Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1));
EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id1)->status);
EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id2)->status);
EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow()));
EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow()));
// Activate second one.
- WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2));
+ Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2));
EXPECT_EQ(ash::STATUS_RUNNING, shelf_model()->ItemByID(item_id1)->status);
EXPECT_EQ(ash::STATUS_ACTIVE, shelf_model()->ItemByID(item_id2)->status);
EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow()));
@@ -674,20 +674,20 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowActivation) {
EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow()));
// Activate launcher item for app1, this will activate the first app window.
- WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1));
+ Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1));
EXPECT_TRUE(ash::wm::IsActiveWindow(window1->GetNativeWindow()));
EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow()));
- WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1));
+ Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1));
EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow()));
// Activate the second app again
- WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2));
+ Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id2));
EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow()));
EXPECT_TRUE(ash::wm::IsActiveWindow(window2->GetNativeWindow()));
EXPECT_FALSE(ash::wm::IsActiveWindow(window1b->GetNativeWindow()));
// Activate the first app again
- WmShelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1));
+ Shelf::ActivateShelfItem(shelf_model()->ItemIndexByID(item_id1));
EXPECT_TRUE(ash::wm::IsActiveWindow(window1b->GetNativeWindow()));
EXPECT_FALSE(ash::wm::IsActiveWindow(window2->GetNativeWindow()));
EXPECT_FALSE(ash::wm::IsActiveWindow(window1->GetNativeWindow()));
@@ -913,7 +913,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchPinned) {
int tab_count = tab_strip->count();
ash::ShelfID shortcut_id = CreateShortcut("app1");
EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status);
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(++tab_count, tab_strip->count());
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
WebContents* tab = tab_strip->GetActiveWebContents();
@@ -971,7 +971,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchMaximized) {
ash::wm::GetWindowState(window2)->Maximize();
ash::ShelfID shortcut_id = CreateShortcut("app1");
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(++tab_count, tab_strip->count());
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
@@ -979,7 +979,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, LaunchMaximized) {
window1_state->Activate();
EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut_id)).status);
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
}
@@ -1018,13 +1018,13 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleApps) {
EXPECT_EQ(++item_count, model_->item_count());
// Launch first app.
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1));
EXPECT_EQ(++tab_count, tab_strip->count());
WebContents* tab1 = tab_strip->GetActiveWebContents();
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status);
// Launch second app.
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut2));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut2));
EXPECT_EQ(++tab_count, tab_strip->count());
WebContents* tab2 = tab_strip->GetActiveWebContents();
ASSERT_NE(tab1, tab2);
@@ -1032,7 +1032,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleApps) {
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status);
// Reactivate first app.
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1));
EXPECT_EQ(tab_count, tab_strip->count());
EXPECT_EQ(tab_strip->GetActiveWebContents(), tab1);
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status);
@@ -1047,14 +1047,14 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleApps) {
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut2)).status);
// Reactivate first app.
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut1));
EXPECT_EQ(tab_count, tab_strip->count());
EXPECT_EQ(tab_strip->GetActiveWebContents(), tab1);
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut1)).status);
EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut2)).status);
// And second again. This time the second tab should become active.
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut2));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut2));
EXPECT_EQ(tab_count, tab_strip->count());
EXPECT_EQ(tab_strip->GetActiveWebContents(), tab2);
EXPECT_EQ(ash::STATUS_RUNNING, (*model_->ItemByID(shortcut1)).status);
@@ -1066,7 +1066,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleApps) {
IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, Navigation) {
ash::ShelfID shortcut_id = CreateShortcut("app1");
EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status);
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
// Navigate away.
@@ -1095,7 +1095,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, TabDragAndDrop) {
EXPECT_EQ(ash::STATUS_CLOSED, (*model_->ItemByID(shortcut_id)).status);
// Activate app1 and check its item status.
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(2, tab_strip_model1->count());
EXPECT_EQ(ash::STATUS_RUNNING, model_->items()[browser_index].status);
EXPECT_EQ(ash::STATUS_ACTIVE, (*model_->ItemByID(shortcut_id)).status);
@@ -1126,7 +1126,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleOwnedTabs) {
TabStripModel* tab_strip = browser()->tab_strip_model();
int tab_count = tab_strip->count();
ash::ShelfID shortcut_id = CreateShortcut("app1");
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(++tab_count, tab_strip->count());
EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status);
WebContents* first_tab = tab_strip->GetActiveWebContents();
@@ -1149,7 +1149,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultipleOwnedTabs) {
EXPECT_EQ(ash::STATUS_RUNNING, model_->ItemByID(shortcut_id)->status);
// Activating app makes first tab active again.
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status);
EXPECT_EQ(tab_strip->GetActiveWebContents(), first_tab);
}
@@ -1158,7 +1158,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilter) {
TabStripModel* tab_strip = browser()->tab_strip_model();
int tab_count = tab_strip->count();
ash::ShelfID shortcut_id = CreateShortcut("app1");
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(++tab_count, tab_strip->count());
EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status);
WebContents* first_tab = tab_strip->GetActiveWebContents();
@@ -1184,7 +1184,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilter) {
// Activating app makes first tab active again, because second tab isn't
// in its refocus url path.
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status);
EXPECT_EQ(tab_strip->GetActiveWebContents(), first_tab);
}
@@ -1208,7 +1208,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, RefocusFilterLaunch) {
// Activating app should launch new tab, because second tab isn't
// in its refocus url path.
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(shortcut_id));
EXPECT_EQ(++tab_count, tab_strip->count());
WebContents* second_tab = tab_strip->GetActiveWebContents();
EXPECT_EQ(ash::STATUS_ACTIVE, model_->ItemByID(shortcut_id)->status);
@@ -1405,9 +1405,9 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, AltNumberTabsTabbing) {
// The active tab should still be the unnamed tab. Then we switch and reach
// the first app and stay there.
EXPECT_EQ(content1a, tab_strip->GetActiveWebContents());
- WmShelf::ActivateShelfItem(shortcut_index);
+ Shelf::ActivateShelfItem(shortcut_index);
EXPECT_EQ(content1, tab_strip->GetActiveWebContents());
- WmShelf::ActivateShelfItem(shortcut_index);
+ Shelf::ActivateShelfItem(shortcut_index);
EXPECT_EQ(content1, tab_strip->GetActiveWebContents());
ui_test_utils::NavigateToURLWithDisposition(
@@ -1416,9 +1416,9 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, AltNumberTabsTabbing) {
content::WebContents* content2 = tab_strip->GetActiveWebContents();
EXPECT_EQ(content2, browser()->tab_strip_model()->GetActiveWebContents());
- WmShelf::ActivateShelfItem(shortcut_index);
+ Shelf::ActivateShelfItem(shortcut_index);
EXPECT_EQ(content1, browser()->tab_strip_model()->GetActiveWebContents());
- WmShelf::ActivateShelfItem(shortcut_index);
+ Shelf::ActivateShelfItem(shortcut_index);
EXPECT_EQ(content2, browser()->tab_strip_model()->GetActiveWebContents());
}
@@ -1444,9 +1444,9 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AltNumberAppsTabbing) {
// By now the browser should be active. Issue Alt keystrokes several times to
// see that we stay on that application.
EXPECT_TRUE(window2->IsActive());
- WmShelf::ActivateShelfItem(app_index);
+ Shelf::ActivateShelfItem(app_index);
EXPECT_TRUE(window1->IsActive());
- WmShelf::ActivateShelfItem(app_index);
+ Shelf::ActivateShelfItem(app_index);
EXPECT_TRUE(window1->IsActive());
ui::BaseWindow* window1a =
@@ -1454,9 +1454,9 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AltNumberAppsTabbing) {
EXPECT_TRUE(window1a->IsActive());
EXPECT_FALSE(window1->IsActive());
- WmShelf::ActivateShelfItem(app_index);
+ Shelf::ActivateShelfItem(app_index);
EXPECT_TRUE(window1->IsActive());
- WmShelf::ActivateShelfItem(app_index);
+ Shelf::ActivateShelfItem(app_index);
EXPECT_TRUE(window1a->IsActive());
}
@@ -1669,10 +1669,10 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
// Get the number of items in the browser menu.
EXPECT_EQ(0u, chrome::GetTotalBrowserCount());
// The first activation should create a browser at index 1 (App List @ 0).
- WmShelf::ActivateShelfItem(1);
+ Shelf::ActivateShelfItem(1);
EXPECT_EQ(1u, chrome::GetTotalBrowserCount());
// A second activation should not create a new instance.
- WmShelf::ActivateShelfItem(1);
+ Shelf::ActivateShelfItem(1);
Browser* browser1 = chrome::FindBrowserWithWindow(ash::wm::GetActiveWindow());
EXPECT_TRUE(browser1);
aura::Window* window1 = browser1->window()->GetNativeWindow();
@@ -1684,9 +1684,9 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
EXPECT_EQ(window2, ash::wm::GetActiveWindow());
// Activate multiple times the switcher to see that the windows get activated.
- WmShelf::ActivateShelfItem(1);
+ Shelf::ActivateShelfItem(1);
EXPECT_EQ(window1, ash::wm::GetActiveWindow());
- WmShelf::ActivateShelfItem(1);
+ Shelf::ActivateShelfItem(1);
EXPECT_EQ(window2, ash::wm::GetActiveWindow());
// Create a third browser - make sure that we do not toggle simply between
@@ -1699,13 +1699,13 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
EXPECT_NE(window2, window3);
EXPECT_EQ(window3, ash::wm::GetActiveWindow());
- WmShelf::ActivateShelfItem(1);
+ Shelf::ActivateShelfItem(1);
EXPECT_EQ(window1, ash::wm::GetActiveWindow());
- WmShelf::ActivateShelfItem(1);
+ Shelf::ActivateShelfItem(1);
EXPECT_EQ(window2, ash::wm::GetActiveWindow());
- WmShelf::ActivateShelfItem(1);
+ Shelf::ActivateShelfItem(1);
EXPECT_EQ(window3, ash::wm::GetActiveWindow());
- WmShelf::ActivateShelfItem(1);
+ Shelf::ActivateShelfItem(1);
EXPECT_EQ(window1, ash::wm::GetActiveWindow());
// Create anther app and make sure that none of our browsers is active.
@@ -1715,7 +1715,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
EXPECT_NE(window2, ash::wm::GetActiveWindow());
// After activation our browser should be active again.
- WmShelf::ActivateShelfItem(1);
+ Shelf::ActivateShelfItem(1);
EXPECT_EQ(window1, ash::wm::GetActiveWindow());
}
@@ -1900,8 +1900,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MultiDisplayBasicDragAndDrop) {
// Get a number of interfaces we need.
DCHECK_EQ(ash::Shell::GetAllRootWindows().size(), 2U);
aura::Window* secondary_root_window = ash::Shell::GetAllRootWindows()[1];
- ash::WmShelf* secondary_shelf =
- ash::WmShelf::ForWindow(secondary_root_window);
+ ash::Shelf* secondary_shelf = ash::Shelf::ForWindow(secondary_root_window);
ui::test::EventGenerator generator(secondary_root_window, gfx::Point());
ash::test::ShelfViewTestAPI test(secondary_shelf->GetShelfViewForTesting());
@@ -2176,7 +2175,7 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, MatchingShelfIDandActiveTab) {
EXPECT_EQ(3, model_->item_count());
// Create and activate a new tab for "app1" and expect an application ShelfID.
- WmShelf::ActivateShelfItem(model_->ItemIndexByID(app_id));
+ Shelf::ActivateShelfItem(model_->ItemIndexByID(app_id));
EXPECT_EQ(2, browser()->tab_strip_model()->count());
EXPECT_EQ(1, browser()->tab_strip_model()->active_index());
id = ash::ShelfID::Deserialize(window->GetProperty(ash::kShelfIDKey));

Powered by Google App Engine
This is Rietveld 408576698