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

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

Issue 2696073002: Merge ShelfItemDelegate::ItemSelected & LauncherItemDelegate::Activate. (Closed)
Patch Set: Cleanup Created 3 years, 10 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_impl_browsertest.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc
index 074f7def655055d7f803ad40971517131625bfea..51c6bb78b41a6c1e73a515f9b369f171f923d7ff 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_impl_browsertest.cc
@@ -703,21 +703,24 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest,
EXPECT_EQ(ash::TYPE_APP, item1.type);
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Since it is already active, clicking it should minimize.
- TestEvent click_event(ui::ET_MOUSE_PRESSED);
- item1_controller->ItemSelected(click_event);
+ int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
+ item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
EXPECT_FALSE(window1->GetNativeWindow()->IsVisible());
EXPECT_FALSE(window1->GetBaseWindow()->IsActive());
EXPECT_TRUE(window1->GetBaseWindow()->IsMinimized());
EXPECT_EQ(ash::STATUS_RUNNING, item1.status);
// Clicking the item again should activate the window again.
- item1_controller->ItemSelected(click_event);
+ item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Maximizing a window should preserve state after minimize + click.
window1->GetBaseWindow()->Maximize();
window1->GetBaseWindow()->Minimize();
- item1_controller->ItemSelected(click_event);
+ item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized());
@@ -732,13 +735,15 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest,
EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1a->GetBaseWindow()->IsActive());
// The first click does nothing.
- item1_controller->ItemSelected(click_event);
+ item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
EXPECT_FALSE(window1a->GetBaseWindow()->IsActive());
// The second neither.
- item1_controller->ItemSelected(click_event);
+ item1_controller->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
@@ -770,16 +775,19 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanel) {
EXPECT_EQ(ash::TYPE_APP_PANEL,
panel->GetNativeWindow()->GetProperty(ash::kShelfItemTypeKey));
// Click the item and confirm that the panel is activated.
- TestEvent click_event(ui::ET_MOUSE_PRESSED);
- item1_delegate->ItemSelected(click_event);
+ int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
+ item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Click the item again and confirm that the panel is minimized.
- item1_delegate->ItemSelected(click_event);
+ item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized());
EXPECT_EQ(ash::STATUS_RUNNING, item1.status);
// Click the item again and confirm that the panel is activated.
- item1_delegate->ItemSelected(click_event);
+ item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
EXPECT_TRUE(panel->GetNativeWindow()->IsVisible());
EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
EXPECT_FALSE(panel->GetBaseWindow()->IsMinimized());
@@ -811,16 +819,19 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, AppPanelClickBehavior) {
EXPECT_EQ(ash::TYPE_APP_PANEL,
panel->GetNativeWindow()->GetProperty(ash::kShelfItemTypeKey));
// Click the item and confirm that the panel is activated.
- TestEvent click_event(ui::ET_MOUSE_PRESSED);
- item1_delegate->ItemSelected(click_event);
+ int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
+ item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Click the item again and confirm that the panel is minimized.
- item1_delegate->ItemSelected(click_event);
+ item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized());
EXPECT_EQ(ash::STATUS_RUNNING, item1.status);
// Click the item again and confirm that the panel is activated.
- item1_delegate->ItemSelected(click_event);
+ item1_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
EXPECT_TRUE(panel->GetNativeWindow()->IsVisible());
EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
@@ -1525,9 +1536,11 @@ IN_PROC_BROWSER_TEST_F(LauncherPlatformAppBrowserTest, WindowAttentionStatus) {
EXPECT_EQ(ash::STATUS_ATTENTION, item.status);
// Click the item and confirm that the panel is activated.
- TestEvent click_event(ui::ET_MOUSE_PRESSED);
- EXPECT_EQ(ash::ShelfItemDelegate::kExistingWindowActivated,
- shelf_item_delegate->ItemSelected(click_event));
+ int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
+ EXPECT_EQ(
+ ash::kExistingWindowActivated,
+ shelf_item_delegate->ItemSelected(ui::ET_MOUSE_PRESSED, ui::EF_NONE,
+ display_id, ash::LAUNCH_FROM_UNKNOWN));
EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
EXPECT_EQ(ash::STATUS_ACTIVE, item.status);
@@ -1742,9 +1755,9 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTest, ActivateAfterSessionRestore) {
// Now request to either activate an existing app or create a new one.
LauncherItemController* item_controller =
controller_->GetLauncherItemController(shortcut_id);
- item_controller->ItemSelected(ui::KeyEvent(ui::ET_KEY_RELEASED,
- ui::VKEY_RETURN,
- ui::EF_NONE));
+ int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
+ item_controller->ItemSelected(ui::ET_KEY_RELEASED, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
// Check that we have set focus on the existing application and nothing new
// was created.
@@ -2128,7 +2141,9 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
EXPECT_FALSE(controller_->IsOpen(id));
// Activate. This creates new browser
- item_controller->Activate(ash::LAUNCH_FROM_UNKNOWN);
+ int64_t display_id = display::Screen::GetScreen()->GetPrimaryDisplay().id();
+ item_controller->ItemSelected(ui::ET_UNKNOWN, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
// New Window is created.
running_browser = chrome::GetTotalBrowserCount();
EXPECT_EQ(1u, running_browser);
@@ -2139,9 +2154,9 @@ IN_PROC_BROWSER_TEST_F(ShelfAppBrowserTestNoDefaultBrowser,
window_state->Minimize();
EXPECT_TRUE(window_state->IsMinimized());
- // Activate again. This doesn't create new browser.
- // It activates window.
- item_controller->Activate(ash::LAUNCH_FROM_UNKNOWN);
+ // Activate again. This doesn't create new browser, it activates the window.
+ item_controller->ItemSelected(ui::ET_UNKNOWN, ui::EF_NONE, display_id,
+ ash::LAUNCH_FROM_UNKNOWN);
running_browser = chrome::GetTotalBrowserCount();
EXPECT_EQ(1u, running_browser);
EXPECT_TRUE(controller_->IsOpen(id));

Powered by Google App Engine
This is Rietveld 408576698