OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ash/common/shelf/shelf_view.h" | 5 #include "ash/common/shelf/shelf_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 class TestShelfDelegateForShelfView : public TestShelfDelegate { | 250 class TestShelfDelegateForShelfView : public TestShelfDelegate { |
251 public: | 251 public: |
252 TestShelfDelegateForShelfView() {} | 252 TestShelfDelegateForShelfView() {} |
253 ~TestShelfDelegateForShelfView() override {} | 253 ~TestShelfDelegateForShelfView() override {} |
254 | 254 |
255 void set_is_app_pinned(bool is_pinned) { is_app_pinned_ = is_pinned; } | 255 void set_is_app_pinned(bool is_pinned) { is_app_pinned_ = is_pinned; } |
256 | 256 |
257 // ShelfDelegate overrides: | 257 // ShelfDelegate overrides: |
258 ShelfID GetShelfIDForAppID(const std::string& app_id) override { | 258 ShelfID GetShelfIDForAppID(const std::string& app_id) override { |
259 ShelfID id = 0; | 259 ShelfID id = 0; |
260 EXPECT_TRUE(base::StringToInt(app_id, &id)); | 260 EXPECT_TRUE(base::StringToInt64(app_id, &id)); |
261 return id; | 261 return id; |
262 } | 262 } |
263 | 263 |
264 bool HasShelfIDToAppIDMapping(ShelfID id) const override { return true; } | 264 bool HasShelfIDToAppIDMapping(ShelfID id) const override { return true; } |
265 | 265 |
266 const std::string& GetAppIDForShelfID(ShelfID id) override { | 266 const std::string& GetAppIDForShelfID(ShelfID id) override { |
267 // Use |app_id_| member variable because returning a reference to local | 267 // Use |app_id_| member variable because returning a reference to local |
268 // variable is not allowed. | 268 // variable is not allowed. |
269 app_id_ = base::IntToString(id); | 269 app_id_ = base::IntToString(id); |
270 return app_id_; | 270 return app_id_; |
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 cur_index--) | 546 cur_index--) |
547 ContinueDrag(button, pointer, cur_index + 1, cur_index, true); | 547 ContinueDrag(button, pointer, cur_index + 1, cur_index, true); |
548 } | 548 } |
549 return button; | 549 return button; |
550 } | 550 } |
551 | 551 |
552 void DragAndVerify( | 552 void DragAndVerify( |
553 int from, | 553 int from, |
554 int to, | 554 int to, |
555 ShelfView* shelf_view, | 555 ShelfView* shelf_view, |
556 const std::vector<std::pair<int, views::View*>>& expected_id_map) { | 556 const std::vector<std::pair<ShelfID, views::View*>>& expected_id_map) { |
557 views::View* dragged_button = | 557 views::View* dragged_button = |
558 SimulateDrag(ShelfView::MOUSE, from, to, true); | 558 SimulateDrag(ShelfView::MOUSE, from, to, true); |
559 shelf_view->PointerReleasedOnButton(dragged_button, ShelfView::MOUSE, | 559 shelf_view->PointerReleasedOnButton(dragged_button, ShelfView::MOUSE, |
560 false); | 560 false); |
561 test_api_->RunMessageLoopUntilAnimationsDone(); | 561 test_api_->RunMessageLoopUntilAnimationsDone(); |
562 ASSERT_NO_FATAL_FAILURE(CheckModelIDs(expected_id_map)); | 562 ASSERT_NO_FATAL_FAILURE(CheckModelIDs(expected_id_map)); |
563 } | 563 } |
564 | 564 |
565 void SetupForDragTest(std::vector<std::pair<ShelfID, views::View*>>* id_map) { | 565 void SetupForDragTest(std::vector<std::pair<ShelfID, views::View*>>* id_map) { |
566 // Initialize |id_map| with the automatically-created shelf buttons. | 566 // Initialize |id_map| with the automatically-created shelf buttons. |
(...skipping 2444 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3011 EXPECT_EQ(views::InkDropState::ACTIVATED, | 3011 EXPECT_EQ(views::InkDropState::ACTIVATED, |
3012 overflow_button_ink_drop_->GetTargetInkDropState()); | 3012 overflow_button_ink_drop_->GetTargetInkDropState()); |
3013 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | 3013 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), |
3014 IsEmpty()); | 3014 IsEmpty()); |
3015 | 3015 |
3016 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); | 3016 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); |
3017 } | 3017 } |
3018 | 3018 |
3019 } // namespace test | 3019 } // namespace test |
3020 } // namespace ash | 3020 } // namespace ash |
OLD | NEW |