| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/prefs/pref_service.h" | 6 #include "base/prefs/pref_service.h" |
| 7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
| 8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/devtools/devtools_window.h" | 10 #include "chrome/browser/devtools/devtools_window.h" |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 356 class WaitForStableInitialSize : public TestPanelNotificationObserver { | 356 class WaitForStableInitialSize : public TestPanelNotificationObserver { |
| 357 public: | 357 public: |
| 358 explicit WaitForStableInitialSize(Panel* panel) | 358 explicit WaitForStableInitialSize(Panel* panel) |
| 359 : TestPanelNotificationObserver( | 359 : TestPanelNotificationObserver( |
| 360 chrome::NOTIFICATION_PANEL_COLLECTION_UPDATED, | 360 chrome::NOTIFICATION_PANEL_COLLECTION_UPDATED, |
| 361 content::NotificationService::AllSources()), | 361 content::NotificationService::AllSources()), |
| 362 panel_(panel) {} | 362 panel_(panel) {} |
| 363 virtual ~WaitForStableInitialSize() {} | 363 virtual ~WaitForStableInitialSize() {} |
| 364 | 364 |
| 365 protected: | 365 protected: |
| 366 virtual bool AtExpectedState() OVERRIDE { | 366 virtual bool AtExpectedState() override { |
| 367 return panel_->GetBounds().height() > panel_->TitleOnlyHeight(); | 367 return panel_->GetBounds().height() > panel_->TitleOnlyHeight(); |
| 368 } | 368 } |
| 369 Panel* panel_; | 369 Panel* panel_; |
| 370 }; | 370 }; |
| 371 | 371 |
| 372 class WaitForAutoResizeWider : public TestPanelNotificationObserver { | 372 class WaitForAutoResizeWider : public TestPanelNotificationObserver { |
| 373 public: | 373 public: |
| 374 explicit WaitForAutoResizeWider(Panel* panel) | 374 explicit WaitForAutoResizeWider(Panel* panel) |
| 375 : TestPanelNotificationObserver( | 375 : TestPanelNotificationObserver( |
| 376 chrome::NOTIFICATION_PANEL_COLLECTION_UPDATED, | 376 chrome::NOTIFICATION_PANEL_COLLECTION_UPDATED, |
| 377 content::NotificationService::AllSources()), | 377 content::NotificationService::AllSources()), |
| 378 panel_(panel), | 378 panel_(panel), |
| 379 initial_size_(panel->GetBounds().size()) {} | 379 initial_size_(panel->GetBounds().size()) {} |
| 380 virtual ~WaitForAutoResizeWider() {} | 380 virtual ~WaitForAutoResizeWider() {} |
| 381 | 381 |
| 382 protected: | 382 protected: |
| 383 virtual bool AtExpectedState() OVERRIDE { | 383 virtual bool AtExpectedState() override { |
| 384 return panel_->GetBounds().width() > initial_size_.width(); | 384 return panel_->GetBounds().width() > initial_size_.width(); |
| 385 } | 385 } |
| 386 Panel* panel_; | 386 Panel* panel_; |
| 387 gfx::Size initial_size_; | 387 gfx::Size initial_size_; |
| 388 }; | 388 }; |
| 389 | 389 |
| 390 class WaitForAutoResizeNarrower : public TestPanelNotificationObserver { | 390 class WaitForAutoResizeNarrower : public TestPanelNotificationObserver { |
| 391 public: | 391 public: |
| 392 explicit WaitForAutoResizeNarrower(Panel* panel) | 392 explicit WaitForAutoResizeNarrower(Panel* panel) |
| 393 : TestPanelNotificationObserver( | 393 : TestPanelNotificationObserver( |
| 394 chrome::NOTIFICATION_PANEL_COLLECTION_UPDATED, | 394 chrome::NOTIFICATION_PANEL_COLLECTION_UPDATED, |
| 395 content::NotificationService::AllSources()), | 395 content::NotificationService::AllSources()), |
| 396 panel_(panel), | 396 panel_(panel), |
| 397 initial_size_(panel->GetBounds().size()) {} | 397 initial_size_(panel->GetBounds().size()) {} |
| 398 virtual ~WaitForAutoResizeNarrower() {} | 398 virtual ~WaitForAutoResizeNarrower() {} |
| 399 | 399 |
| 400 protected: | 400 protected: |
| 401 virtual bool AtExpectedState() OVERRIDE { | 401 virtual bool AtExpectedState() override { |
| 402 return panel_->GetBounds().width() < initial_size_.width(); | 402 return panel_->GetBounds().width() < initial_size_.width(); |
| 403 } | 403 } |
| 404 Panel* panel_; | 404 Panel* panel_; |
| 405 gfx::Size initial_size_; | 405 gfx::Size initial_size_; |
| 406 }; | 406 }; |
| 407 | 407 |
| 408 // crbug.com/160504 | 408 // crbug.com/160504 |
| 409 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DISABLED_AutoResize) { | 409 IN_PROC_BROWSER_TEST_F(PanelBrowserTest, DISABLED_AutoResize) { |
| 410 PanelManager* panel_manager = PanelManager::GetInstance(); | 410 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 411 panel_manager->enable_auto_sizing(true); | 411 panel_manager->enable_auto_sizing(true); |
| (...skipping 1340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1752 | 1752 |
| 1753 // Panel should become visible when leaving full-screen mode. | 1753 // Panel should become visible when leaving full-screen mode. |
| 1754 mock_display_settings_provider()->EnableFullScreenMode(false); | 1754 mock_display_settings_provider()->EnableFullScreenMode(false); |
| 1755 EXPECT_TRUE(panel_testing->IsWindowVisible()); | 1755 EXPECT_TRUE(panel_testing->IsWindowVisible()); |
| 1756 | 1756 |
| 1757 PanelManager::GetInstance()->CloseAll(); | 1757 PanelManager::GetInstance()->CloseAll(); |
| 1758 } | 1758 } |
| 1759 | 1759 |
| 1760 class PanelExtensionApiTest : public ExtensionApiTest { | 1760 class PanelExtensionApiTest : public ExtensionApiTest { |
| 1761 protected: | 1761 protected: |
| 1762 virtual void SetUpCommandLine(CommandLine* command_line) OVERRIDE { | 1762 virtual void SetUpCommandLine(CommandLine* command_line) override { |
| 1763 ExtensionApiTest::SetUpCommandLine(command_line); | 1763 ExtensionApiTest::SetUpCommandLine(command_line); |
| 1764 command_line->AppendSwitch(switches::kEnablePanels); | 1764 command_line->AppendSwitch(switches::kEnablePanels); |
| 1765 } | 1765 } |
| 1766 }; | 1766 }; |
| 1767 | 1767 |
| 1768 #if defined(OS_LINUX) || (!defined(OS_WIN) && defined(USE_AURA)) || \ | 1768 #if defined(OS_LINUX) || (!defined(OS_WIN) && defined(USE_AURA)) || \ |
| 1769 defined(OS_MACOSX) | 1769 defined(OS_MACOSX) |
| 1770 // Focus test fails if there is no window manager on Linux. | 1770 // Focus test fails if there is no window manager on Linux. |
| 1771 // Aura panels have different behavior that do not apply to this test. | 1771 // Aura panels have different behavior that do not apply to this test. |
| 1772 #define MAYBE_FocusChangeEventOnMinimize DISABLED_FocusChangeEventOnMinimize | 1772 #define MAYBE_FocusChangeEventOnMinimize DISABLED_FocusChangeEventOnMinimize |
| 1773 #else | 1773 #else |
| 1774 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize | 1774 #define MAYBE_FocusChangeEventOnMinimize FocusChangeEventOnMinimize |
| 1775 #endif | 1775 #endif |
| 1776 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest, | 1776 IN_PROC_BROWSER_TEST_F(PanelExtensionApiTest, |
| 1777 MAYBE_FocusChangeEventOnMinimize) { | 1777 MAYBE_FocusChangeEventOnMinimize) { |
| 1778 // This is needed so the subsequently created panels can be activated. | 1778 // This is needed so the subsequently created panels can be activated. |
| 1779 // On a Mac, it transforms background-only test process into foreground one. | 1779 // On a Mac, it transforms background-only test process into foreground one. |
| 1780 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 1780 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 1781 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_; | 1781 ASSERT_TRUE(RunExtensionTest("panels/focus_change_on_minimize")) << message_; |
| 1782 } | 1782 } |
| OLD | NEW |