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

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

Issue 17673004: Insert panel icons on the left of other panel icons. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Add condition to per browser launcher controller as well. Created 7 years, 6 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_per_app_unittest.cc
diff --git a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc
index 71637779fa9fde56de7b6d558aec40559cdb8465..c5516c8e90671649afebb3bcd640b9a73f8e3d8f 100644
--- a/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc
+++ b/chrome/browser/ui/ash/launcher/chrome_launcher_controller_per_app_unittest.cc
@@ -64,18 +64,22 @@ class TestLauncherModelObserver : public ash::LauncherModelObserver {
// LauncherModelObserver
virtual void LauncherItemAdded(int index) OVERRIDE {
++added_;
+ last_index_ = index;
}
virtual void LauncherItemRemoved(int index, ash::LauncherID id) OVERRIDE {
++removed_;
+ last_index_ = index;
}
virtual void LauncherItemChanged(int index,
const ash::LauncherItem& old_item) OVERRIDE {
++changed_;
+ last_index_ = index;
}
virtual void LauncherItemMoved(int start_index, int target_index) OVERRIDE {
+ last_index_ = target_index;
}
virtual void LauncherStatusChanged() OVERRIDE {
@@ -85,16 +89,19 @@ class TestLauncherModelObserver : public ash::LauncherModelObserver {
added_ = 0;
removed_ = 0;
changed_ = 0;
+ last_index_ = 0;
}
int added() const { return added_; }
int removed() const { return removed_; }
int changed() const { return changed_; }
+ int last_index() const { return last_index_; }
private:
int added_;
int removed_;
int changed_;
+ int last_index_;
DISALLOW_COPY_AND_ASSIGN(TestLauncherModelObserver);
};
@@ -1061,6 +1068,7 @@ TEST_F(ChromeLauncherControllerPerAppTest, AppPanels) {
launcher_controller_.get());
ash::LauncherID launcher_id1 = launcher_controller_->CreateAppLauncherItem(
&app_panel_controller, app_id, ash::STATUS_RUNNING);
+ int panel_index = model_observer_->last_index();
EXPECT_EQ(2, model_observer_->added());
EXPECT_EQ(0, model_observer_->changed());
EXPECT_EQ(1, app_icon_loader->fetch_count());
@@ -1074,9 +1082,19 @@ TEST_F(ChromeLauncherControllerPerAppTest, AppPanels) {
gfx::ImageSkia image;
launcher_controller_->SetAppImage(app_id, image);
EXPECT_EQ(0, model_observer_->changed());
+ model_observer_->clear_counts();
+
+ // Add a second app panel and verify that it get the same index as the first
+ // one had, being added to the left of the existing panel.
+ ash::LauncherID launcher_id2 = launcher_controller_->CreateAppLauncherItem(
+ &app_panel_controller, app_id, ash::STATUS_RUNNING);
+ EXPECT_EQ(panel_index, model_observer_->last_index());
+ EXPECT_EQ(1, model_observer_->added());
+ model_observer_->clear_counts();
+ launcher_controller_->CloseLauncherItem(launcher_id2);
launcher_controller_->CloseLauncherItem(launcher_id1);
- EXPECT_EQ(1, model_observer_->removed());
+ EXPECT_EQ(2, model_observer_->removed());
}
// Tests that the Gmail extension matches more then the app itself claims with

Powered by Google App Engine
This is Rietveld 408576698