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

Side by Side Diff: ash/shelf/shelf_view_unittest.cc

Issue 2534953006: Fix shelf auto-hide calculation for app-list visibility. (Closed)
Patch Set: Cleanup. Created 4 years 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 unified diff | Download patch
OLDNEW
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 2026 matching lines...) Expand 10 before | Expand all | Expand 10 after
2037 2037
2038 DISALLOW_COPY_AND_ASSIGN(ListMenuShelfItemDelegate); 2038 DISALLOW_COPY_AND_ASSIGN(ListMenuShelfItemDelegate);
2039 }; 2039 };
2040 2040
2041 // A test implementation for AppListPresenter that does not change visibility 2041 // A test implementation for AppListPresenter that does not change visibility
2042 // state immediately to simulate an in-flight animation. Calling 2042 // state immediately to simulate an in-flight animation. Calling
2043 // FinishVisibilityChange() will change the visibility to the requested one, 2043 // FinishVisibilityChange() will change the visibility to the requested one,
2044 // simulating end of the animation. Similar to the actual AppListPresenter, this 2044 // simulating end of the animation. Similar to the actual AppListPresenter, this
2045 // class toggles app list visibility based on the actual visibility rather than 2045 // class toggles app list visibility based on the actual visibility rather than
2046 // the target visibility (which might be different due to in-flight animation). 2046 // the target visibility (which might be different due to in-flight animation).
2047 // This test class doesn't support checking for display-specific visibility.
2047 class TestAppListPresenter : public app_list::AppListPresenter { 2048 class TestAppListPresenter : public app_list::AppListPresenter {
2048 public: 2049 public:
2049 TestAppListPresenter() {} 2050 TestAppListPresenter() {}
2050 ~TestAppListPresenter() override {} 2051 ~TestAppListPresenter() override {}
2051 2052
2052 void FinishVisibilityChange() { is_visible_ = target_visibility_; } 2053 void FinishVisibilityChange() { is_visible_ = target_visibility_; }
2053 2054
2054 // app_list::AppListPresenter: 2055 // app_list::AppListPresenter:
2055 void Show(int64_t display_id) override { target_visibility_ = true; } 2056 void Show(int64_t display_id) override { target_visibility_ = true; }
2056 void Dismiss() override { target_visibility_ = false; } 2057 void Dismiss() override { target_visibility_ = false; }
2057 void ToggleAppList(int64_t display_id) override { 2058 void ToggleAppList(int64_t display_id) override {
2058 if (is_visible_) 2059 if (is_visible_)
2059 Dismiss(); 2060 Dismiss();
2060 else 2061 else
2061 Show(display_id); 2062 Show(display_id);
2062 } 2063 }
2063 bool IsVisible() const override { return is_visible_; } 2064 bool IsVisible(
2064 bool GetTargetVisibility() const override { return target_visibility_; } 2065 int64_t display_id = display::kInvalidDisplayId) const override {
2066 return is_visible_;
2067 }
2068 bool GetTargetVisibility(
2069 int64_t display_id = display::kInvalidDisplayId) const override {
2070 return target_visibility_;
2071 }
2065 2072
2066 private: 2073 private:
2067 bool is_visible_ = false; 2074 bool is_visible_ = false;
2068 bool target_visibility_ = false; 2075 bool target_visibility_ = false;
2069 2076
2070 DISALLOW_COPY_AND_ASSIGN(TestAppListPresenter); 2077 DISALLOW_COPY_AND_ASSIGN(TestAppListPresenter);
2071 }; 2078 };
2072 2079
2073 // A test ShellDelegate implementation that returns a TestAppListPresenter as 2080 // A test ShellDelegate implementation that returns a TestAppListPresenter as
2074 // the app list presenter. 2081 // the app list presenter.
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
3114 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), 3121 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(),
3115 IsEmpty()); 3122 IsEmpty());
3116 3123
3117 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); 3124 ASSERT_TRUE(test_api_->IsShowingOverflowBubble());
3118 } 3125 }
3119 3126
3120 #endif // !defined(OS_WIN) 3127 #endif // !defined(OS_WIN)
3121 3128
3122 } // namespace test 3129 } // namespace test
3123 } // namespace ash 3130 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698