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

Side by Side Diff: ash/system/tray/system_tray_unittest.cc

Issue 289743002: Overview Button Tray Animation accounting for startup (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Implement Fix Created 6 years, 7 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
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/system/tray/system_tray.h" 5 #include "ash/system/tray/system_tray.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/accessibility_delegate.h" 9 #include "ash/accessibility_delegate.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
11 #include "ash/shelf/shelf_layout_manager.h" 11 #include "ash/shelf/shelf_layout_manager.h"
12 #include "ash/shelf/shelf_widget.h" 12 #include "ash/shelf/shelf_widget.h"
13 #include "ash/shell.h" 13 #include "ash/shell.h"
14 #include "ash/system/status_area_widget.h" 14 #include "ash/system/status_area_widget.h"
15 #include "ash/system/tray/system_tray_item.h" 15 #include "ash/system/tray/system_tray_item.h"
16 #include "ash/system/tray/tray_constants.h" 16 #include "ash/system/tray/tray_constants.h"
17 #include "ash/test/ash_test_base.h" 17 #include "ash/test/ash_test_base.h"
18 #include "ash/wm/window_util.h" 18 #include "ash/wm/window_util.h"
19 #include "base/run_loop.h" 19 #include "base/run_loop.h"
20 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
21 #include "ui/aura/test/event_generator.h" 21 #include "ui/aura/test/event_generator.h"
22 #include "ui/aura/window.h" 22 #include "ui/aura/window.h"
23 #include "ui/base/ui_base_types.h" 23 #include "ui/base/ui_base_types.h"
24 #include "ui/compositor/scoped_animation_duration_scale_mode.h"
24 #include "ui/gfx/geometry/rect.h" 25 #include "ui/gfx/geometry/rect.h"
25 #include "ui/views/controls/label.h" 26 #include "ui/views/controls/label.h"
26 #include "ui/views/layout/fill_layout.h" 27 #include "ui/views/layout/fill_layout.h"
27 #include "ui/views/view.h" 28 #include "ui/views/view.h"
28 #include "ui/views/widget/widget.h" 29 #include "ui/views/widget/widget.h"
29 #include "ui/views/widget/widget_delegate.h" 30 #include "ui/views/widget/widget_delegate.h"
30 31
31 #if defined(OS_WIN) 32 #if defined(OS_WIN)
32 #include "base/win/windows_version.h" 33 #include "base/win/windows_version.h"
33 #endif 34 #endif
(...skipping 442 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 ASSERT_TRUE(accessibility); 477 ASSERT_TRUE(accessibility);
477 EXPECT_TRUE(accessibility->visible()); 478 EXPECT_TRUE(accessibility->visible());
478 479
479 const views::View* settings = 480 const views::View* settings =
480 tray->GetSystemBubble()->bubble_view()->GetViewByID( 481 tray->GetSystemBubble()->bubble_view()->GetViewByID(
481 test::kSettingsTrayItemViewId); 482 test::kSettingsTrayItemViewId);
482 ASSERT_TRUE(settings); 483 ASSERT_TRUE(settings);
483 EXPECT_TRUE(settings->visible()); 484 EXPECT_TRUE(settings->visible());
484 } 485 }
485 486
487 // Tests that if SetVisible(true) is called while animating to hidden that the
488 // tray becomes visible, and stops animating to hidden.
489 TEST_F(SystemTrayTest, SetVisibleDuringHideAnimation) {
490 SystemTray* tray = GetSystemTray();
491 ASSERT_TRUE(tray->visible());
492
493 ui::ScopedAnimationDurationScaleMode long_duration(
494 ui::ScopedAnimationDurationScaleMode::SLOW_DURATION);
495 tray->SetVisible(false);
496 EXPECT_TRUE(tray->visible());
497 EXPECT_EQ(0.0f, tray->layer()->GetTargetOpacity());
498
499 tray->SetVisible(true);
500 EXPECT_TRUE(tray->visible());
flackr 2014/05/14 17:32:43 This test should end the animation before verifyin
jonross 2014/05/14 23:28:47 Updated to set clear the scoped duration, and set
501 EXPECT_EQ(1.0f, tray->layer()->GetTargetOpacity());
502 }
503
486 } // namespace test 504 } // namespace test
487 } // namespace ash 505 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698