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

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

Issue 2060003002: ash: Add a unit test for the system update tray item (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@movetraydelegate
Patch Set: rebase Created 4 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 unified diff | Download patch
« no previous file with comments | « ash/ash.gyp ('k') | ash/system/tray/system_tray.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/shelf/shelf_view.h" 5 #include "ash/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 12 matching lines...) Expand all
23 #include "ash/shelf/shelf_tooltip_manager.h" 23 #include "ash/shelf/shelf_tooltip_manager.h"
24 #include "ash/shelf/shelf_widget.h" 24 #include "ash/shelf/shelf_widget.h"
25 #include "ash/shell.h" 25 #include "ash/shell.h"
26 #include "ash/test/ash_test_base.h" 26 #include "ash/test/ash_test_base.h"
27 #include "ash/test/overflow_bubble_view_test_api.h" 27 #include "ash/test/overflow_bubble_view_test_api.h"
28 #include "ash/test/shelf_test_api.h" 28 #include "ash/test/shelf_test_api.h"
29 #include "ash/test/shelf_view_test_api.h" 29 #include "ash/test/shelf_view_test_api.h"
30 #include "ash/test/shell_test_api.h" 30 #include "ash/test/shell_test_api.h"
31 #include "ash/test/test_shelf_delegate.h" 31 #include "ash/test/test_shelf_delegate.h"
32 #include "ash/test/test_shelf_item_delegate.h" 32 #include "ash/test/test_shelf_item_delegate.h"
33 #include "ash/test/test_system_tray_delegate.h"
33 #include "base/compiler_specific.h" 34 #include "base/compiler_specific.h"
34 #include "base/i18n/rtl.h" 35 #include "base/i18n/rtl.h"
35 #include "base/run_loop.h" 36 #include "base/run_loop.h"
36 #include "base/strings/string_number_conversions.h" 37 #include "base/strings/string_number_conversions.h"
37 #include "base/test/histogram_tester.h" 38 #include "base/test/histogram_tester.h"
38 #include "base/test/user_action_tester.h" 39 #include "base/test/user_action_tester.h"
39 #include "base/time/time.h" 40 #include "base/time/time.h"
40 #include "ui/aura/test/aura_test_base.h" 41 #include "ui/aura/test/aura_test_base.h"
41 #include "ui/aura/window.h" 42 #include "ui/aura/window.h"
42 #include "ui/aura/window_event_dispatcher.h" 43 #include "ui/aura/window_event_dispatcher.h"
(...skipping 1893 matching lines...) Expand 10 before | Expand all | Expand 10 after
1936 ShelfItemDelegate::kExistingWindowActivated); 1937 ShelfItemDelegate::kExistingWindowActivated);
1937 SimulateClick(browser_index_); 1938 SimulateClick(browser_index_);
1938 1939
1939 histogram_tester.ExpectTotalCount( 1940 histogram_tester.ExpectTotalCount(
1940 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1); 1941 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName, 1);
1941 } 1942 }
1942 1943
1943 class ShelfViewVisibleBoundsTest : public ShelfViewTest, 1944 class ShelfViewVisibleBoundsTest : public ShelfViewTest,
1944 public testing::WithParamInterface<bool> { 1945 public testing::WithParamInterface<bool> {
1945 public: 1946 public:
1946 ShelfViewVisibleBoundsTest() : text_direction_change_(GetParam()) {} 1947 ShelfViewVisibleBoundsTest() : text_direction_change_(GetParam()) {
1948 // TODO(jamescook): This test fails unless the system update icon is
1949 // showing, which used to be the default. However, it only fails on the
1950 // trybots, and only in the case where the overflow button is showing.
1951 // See http://crbug.com/619344
1952 TestSystemTrayDelegate::SetSystemUpdateRequired(true);
1953 }
1947 1954
1948 void CheckAllItemsAreInBounds() { 1955 void CheckAllItemsAreInBounds() {
1949 gfx::Rect visible_bounds = shelf_view_->GetVisibleItemsBoundsInScreen(); 1956 gfx::Rect visible_bounds = shelf_view_->GetVisibleItemsBoundsInScreen();
1950 gfx::Rect shelf_bounds = shelf_view_->GetBoundsInScreen(); 1957 gfx::Rect shelf_bounds = shelf_view_->GetBoundsInScreen();
1951 EXPECT_TRUE(shelf_bounds.Contains(visible_bounds)); 1958 EXPECT_TRUE(shelf_bounds.Contains(visible_bounds));
1952 for (int i = 0; i < test_api_->GetButtonCount(); ++i) 1959 for (int i = 0; i < test_api_->GetButtonCount(); ++i)
1953 if (ShelfButton* button = test_api_->GetButton(i)) 1960 if (ShelfButton* button = test_api_->GetButton(i))
1954 EXPECT_TRUE(visible_bounds.Contains(button->GetBoundsInScreen())); 1961 EXPECT_TRUE(visible_bounds.Contains(button->GetBoundsInScreen()));
1955 CheckAppListButtonIsInBounds(); 1962 CheckAppListButtonIsInBounds();
1956 } 1963 }
(...skipping 26 matching lines...) Expand all
1983 test_api_->RunMessageLoopUntilAnimationsDone(); 1990 test_api_->RunMessageLoopUntilAnimationsDone();
1984 CheckAllItemsAreInBounds(); 1991 CheckAllItemsAreInBounds();
1985 } 1992 }
1986 1993
1987 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); 1994 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool());
1988 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, 1995 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest,
1989 testing::Bool()); 1996 testing::Bool());
1990 1997
1991 } // namespace test 1998 } // namespace test
1992 } // namespace ash 1999 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash.gyp ('k') | ash/system/tray/system_tray.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698