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

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

Issue 25716004: Revert 226547 "Refactor LauncherItemController and LauncherItemD..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 2 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: trunk/src/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc
===================================================================
--- trunk/src/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc (revision 226578)
+++ trunk/src/chrome/browser/ui/ash/launcher/chrome_launcher_controller_browsertest.cc (working copy)
@@ -34,7 +34,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/app_list/app_list_service.h"
#include "chrome/browser/ui/ash/launcher/browser_shortcut_launcher_item_controller.h"
-#include "chrome/browser/ui/ash/launcher/launcher_application_menu_item_model.h"
#include "chrome/browser/ui/ash/launcher/launcher_item_controller.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
@@ -152,8 +151,7 @@
int GetNumApplicationMenuItems(const ash::LauncherItem& item) {
const int event_flags = 0;
scoped_ptr<ash::LauncherMenuModel> menu(
- new LauncherApplicationMenuItemModel(
- controller_->GetApplicationList(item, event_flags)));
+ controller_->CreateApplicationMenu(item, event_flags));
int num_items = 0;
for (int i = 0; i < menu->GetItemCount(); ++i) {
if (menu->GetTypeAt(i) != ui::MenuModel::TYPE_SEPARATOR)
@@ -660,7 +658,7 @@
EXPECT_EQ(LauncherItemController::TYPE_APP, item1_controller->type());
// Clicking the item should have no effect.
TestEvent click_event(ui::ET_MOUSE_PRESSED);
- item1_controller->ItemSelected(click_event);
+ item1_controller->Clicked(click_event);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
// Minimize the window and confirm that the controller item is updated.
@@ -669,14 +667,14 @@
EXPECT_FALSE(window1->GetBaseWindow()->IsActive());
EXPECT_EQ(ash::STATUS_RUNNING, item1.status);
// Clicking the item should activate the window.
- item1_controller->ItemSelected(click_event);
+ item1_controller->Clicked(click_event);
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->Clicked(click_event);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized());
@@ -699,20 +697,20 @@
EXPECT_EQ(LauncherItemController::TYPE_APP, item1_controller->type());
// Since it is already active, clicking it should minimize.
TestEvent click_event(ui::ET_MOUSE_PRESSED);
- item1_controller->ItemSelected(click_event);
+ item1_controller->Clicked(click_event);
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->Clicked(click_event);
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->Clicked(click_event);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
EXPECT_TRUE(window1->GetBaseWindow()->IsMaximized());
@@ -727,13 +725,13 @@
EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1a->GetBaseWindow()->IsActive());
// The first click does nothing.
- item1_controller->ItemSelected(click_event);
+ item1_controller->Clicked(click_event);
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->Clicked(click_event);
EXPECT_TRUE(window1->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1a->GetNativeWindow()->IsVisible());
EXPECT_TRUE(window1->GetBaseWindow()->IsActive());
@@ -762,15 +760,15 @@
EXPECT_EQ(LauncherItemController::TYPE_APP_PANEL, item1_controller->type());
// Click the item and confirm that the panel is activated.
TestEvent click_event(ui::ET_MOUSE_PRESSED);
- item1_controller->ItemSelected(click_event);
+ item1_controller->Clicked(click_event);
EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
// Click the item again and confirm that the panel is minimized.
- item1_controller->ItemSelected(click_event);
+ item1_controller->Clicked(click_event);
EXPECT_TRUE(panel->GetBaseWindow()->IsMinimized());
EXPECT_EQ(ash::STATUS_RUNNING, item1.status);
// Click the item again and confirm that the panel is activated.
- item1_controller->ItemSelected(click_event);
+ item1_controller->Clicked(click_event);
EXPECT_TRUE(panel->GetNativeWindow()->IsVisible());
EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
EXPECT_EQ(ash::STATUS_ACTIVE, item1.status);
@@ -1422,7 +1420,7 @@
// Click the item and confirm that the panel is activated.
TestEvent click_event(ui::ET_MOUSE_PRESSED);
- item_controller->ItemSelected(click_event);
+ item_controller->Clicked(click_event);
EXPECT_TRUE(panel->GetBaseWindow()->IsActive());
EXPECT_EQ(ash::STATUS_ACTIVE, item.status);
@@ -1528,9 +1526,8 @@
EXPECT_EQ(it, ash_browser_list->end_last_active());
// 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,
+ controller_->ItemSelected(*model_->ItemByID(shortcut_id),
+ ui::KeyEvent(ui::ET_KEY_RELEASED,
ui::VKEY_RETURN,
0,
false));

Powered by Google App Engine
This is Rietveld 408576698