summaryrefslogtreecommitdiffstats
path: root/ash/launcher
diff options
context:
space:
mode:
authordavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-11 19:18:22 +0000
committerdavemoore@chromium.org <davemoore@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-11 19:18:22 +0000
commit68e09ad4713d27fd568f6c63755f015f5522a6f9 (patch)
treec6a49fa842f2ccf85ee396339372bb6146e21644 /ash/launcher
parent25ee94f33700d5adbf5fcea30497cb21acaa5ac9 (diff)
downloadchromium_src-68e09ad4713d27fd568f6c63755f015f5522a6f9.zip
chromium_src-68e09ad4713d27fd568f6c63755f015f5522a6f9.tar.gz
chromium_src-68e09ad4713d27fd568f6c63755f015f5522a6f9.tar.bz2
Move app list
BUG=141378 TEST=app list icon should always be leftmost Review URL: https://chromiumcodereview.appspot.com/10905201 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@156092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/launcher')
-rw-r--r--ash/launcher/launcher_model.cc12
-rw-r--r--ash/launcher/launcher_model_unittest.cc36
-rw-r--r--ash/launcher/launcher_navigator_unittest.cc25
-rw-r--r--ash/launcher/launcher_view.cc29
-rw-r--r--ash/launcher/launcher_view_unittest.cc98
5 files changed, 115 insertions, 85 deletions
diff --git a/ash/launcher/launcher_model.cc b/ash/launcher/launcher_model.cc
index 7f6e113..fd78301 100644
--- a/ash/launcher/launcher_model.cc
+++ b/ash/launcher/launcher_model.cc
@@ -14,15 +14,15 @@ namespace {
int LauncherItemTypeToWeight(LauncherItemType type) {
switch (type) {
- case TYPE_BROWSER_SHORTCUT:
+ case TYPE_APP_LIST:
return 0;
- case TYPE_APP_SHORTCUT:
+ case TYPE_BROWSER_SHORTCUT:
return 1;
+ case TYPE_APP_SHORTCUT:
+ return 2;
case TYPE_TABBED:
case TYPE_APP_PANEL:
case TYPE_PLATFORM_APP:
- return 2;
- case TYPE_APP_LIST:
return 3;
}
@@ -45,8 +45,8 @@ LauncherModel::LauncherModel() : next_id_(1), status_(STATUS_NORMAL) {
browser_shortcut.type = TYPE_BROWSER_SHORTCUT;
browser_shortcut.is_incognito = false;
- AddAt(0, browser_shortcut);
- AddAt(1, app_list);
+ AddAt(0, app_list);
+ AddAt(1, browser_shortcut);
}
LauncherModel::~LauncherModel() {
diff --git a/ash/launcher/launcher_model_unittest.cc b/ash/launcher/launcher_model_unittest.cc
index 9a4fbcd..cc286c6 100644
--- a/ash/launcher/launcher_model_unittest.cc
+++ b/ash/launcher/launcher_model_unittest.cc
@@ -140,65 +140,69 @@ TEST(LauncherModel, AddIndices) {
// Two initial items should have different ids.
EXPECT_NE(model.items()[0].id, model.items()[1].id);
+ // Items come after the browser.
+ int browser = 1;
+ ASSERT_EQ(ash::TYPE_BROWSER_SHORTCUT, model.items()[browser].type);
+
// Tabbed items should be after shortcut.
LauncherItem item;
int tabbed_index1 = model.Add(item);
- EXPECT_EQ(1, tabbed_index1);
+ EXPECT_EQ(browser + 1, tabbed_index1);
// Add another tabbed item, it should follow first.
int tabbed_index2 = model.Add(item);
- EXPECT_EQ(2, tabbed_index2);
+ EXPECT_EQ(browser + 2, tabbed_index2);
// APP_SHORTCUT preceed browsers.
item.type = TYPE_APP_SHORTCUT;
int app_shortcut_index1 = model.Add(item);
- EXPECT_EQ(1, app_shortcut_index1);
+ EXPECT_EQ(browser + 1, app_shortcut_index1);
item.type = TYPE_APP_SHORTCUT;
int app_shortcut_index2 = model.Add(item);
- EXPECT_EQ(2, app_shortcut_index2);
+ EXPECT_EQ(browser + 2, app_shortcut_index2);
// Check that AddAt() figures out the correct indexes for app shortcuts.
item.type = TYPE_APP_SHORTCUT;
int app_shortcut_index3 = model.AddAt(0, item);
- EXPECT_EQ(1, app_shortcut_index3);
+ EXPECT_EQ(browser + 1, app_shortcut_index3);
item.type = TYPE_APP_SHORTCUT;
int app_shortcut_index4 = model.AddAt(5, item);
- EXPECT_EQ(4, app_shortcut_index4);
+ EXPECT_EQ(browser + 4, app_shortcut_index4);
item.type = TYPE_APP_SHORTCUT;
int app_shortcut_index5 = model.AddAt(2, item);
- EXPECT_EQ(2, app_shortcut_index5);
+ EXPECT_EQ(browser + 1, app_shortcut_index5);
// Check that AddAt() figures out the correct indexes for tabs and panels.
item.type = TYPE_TABBED;
int tabbed_index3 = model.AddAt(2, item);
- EXPECT_EQ(6, tabbed_index3);
+ EXPECT_EQ(browser + 6, tabbed_index3);
item.type = TYPE_APP_PANEL;
int app_panel_index1 = model.AddAt(2, item);
- EXPECT_EQ(6, app_panel_index1);
+ EXPECT_EQ(browser + 6, app_panel_index1);
item.type = TYPE_TABBED;
int tabbed_index4 = model.AddAt(11, item);
- EXPECT_EQ(10, tabbed_index4);
+ EXPECT_EQ(browser + 10, tabbed_index4);
item.type = TYPE_APP_PANEL;
int app_panel_index2 = model.AddAt(12, item);
- EXPECT_EQ(11, app_panel_index2);
+ EXPECT_EQ(browser + 11, app_panel_index2);
item.type = TYPE_TABBED;
int tabbed_index5 = model.AddAt(7, item);
- EXPECT_EQ(7, tabbed_index5);
+ EXPECT_EQ(browser + 6, tabbed_index5);
item.type = TYPE_APP_PANEL;
int app_panel_index3 = model.AddAt(8, item);
- EXPECT_EQ(8, app_panel_index3);
+ EXPECT_EQ(browser + 7, app_panel_index3);
- // Browser shortcut and app list should still be first and last, respectively.
- EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model.items()[0].type);
- EXPECT_EQ(TYPE_APP_LIST, model.items()[model.item_count() - 1].type);
+ // Browser shortcut and app list should still be first and second.
+ EXPECT_EQ(TYPE_BROWSER_SHORTCUT, model.items()[1].type);
+ EXPECT_EQ(TYPE_APP_LIST, model.items()[0].type);
}
} // namespace ash
diff --git a/ash/launcher/launcher_navigator_unittest.cc b/ash/launcher/launcher_navigator_unittest.cc
index 3bef6ee..cc86d28 100644
--- a/ash/launcher/launcher_navigator_unittest.cc
+++ b/ash/launcher/launcher_navigator_unittest.cc
@@ -59,27 +59,26 @@ TEST_F(LauncherNavigatorTest, BasicCycle) {
LauncherItemType types[] = {
TYPE_APP_SHORTCUT, TYPE_TABBED, TYPE_TABBED, TYPE_TABBED,
};
- // LauncherModel automatically adds BROWSER_SHORTCUT item at the
- // beginning, so '2' refers the first TYPE_TABBED item.
- SetupMockLauncherModel(types, arraysize(types), 2);
+ // LauncherModel automatically adds BROWSER_SHORTCUT and APP_LIST items at the
+ // beginning, so '3' refers the first TYPE_TABBED item.
+ SetupMockLauncherModel(types, arraysize(types), 3);
- EXPECT_EQ(3, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
+ EXPECT_EQ(4, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
// Fourth one. It will skip the APP_SHORTCUT at the beginning of the list and
// the APP_LIST item which is automatically added at the end of items.
- EXPECT_EQ(4, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD));
+ EXPECT_EQ(5, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD));
}
TEST_F(LauncherNavigatorTest, WrapToBeginning) {
LauncherItemType types[] = {
TYPE_APP_SHORTCUT, TYPE_TABBED, TYPE_TABBED, TYPE_TABBED,
};
- SetupMockLauncherModel(types, arraysize(types), 4);
+ SetupMockLauncherModel(types, arraysize(types), 5);
- // Second one. It skips the APP_LIST item at the end of the list,
- // wraps to the beginning, and skips BROWSER_SHORTCUT and APP_SHORTCUT
- // at the beginning of the list.
- EXPECT_EQ(2, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
+ // Second one. It starts at the end, wraps to the beginning, and skips
+ // APP_LIST, BROWSER_SHORTCUT and APP_SHORTCUT at the beginning of the list.
+ EXPECT_EQ(3, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
}
TEST_F(LauncherNavigatorTest, Empty) {
@@ -90,7 +89,7 @@ TEST_F(LauncherNavigatorTest, Empty) {
TEST_F(LauncherNavigatorTest, SingleEntry) {
LauncherItemType type = TYPE_TABBED;
- SetupMockLauncherModel(&type, 1, 1);
+ SetupMockLauncherModel(&type, 1, 2);
// If there's only one item there and it is already active, there's no item
// to be activated next.
@@ -106,8 +105,8 @@ TEST_F(LauncherNavigatorTest, NoActive) {
SetupMockLauncherModel(types, arraysize(types), -1);
// If there are no active status, pick the first running item as a fallback.
- EXPECT_EQ(1, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
- EXPECT_EQ(1, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD));
+ EXPECT_EQ(2, GetNextActivatedItemIndex(model(), CYCLE_FORWARD));
+ EXPECT_EQ(2, GetNextActivatedItemIndex(model(), CYCLE_BACKWARD));
}
} // namespace ash
diff --git a/ash/launcher/launcher_view.cc b/ash/launcher/launcher_view.cc
index 7777978..8918838 100644
--- a/ash/launcher/launcher_view.cc
+++ b/ash/launcher/launcher_view.cc
@@ -394,9 +394,9 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
y = primary_axis_coordinate(0, y + h + kButtonSpacing);
}
- int app_list_index = view_model_->view_size() - 1;
+ int last_view_index = view_model_->view_size() - 1;
if (is_overflow_mode()) {
- last_visible_index_ = app_list_index - 1;
+ last_visible_index_ = last_view_index;
for (int i = 0; i < view_model_->view_size(); ++i) {
view_model_->view_at(i)->SetVisible(
i >= first_visible_index_ && i <= last_visible_index_);
@@ -419,11 +419,10 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
last_visible_index_ = DetermineLastVisibleIndex(
available_size - leading_inset() - kLauncherPreferredSize -
kButtonSpacing - kLauncherPreferredSize);
- bool show_overflow = (last_visible_index_ + 1 < app_list_index);
+ bool show_overflow = (last_visible_index_ < last_view_index);
for (int i = 0; i < view_model_->view_size(); ++i) {
- view_model_->view_at(i)->SetVisible(
- i == app_list_index || i <= last_visible_index_);
+ view_model_->view_at(i)->SetVisible(i <= last_visible_index_);
}
overflow_button_->SetVisible(show_overflow);
@@ -438,14 +437,8 @@ void LauncherView::CalculateIdealBounds(IdealBounds* bounds) {
y = primary_axis_coordinate(0,
view_model_->ideal_bounds(last_visible_index_).bottom());
}
- gfx::Rect app_list_bounds = view_model_->ideal_bounds(app_list_index);
bounds->overflow_bounds.set_x(x);
bounds->overflow_bounds.set_y(y);
- x = primary_axis_coordinate(x + kLauncherPreferredSize + kButtonSpacing, 0);
- y = primary_axis_coordinate(0, y + kLauncherPreferredSize + kButtonSpacing);
- app_list_bounds.set_x(x);
- app_list_bounds.set_y(y);
- view_model_->set_ideal_bounds(app_list_index, app_list_bounds);
} else {
if (overflow_bubble_.get())
overflow_bubble_->Hide();
@@ -724,9 +717,14 @@ int LauncherView::CancelDrag(int modified_index) {
return modified_index;
// Restore previous position, tracking the position of the modified view.
+ model_->Move(drag_view_index, start_drag_index_);
+
+ // Adding a new view at end.
+ if (modified_index == view_model_->view_size())
+ return modified_index;
+
views::View* removed_view =
(modified_index >= 0) ? view_model_->view_at(modified_index) : NULL;
- model_->Move(drag_view_index, start_drag_index_);
return removed_view ? view_model_->GetIndexOfView(removed_view) : -1;
}
@@ -734,12 +732,9 @@ gfx::Size LauncherView::GetPreferredSize() {
IdealBounds ideal_bounds;
CalculateIdealBounds(&ideal_bounds);
- const int app_list_index = view_model_->view_size() - 1;
- const int last_button_index = is_overflow_mode() ?
- last_visible_index_ : app_list_index;
const gfx::Rect last_button_bounds =
- last_button_index >= first_visible_index_ ?
- view_model_->view_at(last_button_index)->bounds() :
+ last_visible_index_ >= first_visible_index_ ?
+ view_model_->view_at(last_visible_index_)->bounds() :
gfx::Rect(gfx::Size(kLauncherPreferredSize,
kLauncherPreferredSize));
diff --git a/ash/launcher/launcher_view_unittest.cc b/ash/launcher/launcher_view_unittest.cc
index 74f72a9..0a260f5 100644
--- a/ash/launcher/launcher_view_unittest.cc
+++ b/ash/launcher/launcher_view_unittest.cc
@@ -28,6 +28,10 @@
#include "ui/views/widget/widget.h"
#include "ui/views/widget/widget_delegate.h"
+namespace {
+const int kExpectedAppIndex = 2;
+}
+
namespace ash {
namespace test {
@@ -253,28 +257,38 @@ class LauncherViewTest : public AshTestBase {
void CheckModelIDs(
const std::vector<std::pair<LauncherID, views::View*> >& id_map) {
- ASSERT_EQ(static_cast<int>(id_map.size()), test_api_->GetButtonCount());
- ASSERT_EQ(id_map.size(), model_->items().size());
- for (size_t i = 0; i < id_map.size(); ++i) {
- EXPECT_EQ(id_map[i].first, model_->items()[i].id);
- EXPECT_EQ(id_map[i].second, test_api_->GetButton(i));
+ size_t map_index = 0;
+ for (size_t model_index = 0;
+ model_index < model_->items().size();
+ ++model_index) {
+ ash::LauncherItem item = model_->items()[model_index];
+// if (item.type == ash::TYPE_APP_LIST)
+// continue;
+ ash::LauncherID id = item.id;
+ EXPECT_EQ(id_map[map_index].first, id);
+ EXPECT_EQ(id_map[map_index].second, GetButtonByID(id));
+ ++map_index;
}
+ ASSERT_EQ(map_index, id_map.size());
}
views::View* SimulateDrag(internal::LauncherButtonHost::Pointer pointer,
int button_index,
int destination_index) {
+ // Add kExpectedAppIndex to each button index to allow default icons.
internal::LauncherButtonHost* button_host = launcher_view_.get();
// Mouse down.
- views::View* button = test_api_->GetButton(button_index);
+ views::View* button =
+ test_api_->GetButton(kExpectedAppIndex + button_index);
ui::MouseEvent click_event(ui::ET_MOUSE_PRESSED,
button->bounds().origin(),
button->bounds().origin(), 0);
button_host->PointerPressedOnButton(button, pointer, click_event);
// Drag.
- views::View* destination = test_api_->GetButton(destination_index);
+ views::View* destination =
+ test_api_->GetButton(kExpectedAppIndex + destination_index);
ui::MouseEvent drag_event(ui::ET_MOUSE_DRAGGED,
destination->bounds().origin(),
destination->bounds().origin(), 0);
@@ -286,16 +300,18 @@ class LauncherViewTest : public AshTestBase {
std::vector<std::pair<LauncherID, views::View*> >* id_map) {
// Initialize |id_map| with the automatically-created launcher buttons.
for (size_t i = 0; i < model_->items().size(); ++i) {
- id_map->push_back(std::make_pair(model_->items()[i].id,
- test_api_->GetButton(i)));
+ internal::LauncherButton* button = test_api_->GetButton(i);
+// if (!button)
+// continue;
+
+ id_map->push_back(std::make_pair(model_->items()[i].id, button));
}
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(*id_map));
// Add 5 app launcher buttons for testing.
- for (int i = 1; i <= 5; ++i) {
+ for (int i = 0; i < 5; ++i) {
LauncherID id = AddAppShortcut();
- id_map->insert(id_map->begin() + i,
- std::make_pair(id, test_api_->GetButton(i)));
+ id_map->push_back(std::make_pair(id, GetButtonByID(id)));
}
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(*id_map));
}
@@ -426,7 +442,7 @@ TEST_F(LauncherViewTest, AddButtonQuickly) {
test_api_->RunMessageLoopUntilAnimationsDone();
// Verifies non-overflow buttons are visible.
- for (int i = 0; i <= test_api_->GetLastVisibleIndex(); ++i) {
+ for (int i = 1; i <= test_api_->GetLastVisibleIndex(); ++i) {
internal::LauncherButton* button = test_api_->GetButton(i);
EXPECT_TRUE(button->visible()) << "button index=" << i;
EXPECT_EQ(1.0f, button->layer()->opacity()) << "button index=" << i;
@@ -443,31 +459,34 @@ TEST_F(LauncherViewTest, ModelChangesWhileDragging) {
// Dragging changes model order.
views::View* dragged_button = SimulateDrag(
- internal::LauncherButtonHost::MOUSE, 1, 3);
- std::rotate(id_map.begin() + 1, id_map.begin() + 2, id_map.begin() + 4);
+ internal::LauncherButtonHost::MOUSE, 0, 2);
+ std::rotate(id_map.begin() + kExpectedAppIndex,
+ id_map.begin() + kExpectedAppIndex + 1,
+ id_map.begin() + kExpectedAppIndex + 3);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
// Cancelling the drag operation restores previous order.
button_host->PointerReleasedOnButton(dragged_button,
internal::LauncherButtonHost::MOUSE,
true);
- std::rotate(id_map.begin() + 1, id_map.begin() + 3, id_map.begin() + 4);
+ std::rotate(id_map.begin() + kExpectedAppIndex,
+ id_map.begin() + kExpectedAppIndex + 2,
+ id_map.begin() + kExpectedAppIndex + 3);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
// Deleting an item keeps the remaining intact.
- dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 1, 3);
- model_->RemoveItemAt(3);
- id_map.erase(id_map.begin() + 3);
+ dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 0, 2);
+ model_->RemoveItemAt(kExpectedAppIndex + 1);
+ id_map.erase(id_map.begin() + kExpectedAppIndex + 1);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
button_host->PointerReleasedOnButton(dragged_button,
internal::LauncherButtonHost::MOUSE,
false);
// Adding a launcher item cancels the drag and respects the order.
- dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 1, 3);
+ dragged_button = SimulateDrag(internal::LauncherButtonHost::MOUSE, 0, 2);
LauncherID new_id = AddAppShortcut();
- id_map.insert(id_map.begin() + 5,
- std::make_pair(new_id, test_api_->GetButton(5)));
+ id_map.push_back(std::make_pair(new_id, GetButtonByID(new_id)));
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
button_host->PointerReleasedOnButton(dragged_button,
internal::LauncherButtonHost::MOUSE,
@@ -483,13 +502,14 @@ TEST_F(LauncherViewTest, SimultaneousDrag) {
// Start a mouse drag.
views::View* dragged_button_mouse = SimulateDrag(
- internal::LauncherButtonHost::MOUSE, 1, 3);
- std::rotate(id_map.begin() + 1, id_map.begin() + 2, id_map.begin() + 4);
+ internal::LauncherButtonHost::MOUSE, 0, 2);
+ std::rotate(id_map.begin() + kExpectedAppIndex,
+ id_map.begin() + kExpectedAppIndex + 1,
+ id_map.begin() + kExpectedAppIndex + 3);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
-
// Attempt a touch drag before the mouse drag finishes.
views::View* dragged_button_touch = SimulateDrag(
- internal::LauncherButtonHost::TOUCH, 4, 2);
+ internal::LauncherButtonHost::TOUCH, 3, 1);
// Nothing changes since 2nd drag is ignored.
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
@@ -502,13 +522,15 @@ TEST_F(LauncherViewTest, SimultaneousDrag) {
// Now start a touch drag.
dragged_button_touch = SimulateDrag(
- internal::LauncherButtonHost::TOUCH, 4, 2);
- std::rotate(id_map.begin() + 3, id_map.begin() + 4, id_map.begin() + 5);
+ internal::LauncherButtonHost::TOUCH, 3, 1);
+ std::rotate(id_map.begin() + kExpectedAppIndex + 2,
+ id_map.begin() + kExpectedAppIndex + 3,
+ id_map.begin() + kExpectedAppIndex + 4);
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
// And attempt a mouse drag before the touch drag finishes.
dragged_button_mouse = SimulateDrag(
- internal::LauncherButtonHost::MOUSE, 1, 3);
+ internal::LauncherButtonHost::MOUSE, 0, 1);
// Nothing changes since 2nd drag is ignored.
ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
@@ -609,8 +631,11 @@ TEST_F(LauncherViewTest, ShouldHideTooltipTest) {
LauncherID tab_button_id = AddTabbedBrowser();
// The tooltip shouldn't hide if the mouse is on normal buttons.
- for (int i = 0; i < test_api_->GetButtonCount() - 1; i++) {
+ for (int i = 0; i < test_api_->GetButtonCount(); i++) {
internal::LauncherButton* button = test_api_->GetButton(i);
+ if (!button)
+ continue;
+
EXPECT_FALSE(launcher_view_->ShouldHideTooltip(
button->GetMirroredBounds().CenterPoint()))
<< "LauncherView tries to hide on button " << i;
@@ -630,8 +655,12 @@ TEST_F(LauncherViewTest, ShouldHideTooltipTest) {
// The tooltip should hide if it's outside of all buttons.
gfx::Rect all_area;
- for (int i = 0; i < test_api_->GetButtonCount() - 1; i++) {
- all_area = all_area.Union(test_api_->GetButton(i)->GetMirroredBounds());
+ for (int i = 0; i < test_api_->GetButtonCount(); i++) {
+ internal::LauncherButton* button = test_api_->GetButton(i);
+ if (!button)
+ continue;
+
+ all_area = all_area.Union(button->GetMirroredBounds());
}
all_area = all_area.Union(
launcher_view_->GetAppListButtonView()->GetMirroredBounds());
@@ -653,8 +682,11 @@ TEST_F(LauncherViewTest, ShouldHideTooltipWithAppListWindowTest) {
ASSERT_TRUE(Shell::GetInstance()->GetAppListWindow());
// The tooltip shouldn't hide if the mouse is on normal buttons.
- for (int i = 0; i < test_api_->GetButtonCount() - 1; i++) {
+ for (int i = 1; i < test_api_->GetButtonCount(); i++) {
internal::LauncherButton* button = test_api_->GetButton(i);
+ if (!button)
+ continue;
+
EXPECT_FALSE(launcher_view_->ShouldHideTooltip(
button->GetMirroredBounds().CenterPoint()))
<< "LauncherView tries to hide on button " << i;