| OLD | NEW |
| 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 "base/message_loop.h" | 5 #include "base/message_loop.h" |
| 6 #include "chrome/browser/ui/panels/base_panel_browser_test.h" | 6 #include "chrome/browser/ui/panels/base_panel_browser_test.h" |
| 7 #include "chrome/browser/ui/panels/docked_panel_strip.h" | 7 #include "chrome/browser/ui/panels/docked_panel_strip.h" |
| 8 #include "chrome/browser/ui/panels/panel.h" | 8 #include "chrome/browser/ui/panels/panel.h" |
| 9 #include "chrome/browser/ui/panels/panel_manager.h" | 9 #include "chrome/browser/ui/panels/panel_manager.h" |
| 10 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" | 10 #include "chrome/browser/ui/panels/test_panel_mouse_watcher.h" |
| 11 #include "chrome/common/chrome_notification_types.h" | 11 #include "chrome/common/chrome_notification_types.h" |
| 12 #include "chrome/test/base/ui_test_utils.h" | |
| 13 #include "content/public/browser/notification_service.h" | 12 #include "content/public/browser/notification_service.h" |
| 13 #include "content/public/test/test_utils.h" |
| 14 | 14 |
| 15 // Refactor has only been done for Win and Mac panels so far. | 15 // Refactor has only been done for Win and Mac panels so far. |
| 16 #if defined(OS_WIN) || defined(OS_MACOSX) | 16 #if defined(OS_WIN) || defined(OS_MACOSX) |
| 17 | 17 |
| 18 class DockedPanelBrowserTest : public BasePanelBrowserTest { | 18 class DockedPanelBrowserTest : public BasePanelBrowserTest { |
| 19 public: | 19 public: |
| 20 virtual void SetUpOnMainThread() OVERRIDE { | 20 virtual void SetUpOnMainThread() OVERRIDE { |
| 21 BasePanelBrowserTest::SetUpOnMainThread(); | 21 BasePanelBrowserTest::SetUpOnMainThread(); |
| 22 | 22 |
| 23 // All the tests here assume using mocked 800x600 screen area for the | 23 // All the tests here assume using mocked 800x600 screen area for the |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 int width_of_panel3_squeezed = panel3->GetBounds().width(); | 176 int width_of_panel3_squeezed = panel3->GetBounds().width(); |
| 177 panel3->Minimize(); | 177 panel3->Minimize(); |
| 178 | 178 |
| 179 // Wait for any possible events. | 179 // Wait for any possible events. |
| 180 MessageLoopForUI::current()->RunAllPending(); | 180 MessageLoopForUI::current()->RunAllPending(); |
| 181 | 181 |
| 182 // Check that this panel is still at the same width. | 182 // Check that this panel is still at the same width. |
| 183 EXPECT_EQ(width_of_panel3_squeezed, panel3->GetBounds().width()); | 183 EXPECT_EQ(width_of_panel3_squeezed, panel3->GetBounds().width()); |
| 184 | 184 |
| 185 // Minimize the active panel. It should become inactive and shrink in width. | 185 // Minimize the active panel. It should become inactive and shrink in width. |
| 186 ui_test_utils::WindowedNotificationObserver signal( | 186 content::WindowedNotificationObserver signal( |
| 187 chrome::NOTIFICATION_PANEL_STRIP_UPDATED, | 187 chrome::NOTIFICATION_PANEL_STRIP_UPDATED, |
| 188 content::NotificationService::AllSources()); | 188 content::NotificationService::AllSources()); |
| 189 panel7->Minimize(); | 189 panel7->Minimize(); |
| 190 | 190 |
| 191 // Wait for active states to settle. | 191 // Wait for active states to settle. |
| 192 WaitForPanelActiveState(panel7, SHOW_AS_INACTIVE); | 192 WaitForPanelActiveState(panel7, SHOW_AS_INACTIVE); |
| 193 | 193 |
| 194 // Wait for the scheduled layout to run. | 194 // Wait for the scheduled layout to run. |
| 195 signal.Wait(); | 195 signal.Wait(); |
| 196 | 196 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 | 264 |
| 265 // We should not have squeezing any more; all panels should be at full width. | 265 // We should not have squeezing any more; all panels should be at full width. |
| 266 EXPECT_EQ(panel1->GetBounds().width(), panel1->GetRestoredBounds().width()); | 266 EXPECT_EQ(panel1->GetBounds().width(), panel1->GetRestoredBounds().width()); |
| 267 EXPECT_EQ(panel4->GetBounds().width(), panel4->GetRestoredBounds().width()); | 267 EXPECT_EQ(panel4->GetBounds().width(), panel4->GetRestoredBounds().width()); |
| 268 EXPECT_EQ(panel6->GetBounds().width(), panel6->GetRestoredBounds().width()); | 268 EXPECT_EQ(panel6->GetBounds().width(), panel6->GetRestoredBounds().width()); |
| 269 | 269 |
| 270 panel_manager->CloseAll(); | 270 panel_manager->CloseAll(); |
| 271 } | 271 } |
| 272 | 272 |
| 273 #endif // OS_WIN || OS_MACOSX | 273 #endif // OS_WIN || OS_MACOSX |
| OLD | NEW |