Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 155 | 155 |
| 156 void WaitTillSettingsAnimationFinished(Panel* panel) { | 156 void WaitTillSettingsAnimationFinished(Panel* panel) { |
| 157 // The timer for the animation will only kick in as async task. | 157 // The timer for the animation will only kick in as async task. |
| 158 while (GetSettingsButtonAnimator(panel)->is_animating()) { | 158 while (GetSettingsButtonAnimator(panel)->is_animating()) { |
| 159 MessageLoopForUI::current()->PostTask(FROM_HERE, | 159 MessageLoopForUI::current()->PostTask(FROM_HERE, |
| 160 new MessageLoop::QuitTask()); | 160 new MessageLoop::QuitTask()); |
| 161 MessageLoopForUI::current()->RunAllPending(); | 161 MessageLoopForUI::current()->RunAllPending(); |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 void ClosePanelAndWaitForNotification(Panel* panel) { | |
| 166 ui_test_utils::WindowedNotificationObserver signal( | |
| 167 chrome::NOTIFICATION_PANEL_DELETED, | |
|
jennb
2011/11/11 21:33:16
Should use BROWSER_CLOSED notification here to ver
prasadt
2011/11/11 22:02:44
Done.
| |
| 168 content::Source<Panel>(panel)); | |
| 169 panel->Close(); | |
| 170 signal.Wait(); | |
| 171 } | |
| 172 | |
| 165 // We put all the testing logic in this class instead of the test so that | 173 // We put all the testing logic in this class instead of the test so that |
| 166 // we do not need to declare each new test as a friend of PanelBrowserView | 174 // we do not need to declare each new test as a friend of PanelBrowserView |
| 167 // for the purpose of accessing its private members. | 175 // for the purpose of accessing its private members. |
| 168 void TestMinimizeAndRestore(bool enable_auto_hiding) { | 176 void TestMinimizeAndRestore(bool enable_auto_hiding) { |
| 169 PanelManager* panel_manager = PanelManager::GetInstance(); | 177 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 170 int expected_bottom_on_minimized = testing_work_area().height(); | 178 int expected_bottom_on_minimized = testing_work_area().height(); |
| 171 int expected_bottom_on_unminimized = expected_bottom_on_minimized; | 179 int expected_bottom_on_unminimized = expected_bottom_on_minimized; |
| 172 | 180 |
| 173 // Turn on auto-hiding if requested. | 181 // Turn on auto-hiding if requested. |
| 174 static const int bottom_thickness = 40; | 182 static const int bottom_thickness = 40; |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 284 EXPECT_EQ(2, panel_manager->minimized_panel_count()); | 292 EXPECT_EQ(2, panel_manager->minimized_panel_count()); |
| 285 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebars( | 293 EXPECT_FALSE(panel_manager->ShouldBringUpTitlebars( |
| 286 0, 0)); | 294 0, 0)); |
| 287 browser_view1->OnTitlebarMousePressed(panel1->GetBounds().origin()); | 295 browser_view1->OnTitlebarMousePressed(panel1->GetBounds().origin()); |
| 288 browser_view1->OnTitlebarMouseDragged( | 296 browser_view1->OnTitlebarMouseDragged( |
| 289 panel1->GetBounds().origin().Subtract(gfx::Point(5, 5))); | 297 panel1->GetBounds().origin().Subtract(gfx::Point(5, 5))); |
| 290 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebars( | 298 EXPECT_TRUE(panel_manager->ShouldBringUpTitlebars( |
| 291 0, 0)); | 299 0, 0)); |
| 292 browser_view1->OnTitlebarMouseReleased(); | 300 browser_view1->OnTitlebarMouseReleased(); |
| 293 | 301 |
| 294 panel1->Close(); | 302 ClosePanelAndWaitForNotification(panel1); |
| 295 panel2->Close(); | 303 ClosePanelAndWaitForNotification(panel2); |
| 296 panel3->Close(); | 304 ClosePanelAndWaitForNotification(panel3); |
| 297 EXPECT_EQ(0, panel_manager->minimized_panel_count()); | 305 EXPECT_EQ(0, panel_manager->minimized_panel_count()); |
| 298 } | 306 } |
| 299 | 307 |
| 300 void TestDrawAttention() { | 308 void TestDrawAttention() { |
| 301 Panel* panel = CreatePanel("PanelTest"); | 309 Panel* panel = CreatePanel("PanelTest"); |
| 302 PanelBrowserView* browser_view = GetBrowserView(panel); | 310 PanelBrowserView* browser_view = GetBrowserView(panel); |
| 303 PanelBrowserFrameView* frame_view = browser_view->GetFrameView(); | 311 PanelBrowserFrameView* frame_view = browser_view->GetFrameView(); |
| 304 frame_view->title_label_->SetAutoColorReadabilityEnabled(false); | 312 frame_view->title_label_->SetAutoColorReadabilityEnabled(false); |
| 305 SkColor attention_color = frame_view->GetTitleColor( | 313 SkColor attention_color = frame_view->GetTitleColor( |
| 306 PanelBrowserFrameView::PAINT_FOR_ATTENTION); | 314 PanelBrowserFrameView::PAINT_FOR_ATTENTION); |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 606 // TODO(jianli): Investigate why this fails on win trunk build. | 614 // TODO(jianli): Investigate why this fails on win trunk build. |
| 607 // http://crbug.com/102734 | 615 // http://crbug.com/102734 |
| 608 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DISABLED_DrawAttention) { | 616 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, DISABLED_DrawAttention) { |
| 609 TestDrawAttention(); | 617 TestDrawAttention(); |
| 610 } | 618 } |
| 611 | 619 |
| 612 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ChangeAutoHideTaskBarThickness) { | 620 IN_PROC_BROWSER_TEST_F(PanelBrowserViewTest, ChangeAutoHideTaskBarThickness) { |
| 613 TestChangeAutoHideTaskBarThickness(); | 621 TestChangeAutoHideTaskBarThickness(); |
| 614 } | 622 } |
| 615 #endif | 623 #endif |
| OLD | NEW |