| 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/detached_panel_strip.h" | 7 #include "chrome/browser/ui/panels/detached_panel_strip.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 | 11 |
| 12 class DetachedPanelBrowserTest : public BasePanelBrowserTest { | 12 class DetachedPanelBrowserTest : public BasePanelBrowserTest { |
| 13 }; | 13 }; |
| 14 | 14 |
| 15 IN_PROC_BROWSER_TEST_F(DetachedPanelBrowserTest, CheckDetachedPanelProperties) { | 15 IN_PROC_BROWSER_TEST_F(DetachedPanelBrowserTest, CheckDetachedPanelProperties) { |
| 16 PanelManager* panel_manager = PanelManager::GetInstance(); | 16 PanelManager* panel_manager = PanelManager::GetInstance(); |
| 17 DetachedPanelStrip* detached_strip = panel_manager->detached_strip(); | 17 DetachedPanelStrip* detached_strip = panel_manager->detached_strip(); |
| 18 | 18 |
| 19 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); | 19 // Create an initially detached panel (as opposed to other tests which create |
| 20 // a docked panel, then detaches it). |
| 21 gfx::Rect bounds(300, 200, 250, 200); |
| 22 CreatePanelParams params("1", bounds, SHOW_AS_ACTIVE); |
| 23 params.create_mode = PanelManager::CREATE_AS_DETACHED; |
| 24 Panel* panel = CreatePanelWithParams(params); |
| 20 scoped_ptr<NativePanelTesting> panel_testing( | 25 scoped_ptr<NativePanelTesting> panel_testing( |
| 21 CreateNativePanelTesting(panel)); | 26 CreateNativePanelTesting(panel)); |
| 22 | 27 |
| 23 EXPECT_EQ(1, panel_manager->num_panels()); | 28 EXPECT_EQ(1, panel_manager->num_panels()); |
| 24 EXPECT_TRUE(detached_strip->HasPanel(panel)); | 29 EXPECT_TRUE(detached_strip->HasPanel(panel)); |
| 25 | 30 |
| 31 EXPECT_EQ(bounds, panel->GetBounds()); |
| 26 EXPECT_FALSE(panel->always_on_top()); | 32 EXPECT_FALSE(panel->always_on_top()); |
| 27 | 33 |
| 28 EXPECT_TRUE(panel_testing->IsButtonVisible(panel::CLOSE_BUTTON)); | 34 EXPECT_TRUE(panel_testing->IsButtonVisible(panel::CLOSE_BUTTON)); |
| 29 EXPECT_FALSE(panel_testing->IsButtonVisible(panel::MINIMIZE_BUTTON)); | 35 EXPECT_FALSE(panel_testing->IsButtonVisible(panel::MINIMIZE_BUTTON)); |
| 30 EXPECT_FALSE(panel_testing->IsButtonVisible(panel::RESTORE_BUTTON)); | 36 EXPECT_FALSE(panel_testing->IsButtonVisible(panel::RESTORE_BUTTON)); |
| 31 | 37 |
| 32 EXPECT_EQ(panel::RESIZABLE_ALL_SIDES, panel->CanResizeByMouse()); | 38 EXPECT_EQ(panel::RESIZABLE_ALL_SIDES, panel->CanResizeByMouse()); |
| 33 | 39 |
| 34 Panel::AttentionMode expected_attention_mode = | 40 Panel::AttentionMode expected_attention_mode = |
| 35 static_cast<Panel::AttentionMode>(Panel::USE_PANEL_ATTENTION | | 41 static_cast<Panel::AttentionMode>(Panel::USE_PANEL_ATTENTION | |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE); | 148 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE); |
| 143 | 149 |
| 144 // Clicking on an inactive detached panel's titlebar activates it. | 150 // Clicking on an inactive detached panel's titlebar activates it. |
| 145 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); | 151 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); |
| 146 test_panel->ReleaseMouseButtonTitlebar(); | 152 test_panel->ReleaseMouseButtonTitlebar(); |
| 147 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE); | 153 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE); |
| 148 EXPECT_FALSE(panel->IsMinimized()); | 154 EXPECT_FALSE(panel->IsMinimized()); |
| 149 | 155 |
| 150 panel_manager->CloseAll(); | 156 panel_manager->CloseAll(); |
| 151 } | 157 } |
| OLD | NEW |