| 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 1890 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1901 ShelfItemDelegate::kExistingWindowActivated); | 1901 ShelfItemDelegate::kExistingWindowActivated); |
| 1902 SimulateClick(browser_index_); | 1902 SimulateClick(browser_index_); |
| 1903 | 1903 |
| 1904 histogram_tester.ExpectTotalCount( | 1904 histogram_tester.ExpectTotalCount( |
| 1905 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); | 1905 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); |
| 1906 } | 1906 } |
| 1907 | 1907 |
| 1908 class ShelfViewVisibleBoundsTest : public ShelfViewTest, | 1908 class ShelfViewVisibleBoundsTest : public ShelfViewTest, |
| 1909 public testing::WithParamInterface<bool> { | 1909 public testing::WithParamInterface<bool> { |
| 1910 public: | 1910 public: |
| 1911 ShelfViewVisibleBoundsTest() : text_direction_change_(GetParam()) { | 1911 ShelfViewVisibleBoundsTest() : text_direction_change_(GetParam()) {} |
| 1912 // TODO(jamescook): This test fails unless the system update icon is | |
| 1913 // showing, which used to be the default. However, it only fails on the | |
| 1914 // trybots, and only in the case where the overflow button is showing. | |
| 1915 // See http://crbug.com/619344 | |
| 1916 TestSystemTrayDelegate::SetSystemUpdateRequired(true); | |
| 1917 } | |
| 1918 | 1912 |
| 1919 void CheckAllItemsAreInBounds() { | 1913 void CheckAllItemsAreInBounds() { |
| 1920 gfx::Rect visible_bounds = shelf_view_->GetVisibleItemsBoundsInScreen(); | 1914 gfx::Rect visible_bounds = shelf_view_->GetVisibleItemsBoundsInScreen(); |
| 1921 gfx::Rect shelf_bounds = shelf_view_->GetBoundsInScreen(); | 1915 gfx::Rect shelf_bounds = shelf_view_->GetBoundsInScreen(); |
| 1922 EXPECT_TRUE(shelf_bounds.Contains(visible_bounds)); | 1916 EXPECT_TRUE(shelf_bounds.Contains(visible_bounds)); |
| 1923 for (int i = 0; i < test_api_->GetButtonCount(); ++i) | 1917 for (int i = 0; i < test_api_->GetButtonCount(); ++i) |
| 1924 if (ShelfButton* button = test_api_->GetButton(i)) | 1918 if (ShelfButton* button = test_api_->GetButton(i)) { |
| 1925 EXPECT_TRUE(visible_bounds.Contains(button->GetBoundsInScreen())); | 1919 if (button->visible()) |
| 1920 EXPECT_TRUE(visible_bounds.Contains(button->GetBoundsInScreen())); |
| 1921 } |
| 1926 CheckAppListButtonIsInBounds(); | 1922 CheckAppListButtonIsInBounds(); |
| 1927 } | 1923 } |
| 1928 | 1924 |
| 1929 void CheckAppListButtonIsInBounds() { | 1925 void CheckAppListButtonIsInBounds() { |
| 1930 gfx::Rect visible_bounds = shelf_view_->GetVisibleItemsBoundsInScreen(); | 1926 gfx::Rect visible_bounds = shelf_view_->GetVisibleItemsBoundsInScreen(); |
| 1931 gfx::Rect app_list_button_bounds = | 1927 gfx::Rect app_list_button_bounds = |
| 1932 shelf_view_->GetAppListButton()->GetBoundsInScreen(); | 1928 shelf_view_->GetAppListButton()->GetBoundsInScreen(); |
| 1933 EXPECT_TRUE(visible_bounds.Contains(app_list_button_bounds)); | 1929 EXPECT_TRUE(visible_bounds.Contains(app_list_button_bounds)); |
| 1934 } | 1930 } |
| 1935 | 1931 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1949 CheckAllItemsAreInBounds(); | 1945 CheckAllItemsAreInBounds(); |
| 1950 // Same for overflow case. | 1946 // Same for overflow case. |
| 1951 while (!test_api_->IsOverflowButtonVisible()) { | 1947 while (!test_api_->IsOverflowButtonVisible()) { |
| 1952 AddAppShortcut(); | 1948 AddAppShortcut(); |
| 1953 } | 1949 } |
| 1954 test_api_->RunMessageLoopUntilAnimationsDone(); | 1950 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1955 CheckAllItemsAreInBounds(); | 1951 CheckAllItemsAreInBounds(); |
| 1956 } | 1952 } |
| 1957 | 1953 |
| 1958 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); | 1954 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); |
| 1959 | 1955 INSTANTIATE_TEST_CASE_P(VisibleBounds, |
| 1960 // This test seems to be flaky with material design shelf (see | |
| 1961 // https://crbug.com/625671) and even in non-material mode (see | |
| 1962 // https://crbug.com/619344 which is fixed using a hack). Disabling for now. | |
| 1963 // TODO(mohsen): Hopefully, the fix for https://crbug.com/634128 that fixes | |
| 1964 // issues with shelf spacing, will fix this flake, too. Re-enable when that | |
| 1965 // issue is fixed. | |
| 1966 INSTANTIATE_TEST_CASE_P(DISABLED_VisibleBounds, | |
| 1967 ShelfViewVisibleBoundsTest, | 1956 ShelfViewVisibleBoundsTest, |
| 1968 testing::Bool()); | 1957 testing::Bool()); |
| 1969 | 1958 |
| 1970 namespace { | 1959 namespace { |
| 1971 | 1960 |
| 1972 // An InkDrop implementation that wraps another InkDrop instance to keep track | 1961 // An InkDrop implementation that wraps another InkDrop instance to keep track |
| 1973 // of state changes requested on it. Note that this will only track transitions | 1962 // of state changes requested on it. Note that this will only track transitions |
| 1974 // routed through AnimateToState() and not the ones performed directly on the | 1963 // routed through AnimateToState() and not the ones performed directly on the |
| 1975 // ripple inside the contained |ink_drop|. | 1964 // ripple inside the contained |ink_drop|. |
| 1976 class InkDropSpy : public views::InkDrop { | 1965 class InkDropSpy : public views::InkDrop { |
| (...skipping 1194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3171 IsEmpty()); | 3160 IsEmpty()); |
| 3172 | 3161 |
| 3173 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); | 3162 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); |
| 3174 } | 3163 } |
| 3175 } | 3164 } |
| 3176 | 3165 |
| 3177 #endif // !defined(OS_WIN) | 3166 #endif // !defined(OS_WIN) |
| 3178 | 3167 |
| 3179 } // namespace test | 3168 } // namespace test |
| 3180 } // namespace ash | 3169 } // namespace ash |
| OLD | NEW |