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

Side by Side Diff: chrome/browser/ui/panels/panel_overflow_browsertest.cc

Issue 8953040: Add overflow indicator count on Windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <vector> 5 #include <vector>
6 #include "chrome/browser/ui/browser.h" 6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/panels/base_panel_browser_test.h" 7 #include "chrome/browser/ui/panels/base_panel_browser_test.h"
8 #include "chrome/browser/ui/panels/native_panel.h" 8 #include "chrome/browser/ui/panels/native_panel.h"
9 #include "chrome/browser/ui/panels/panel.h" 9 #include "chrome/browser/ui/panels/panel.h"
10 #include "chrome/browser/ui/panels/panel_manager.h" 10 #include "chrome/browser/ui/panels/panel_manager.h"
11 #include "chrome/browser/ui/panels/panel_overflow_indicator.h"
11 #include "chrome/browser/ui/panels/panel_overflow_strip.h" 12 #include "chrome/browser/ui/panels/panel_overflow_strip.h"
12 #include "chrome/browser/ui/panels/panel_settings_menu_model.h" 13 #include "chrome/browser/ui/panels/panel_settings_menu_model.h"
13 #include "chrome/browser/ui/panels/panel_strip.h" 14 #include "chrome/browser/ui/panels/panel_strip.h"
14 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" 15 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h"
15 #include "chrome/common/chrome_notification_types.h" 16 #include "chrome/common/chrome_notification_types.h"
16 #include "chrome/test/base/ui_test_utils.h" 17 #include "chrome/test/base/ui_test_utils.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 namespace { 20 namespace {
20 21
21 // We override the default value for testing purpose. 22 // We override the default value for testing purpose.
22 const int kMaxVisibleOverflowForTesting = 3; 23 const int kMaxVisibleOnShrunkForTesting = 3;
jennb 2011/12/19 22:24:50 "OnShrunk" and "OnExpanded" aren't as self-explana
jianli 2011/12/20 01:20:41 Done.
24 const int kMaxVisibleOnExpandedForTesting = 6;
23 25
24 // Encapsulates all the info we need to verify if a panel behaves as expected 26 // Encapsulates all the info we need to verify if a panel behaves as expected
25 // when we do the overflow testing. 27 // when we do the overflow testing.
26 struct PanelData { 28 struct PanelData {
27 Panel* panel; 29 Panel* panel;
28 Panel::ExpansionState expansion_state; 30 Panel::ExpansionState expansion_state;
29 bool visible; 31 bool visible;
30 bool active; 32 bool active;
31 33
32 explicit PanelData(Panel* panel) 34 explicit PanelData(Panel* panel)
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 public: 81 public:
80 PanelOverflowBrowserTest() : BasePanelBrowserTest() { 82 PanelOverflowBrowserTest() : BasePanelBrowserTest() {
81 } 83 }
82 84
83 virtual ~PanelOverflowBrowserTest() { 85 virtual ~PanelOverflowBrowserTest() {
84 } 86 }
85 87
86 virtual void SetUpOnMainThread() OVERRIDE { 88 virtual void SetUpOnMainThread() OVERRIDE {
87 BasePanelBrowserTest::SetUpOnMainThread(); 89 BasePanelBrowserTest::SetUpOnMainThread();
88 90
89 PanelManager::GetInstance()->panel_overflow_strip()-> 91 PanelManager* panel_manager = PanelManager::GetInstance();
90 set_max_visible_panels(kMaxVisibleOverflowForTesting); 92 panel_manager->panel_overflow_strip()->
93 set_max_visible_panels_on_shrunk(kMaxVisibleOnShrunkForTesting);
94 panel_manager->panel_overflow_strip()->
95 set_max_visible_panels_on_expanded(kMaxVisibleOnExpandedForTesting);
96
97 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher();
98 panel_manager->SetMouseWatcherForTesting(mouse_watcher);
91 99
92 // All the overflow tests assume 800x600 work area. Do the check now. 100 // All the overflow tests assume 800x600 work area. Do the check now.
93 DCHECK(PanelManager::GetInstance()->work_area().width() == 800); 101 DCHECK(PanelManager::GetInstance()->work_area().width() == 800);
94 } 102 }
95 103
96 protected: 104 protected:
97 static PanelDataList GetAllNormalPanelData() { 105 static PanelDataList GetAllNormalPanelData() {
98 PanelDataList panel_data_list; 106 PanelDataList panel_data_list;
99 PanelStrip::Panels panels = 107 PanelStrip::Panels panels =
100 PanelManager::GetInstance()->panel_strip()->panels(); 108 PanelManager::GetInstance()->panel_strip()->panels();
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 // platforms. http://crbug.com/105073 177 // platforms. http://crbug.com/105073
170 #if defined(OS_WIN) 178 #if defined(OS_WIN)
171 #define MAYBE_CreateOverflowPanels CreateOverflowPanels 179 #define MAYBE_CreateOverflowPanels CreateOverflowPanels
172 #define MAYBE_CreateMoreOverflowPanels CreateMoreOverflowPanels 180 #define MAYBE_CreateMoreOverflowPanels CreateMoreOverflowPanels
173 // http://crbug.com/107230 181 // http://crbug.com/107230
174 #define MAYBE_CreatePanelOnDelayedOverflow FAILS_CreatePanelOnDelayedOverflow 182 #define MAYBE_CreatePanelOnDelayedOverflow FAILS_CreatePanelOnDelayedOverflow
175 #define MAYBE_CloseOverflowPanels CloseOverflowPanels 183 #define MAYBE_CloseOverflowPanels CloseOverflowPanels
176 #define MAYBE_CloseNormalPanels CloseNormalPanels 184 #define MAYBE_CloseNormalPanels CloseNormalPanels
177 #define MAYBE_ActivateOverflowPanels ActivateOverflowPanels 185 #define MAYBE_ActivateOverflowPanels ActivateOverflowPanels
178 #define MAYBE_HoverOverOverflowArea HoverOverOverflowArea 186 #define MAYBE_HoverOverOverflowArea HoverOverOverflowArea
187 #define MAYBE_OverflowIndicatorCount OverflowIndicatorCount
188 #define MAYBE_DrawOverflowAttention DrawOverflowAttention
179 #else 189 #else
180 #define MAYBE_CreateOverflowPanels DISABLED_CreateOverflowPanels 190 #define MAYBE_CreateOverflowPanels DISABLED_CreateOverflowPanels
181 #define MAYBE_CreateMoreOverflowPanels DISABLED_CreateMoreOverflowPanels 191 #define MAYBE_CreateMoreOverflowPanels DISABLED_CreateMoreOverflowPanels
182 #define MAYBE_CreatePanelOnDelayedOverflow DISABLED_CreatePanelOnDelayedOverflow 192 #define MAYBE_CreatePanelOnDelayedOverflow DISABLED_CreatePanelOnDelayedOverflow
183 #define MAYBE_CloseOverflowPanels DISABLED_CloseOverflowPanels 193 #define MAYBE_CloseOverflowPanels DISABLED_CloseOverflowPanels
184 #define MAYBE_CloseNormalPanels DISABLED_CloseNormalPanels 194 #define MAYBE_CloseNormalPanels DISABLED_CloseNormalPanels
185 #define MAYBE_ActivateOverflowPanels DISABLED_ActivateOverflowPanels 195 #define MAYBE_ActivateOverflowPanels DISABLED_ActivateOverflowPanels
186 #define MAYBE_HoverOverOverflowArea DISABLED_HoverOverOverflowArea 196 #define MAYBE_HoverOverOverflowArea DISABLED_HoverOverOverflowArea
197 #define MAYBE_OverflowIndicatorCount DISABLED_OverflowIndicatorCount
198 #define MAYBE_DrawOverflowAttention DISABLED_DrawOverflowAttention
187 #endif 199 #endif
188 200
189 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_CreateOverflowPanels) { 201 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_CreateOverflowPanels) {
190 PanelManager* panel_manager = PanelManager::GetInstance(); 202 PanelManager* panel_manager = PanelManager::GetInstance();
191 PanelStrip* panel_strip = panel_manager->panel_strip(); 203 PanelStrip* panel_strip = panel_manager->panel_strip();
192 PanelOverflowStrip* panel_overflow_strip = 204 PanelOverflowStrip* panel_overflow_strip =
193 panel_manager->panel_overflow_strip(); 205 panel_manager->panel_overflow_strip();
194 206
195 const int panel_widths[] = { 207 const int panel_widths[] = {
196 250, 260, 200, // normal 208 250, 260, 200, // normal
197 255, 220 // overflow 209 255, 220 // overflow
198 }; 210 };
199 CreateOverflowPanels(3, 2, panel_widths); 211 CreateOverflowPanels(3, 2, panel_widths);
200 212
201 std::vector<Panel*> panels = panel_manager->panels(); 213 std::vector<Panel*> panels = panel_manager->panels();
202 ASSERT_EQ(5u, panels.size()); 214 ASSERT_EQ(5u, panels.size());
203 EXPECT_EQ(3, panel_strip->num_panels()); 215 EXPECT_EQ(3, panel_strip->num_panels());
204 EXPECT_EQ(2, panel_overflow_strip->num_panels()); 216 EXPECT_EQ(2, panel_overflow_strip->num_panels());
217 EXPECT_EQ(0, panel_overflow_strip->overflow_indicator()->GetCount());
jennb 2011/12/19 22:24:50 Do you have test coverage to check that if this co
jianli 2011/12/20 01:20:41 Done.
205 EXPECT_EQ(Panel::IN_OVERFLOW, panels[3]->expansion_state()); 218 EXPECT_EQ(Panel::IN_OVERFLOW, panels[3]->expansion_state());
206 EXPECT_TRUE(IsPanelVisible(panels[3])); 219 EXPECT_TRUE(IsPanelVisible(panels[3]));
207 EXPECT_EQ(Panel::IN_OVERFLOW, panels[4]->expansion_state()); 220 EXPECT_EQ(Panel::IN_OVERFLOW, panels[4]->expansion_state());
208 EXPECT_TRUE(IsPanelVisible(panels[4])); 221 EXPECT_TRUE(IsPanelVisible(panels[4]));
209 222
210 PanelManager::GetInstance()->RemoveAll(); 223 PanelManager::GetInstance()->RemoveAll();
211 } 224 }
212 225
213 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, 226 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest,
214 MAYBE_CreateMoreOverflowPanels) { 227 MAYBE_CreateMoreOverflowPanels) {
215 PanelManager* panel_manager = PanelManager::GetInstance(); 228 PanelManager* panel_manager = PanelManager::GetInstance();
216 PanelStrip* panel_strip = panel_manager->panel_strip(); 229 PanelStrip* panel_strip = panel_manager->panel_strip();
217 PanelOverflowStrip* panel_overflow_strip = 230 PanelOverflowStrip* panel_overflow_strip =
218 panel_manager->panel_overflow_strip(); 231 panel_manager->panel_overflow_strip();
219 232
220 const int panel_widths[] = { 233 const int panel_widths[] = {
221 250, 260, 200, // normal 234 250, 260, 200, // normal
222 255, 220, 210, // overflow 235 255, 220, 210, // overflow
223 220, 230 // overflow-on-overflow 236 220, 230 // overflow-on-overflow
224 }; 237 };
225 CreateOverflowPanels(3, 5, panel_widths); 238 CreateOverflowPanels(3, 5, panel_widths);
226 239
227 std::vector<Panel*> panels = panel_manager->panels(); 240 std::vector<Panel*> panels = panel_manager->panels();
228 ASSERT_EQ(8u, panels.size()); 241 ASSERT_EQ(8u, panels.size());
229 EXPECT_EQ(3, panel_strip->num_panels()); 242 EXPECT_EQ(3, panel_strip->num_panels());
230 EXPECT_EQ(5, panel_overflow_strip->num_panels()); 243 EXPECT_EQ(5, panel_overflow_strip->num_panels());
244 EXPECT_EQ(2, panel_overflow_strip->overflow_indicator()->GetCount());
231 EXPECT_EQ(Panel::IN_OVERFLOW, panels[3]->expansion_state()); 245 EXPECT_EQ(Panel::IN_OVERFLOW, panels[3]->expansion_state());
232 EXPECT_TRUE(IsPanelVisible(panels[3])); 246 EXPECT_TRUE(IsPanelVisible(panels[3]));
233 EXPECT_EQ(Panel::IN_OVERFLOW, panels[4]->expansion_state()); 247 EXPECT_EQ(Panel::IN_OVERFLOW, panels[4]->expansion_state());
234 EXPECT_TRUE(IsPanelVisible(panels[4])); 248 EXPECT_TRUE(IsPanelVisible(panels[4]));
235 EXPECT_EQ(Panel::IN_OVERFLOW, panels[5]->expansion_state()); 249 EXPECT_EQ(Panel::IN_OVERFLOW, panels[5]->expansion_state());
236 EXPECT_TRUE(IsPanelVisible(panels[5])); 250 EXPECT_TRUE(IsPanelVisible(panels[5]));
237 EXPECT_EQ(Panel::IN_OVERFLOW, panels[6]->expansion_state()); 251 EXPECT_EQ(Panel::IN_OVERFLOW, panels[6]->expansion_state());
238 EXPECT_FALSE(IsPanelVisible(panels[6])); 252 EXPECT_FALSE(IsPanelVisible(panels[6]));
239 EXPECT_EQ(Panel::IN_OVERFLOW, panels[7]->expansion_state()); 253 EXPECT_EQ(Panel::IN_OVERFLOW, panels[7]->expansion_state());
240 EXPECT_FALSE(IsPanelVisible(panels[7])); 254 EXPECT_FALSE(IsPanelVisible(panels[7]));
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false); 619 expected_overflow_list.Add(panels[3], Panel::IN_OVERFLOW, true, false);
606 expected_overflow_list.Add(panels[2], Panel::IN_OVERFLOW, false, false); 620 expected_overflow_list.Add(panels[2], Panel::IN_OVERFLOW, false, false);
607 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, false, false); 621 expected_overflow_list.Add(panels[5], Panel::IN_OVERFLOW, false, false);
608 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData()); 622 EXPECT_EQ(expected_overflow_list, GetAllOverflowPanelData());
609 623
610 PanelManager::GetInstance()->RemoveAll(); 624 PanelManager::GetInstance()->RemoveAll();
611 } 625 }
612 626
613 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_HoverOverOverflowArea) { 627 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_HoverOverOverflowArea) {
614 PanelManager* panel_manager = PanelManager::GetInstance(); 628 PanelManager* panel_manager = PanelManager::GetInstance();
615 PanelMouseWatcher* mouse_watcher = new TestPanelMouseWatcher();
616 panel_manager->SetMouseWatcherForTesting(mouse_watcher);
617 PanelOverflowStrip* panel_overflow_strip = 629 PanelOverflowStrip* panel_overflow_strip =
618 panel_manager->panel_overflow_strip(); 630 panel_manager->panel_overflow_strip();
619 int iconified_width = panel_overflow_strip->current_display_width(); 631 int iconified_width = panel_overflow_strip->current_display_width();
620 632
621 // Create normal and overflow panels. 633 // Create normal and overflow panels.
622 // normal: P0, P1, P2 634 // normal: P0, P1, P2
623 // overflow: P3, P4, P5 635 // overflow: P3, P4, P5
624 // overflow-on-overflow: P6, P7 636 // overflow-on-overflow: P6, P7
625 const int panel_widths[] = { 637 const int panel_widths[] = {
626 250, 260, 200, // normal 638 250, 260, 200, // normal
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
709 panels[7]->GetBounds().x(), panels[7]->GetBounds().y() - 1)); 721 panels[7]->GetBounds().x(), panels[7]->GetBounds().y() - 1));
710 EXPECT_EQ(iconified_width, panel_overflow_strip->current_display_width()); 722 EXPECT_EQ(iconified_width, panel_overflow_strip->current_display_width());
711 EXPECT_EQ(iconified_width, panels[3]->GetBounds().width()); 723 EXPECT_EQ(iconified_width, panels[3]->GetBounds().width());
712 EXPECT_EQ(iconified_width, panels[4]->GetBounds().width()); 724 EXPECT_EQ(iconified_width, panels[4]->GetBounds().width());
713 EXPECT_EQ(iconified_width, panels[5]->GetBounds().width()); 725 EXPECT_EQ(iconified_width, panels[5]->GetBounds().width());
714 EXPECT_EQ(0, panels[6]->GetBounds().width()); 726 EXPECT_EQ(0, panels[6]->GetBounds().width());
715 EXPECT_EQ(0, panels[7]->GetBounds().width()); 727 EXPECT_EQ(0, panels[7]->GetBounds().width());
716 728
717 panel_manager->RemoveAll(); 729 panel_manager->RemoveAll();
718 } 730 }
731
732 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_OverflowIndicatorCount) {
jennb 2011/12/19 22:24:50 Need case for moving a big overflow panel into nor
jianli 2011/12/20 01:20:41 Done.
733 PanelManager* panel_manager = PanelManager::GetInstance();
734 PanelOverflowStrip* panel_overflow_strip =
735 panel_manager->panel_overflow_strip();
736
737 // Create normal and overflow panels.
738 // normal: P0, P1, P2
739 // overflow: P3, P4, P5
740 const int panel_widths[] = {
741 240, 240, 240, // normal
742 240, 240, 240 // overflow
743 };
744 std::vector<Panel*> panels = CreateOverflowPanels(3, 3, panel_widths);
745 EXPECT_EQ(3, panel_overflow_strip->num_panels());
746 PanelOverflowIndicator* overflow_indicator =
747 panel_overflow_strip->overflow_indicator();
748 EXPECT_EQ(0, overflow_indicator->GetCount());
749
750 // Create 5 overflow-on-overflow panels.
751 // normal: P0, P1, P2
752 // overflow: P3, P4, P5
753 // overflow-on-overflow: P6, P7, P8
754 // P9, P10
755 for (int i = 1; i <= 5; ++i) {
756 CreatePanelParams params(
757 MakePanelName(5 + i),
jennb 2011/12/19 22:24:50 Should replace this 5 with size of panels vector.
jianli 2011/12/20 01:20:41 Done.
758 gfx::Rect(0, 0, 240, 200),
759 SHOW_AS_INACTIVE);
760 Panel* panel = CreatePanelWithParams(params);
761 WaitForExpansionStateChanged(panel, Panel::IN_OVERFLOW);
762 EXPECT_EQ(i, overflow_indicator->GetCount());
763 panels.push_back(panel);
764 }
765
766 // Expand the overflow area by moving mouse over it.
767 // Expect the overflow indicator count gets updated.
768 MoveMouseAndWaitForOverflowAnimationEnded(panels[3]->GetBounds().origin());
769 EXPECT_EQ(2, overflow_indicator->GetCount());
770
771 // Close an overflow panel.
772 // Expect the overflow indicator count gets updated.
773 CloseWindowAndWait(panels[3]->browser());
774 EXPECT_EQ(1, overflow_indicator->GetCount());
jennb 2011/12/19 22:24:50 Check that one of the overflow-on-overflow panels
jianli 2011/12/20 01:20:41 Done.
775
776 // Shrunk the overflow area by moving mouse over it.
jennb 2011/12/19 22:24:50 Stop hovering the mouse over the overflow area.
jianli 2011/12/20 01:20:41 Done.
777 // Expect the overflow indicator count gets updated.
778 MoveMouseAndWaitForOverflowAnimationEnded(
779 gfx::Point(panels[4]->GetBounds().right() + 5, panels[4]->GetBounds().y()));
780 EXPECT_EQ(4, overflow_indicator->GetCount());
jennb 2011/12/19 22:24:50 Verify overflow-of-overflow panels no longer visib
jianli 2011/12/20 01:20:41 Done.
781
782 // Close an overflow panel.
783 // Expect the overflow indicator count gets updated.
784 CloseWindowAndWait(panels[4]->browser());
785 EXPECT_EQ(3, overflow_indicator->GetCount());
786
787 panel_manager->RemoveAll();
788 }
789
790 IN_PROC_BROWSER_TEST_F(PanelOverflowBrowserTest, MAYBE_DrawOverflowAttention) {
791 PanelManager* panel_manager = PanelManager::GetInstance();
792 panel_manager->enable_auto_sizing(true);
jennb 2011/12/19 22:24:50 This surprised me in a draw attention test. I actu
jianli 2011/12/20 01:20:41 Done.
793 PanelStrip* panel_strip = panel_manager->panel_strip();
794 PanelOverflowStrip* overflow_strip = panel_manager->panel_overflow_strip();
795
796 // Create normal and overflow panels.
797 // normal: P0, P1, P2, P3
798 // overflow: P4, P5, P6
799 // overflow-on-overflow: P7, P8, P9, (P10, P11)
800 const int panel_widths[] = {
801 100, 210, 210, 210, // normal
802 210, 210, 210, // overflow
803 210, 210, 210, // overflow-on-overflow on shrunk
804 210, 210 // overflow-on-overflow on expanded
805 };
806 std::vector<Panel*> panels = CreateOverflowPanels(4, 8, panel_widths);
807 EXPECT_EQ(4, panel_strip->num_panels());
808 EXPECT_EQ(8, overflow_strip->num_panels());
809 PanelOverflowIndicator* overflow_indicator =
810 overflow_strip->overflow_indicator();
811
812 // Draw attention for an overflow panel.
813 // Expect no impact to the overflow indicator.
814 // normal: P0, P1, P2, P3
815 // overflow: P4, *P5, P6
816 // overflow-on-overflow: P7, P8, P9, (P10, P11)
817 EXPECT_FALSE(panels[5]->IsDrawingAttention());
818 panels[5]->FlashFrame();
819 EXPECT_TRUE(panels[5]->IsDrawingAttention());
820 EXPECT_FALSE(overflow_indicator->IsDrawingAttention());
821
822 // Activating this overflow panel will clear its attention.
823 // Expect no impact to the overflow indicator.
824 // normal: P0, P1, P2, P5
825 // overflow: P3, P4, P6
826 // overflow-on-overflow: P7, P8, P9, (P10, P11)
827 panels[5]->Activate();
828 WaitForPanelActiveState(panels[5], SHOW_AS_ACTIVE);
829 EXPECT_FALSE(panels[5]->IsDrawingAttention());
830 EXPECT_FALSE(overflow_indicator->IsDrawingAttention());
831
832 // Draw attention for an overflow-on-overflow panel.
833 // Expect the overflow indicator is showing attention.
834 // normal: P0, P1, P2, P5
835 // overflow: P3, P4, P6
836 // overflow-on-overflow: P7, *P8, P9, (P10, P11)
837 EXPECT_FALSE(panels[8]->IsDrawingAttention());
838 panels[8]->FlashFrame();
839 EXPECT_TRUE(panels[8]->IsDrawingAttention());
840 EXPECT_TRUE(overflow_indicator->IsDrawingAttention());
841
842 // Draw attention for anther overflow-on-overflow panel.
843 // Expect the overflow indicator is still showing attention.
844 // normal: P0, P1, P2, P5
845 // overflow: P3, P4, P6
846 // overflow-on-overflow: P7, *P8, P9, (*P10, P11)
847 EXPECT_FALSE(panels[10]->IsDrawingAttention());
848 panels[10]->FlashFrame();
849 EXPECT_TRUE(panels[10]->IsDrawingAttention());
850 EXPECT_TRUE(overflow_indicator->IsDrawingAttention());
851
852 // Stop drawing attention for an overflow-on-overflow panel by activating it.
853 // Expect the overflow indicator is still showing attention.
854 // normal: P0, P1, P2, P8
855 // overflow: P5, P3, P4
856 // overflow-on-overflow: P6, P7, P9, (*P10, P11)
857 panels[8]->Activate();
858 WaitForPanelActiveState(panels[8], SHOW_AS_ACTIVE);
859 EXPECT_FALSE(panels[8]->IsDrawingAttention());
860 EXPECT_TRUE(overflow_indicator->IsDrawingAttention());
861
862 // Stop drawing attention for anther overflow-on-overflow panel by activating
jennb 2011/12/19 22:24:50 anther
jianli 2011/12/20 01:20:41 Done.
863 // it. Expect the overflow indicator is not showing attention.
864 // normal: P0, P1, P2, P10
865 // overflow: P8, P5, P3
866 // overflow-on-overflow: P4, P6, P7, (P9, P11)
867 panels[10]->Activate();
868 WaitForPanelActiveState(panels[10], SHOW_AS_ACTIVE);
869 EXPECT_FALSE(panels[10]->IsDrawingAttention());
870 EXPECT_FALSE(overflow_indicator->IsDrawingAttention());
871
872 // Draw attention for the top overflow panel.
873 // Expect no impact to the overflow indicator.
874 // normal: P0, P1, P2, P10
875 // overflow: P8, P5, *P3
876 // overflow-on-overflow: P4, P6, P7, (P9, P11)
877 EXPECT_FALSE(panels[3]->IsDrawingAttention());
878 panels[3]->FlashFrame();
879 EXPECT_TRUE(panels[3]->IsDrawingAttention());
880 EXPECT_FALSE(overflow_indicator->IsDrawingAttention());
881
882 // Enlarge a normal panel that would bump one normal panel to the overflow
883 // area and the top overflow panel gets moved to overflow-on-overflow.
884 // Expect the overflow indicator is showing attention.
885 // normal: P0, P1, P2
886 // overflow: P10, P8, P5
887 // overflow-on-overflow: *P3, P4, P6, (P7, P9, P11)
888 panel_manager->OnPreferredWindowSizeChanged(panels[0], gfx::Size(260, 200));
889 EXPECT_EQ(3, panel_strip->num_panels());
890 EXPECT_EQ(9, overflow_strip->num_panels());
891 EXPECT_TRUE(panels[3]->IsDrawingAttention());
892 EXPECT_TRUE(overflow_indicator->IsDrawingAttention());
893
894 // Close an overflow panel that would move the first oveflow-on-overflow panel
895 // to become visible. Expect the overflow indicator is not showing attention.
896 // normal: P0, P1, P2
897 // overflow: P10, P5, P3
898 // overflow-on-overflow: P4, P6, P7, (P9, P11)
899 CloseWindowAndWait(panels[8]->browser());
900 EXPECT_EQ(3, panel_strip->num_panels());
901 EXPECT_EQ(8, overflow_strip->num_panels());
902 EXPECT_TRUE(panels[3]->IsDrawingAttention());
903 EXPECT_FALSE(overflow_indicator->IsDrawingAttention());
904
905 panel_manager->RemoveAll();
906 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698