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

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

Issue 8341098: Mac: Added a delay before panels go to minimized state from title-only state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more feedback Created 9 years, 1 month 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 "base/i18n/time_formatting.h" 5 #include "base/i18n/time_formatting.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "chrome/browser/extensions/extension_service.h" 7 #include "chrome/browser/extensions/extension_service.h"
8 #include "chrome/browser/profiles/profile.h" 8 #include "chrome/browser/profiles/profile.h"
9 #include "chrome/browser/ui/browser_window.h" 9 #include "chrome/browser/ui/browser_window.h"
10 #include "chrome/browser/ui/panels/base_panel_browser_test.h" 10 #include "chrome/browser/ui/panels/base_panel_browser_test.h"
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Create 2 more panels for more testing. 234 // Create 2 more panels for more testing.
235 Panel* panel2 = CreatePanel("PanelTest2"); 235 Panel* panel2 = CreatePanel("PanelTest2");
236 Panel* panel3 = CreatePanel("PanelTest3"); 236 Panel* panel3 = CreatePanel("PanelTest3");
237 237
238 // Test bringing up or down the title-bar of all minimized panels. 238 // Test bringing up or down the title-bar of all minimized panels.
239 EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state()); 239 EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state());
240 panel3->SetExpansionState(Panel::MINIMIZED); 240 panel3->SetExpansionState(Panel::MINIMIZED);
241 EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state()); 241 EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state());
242 EXPECT_EQ(2, panel_manager->minimized_panel_count()); 242 EXPECT_EQ(2, panel_manager->minimized_panel_count());
243 243
244 mock_auto_hiding_desktop_bar()->SetVisibility( 244 {
245 AutoHidingDesktopBar::ALIGN_BOTTOM, AutoHidingDesktopBar::VISIBLE); 245 mock_auto_hiding_desktop_bar()->SetVisibility(
246 panel_manager->BringUpOrDownTitlebars(true); 246 AutoHidingDesktopBar::ALIGN_BOTTOM, AutoHidingDesktopBar::VISIBLE);
247 MessageLoopForUI::current()->RunAllPending();
248 EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state());
249 EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state());
250 EXPECT_EQ(Panel::TITLE_ONLY, panel3->expansion_state());
251 EXPECT_EQ(2, panel_manager->minimized_panel_count());
252 247
253 mock_auto_hiding_desktop_bar()->SetVisibility( 248 ui_test_utils::WindowedNotificationObserver signal(
254 AutoHidingDesktopBar::ALIGN_BOTTOM, AutoHidingDesktopBar::HIDDEN); 249 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE,
255 panel_manager->BringUpOrDownTitlebars(false); 250 content::Source<Panel>(panel1));
256 MessageLoopForUI::current()->RunAllPending(); 251 panel_manager->BringUpOrDownTitlebars(true);
257 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state()); 252 signal.Wait();
258 EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state()); 253
259 EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state()); 254 EXPECT_EQ(Panel::TITLE_ONLY, panel1->expansion_state());
260 EXPECT_EQ(2, panel_manager->minimized_panel_count()); 255 EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state());
256 EXPECT_EQ(Panel::TITLE_ONLY, panel3->expansion_state());
257 EXPECT_EQ(2, panel_manager->minimized_panel_count());
258 }
259
260 {
261 mock_auto_hiding_desktop_bar()->SetVisibility(
262 AutoHidingDesktopBar::ALIGN_BOTTOM, AutoHidingDesktopBar::HIDDEN);
263
264 ui_test_utils::WindowedNotificationObserver signal(
265 chrome::NOTIFICATION_PANEL_CHANGED_EXPANSION_STATE,
266 content::Source<Panel>(panel1));
267 panel_manager->BringUpOrDownTitlebars(false);
268 signal.Wait();
269
270 EXPECT_EQ(Panel::MINIMIZED, panel1->expansion_state());
271 EXPECT_EQ(Panel::EXPANDED, panel2->expansion_state());
272 EXPECT_EQ(Panel::MINIMIZED, panel3->expansion_state());
273 EXPECT_EQ(2, panel_manager->minimized_panel_count());
274 }
261 275
262 // Test if it is OK to bring up title-bar given the mouse position. 276 // Test if it is OK to bring up title-bar given the mouse position.
263 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebars( 277 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebars(
264 panel1->GetBounds().x(), panel1->GetBounds().y())); 278 panel1->GetBounds().x(), panel1->GetBounds().y()));
265 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebars( 279 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebars(
266 panel2->GetBounds().x(), panel2->GetBounds().y())); 280 panel2->GetBounds().x(), panel2->GetBounds().y()));
267 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebars( 281 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebars(
268 panel3->GetBounds().right() - 1, panel3->GetBounds().bottom() - 1)); 282 panel3->GetBounds().right() - 1, panel3->GetBounds().bottom() - 1));
269 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebars( 283 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebars(
270 panel3->GetBounds().right() - 1, panel3->GetBounds().bottom() + 10)); 284 panel3->GetBounds().right() - 1, panel3->GetBounds().bottom() + 10));
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
579 593
580 // TODO(jianli): Investigate why this fails on win trunk build. 594 // TODO(jianli): Investigate why this fails on win trunk build.
581 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DISABLED_DrawAttention) { 595 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DISABLED_DrawAttention) {
582 TestDrawAttention(); 596 TestDrawAttention();
583 } 597 }
584 598
585 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ChangeAutoHideTaskBarThickness) { 599 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ChangeAutoHideTaskBarThickness) {
586 TestChangeAutoHideTaskBarThickness(); 600 TestChangeAutoHideTaskBarThickness();
587 } 601 }
588 #endif 602 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698