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/old_base_panel_browser_test.h" | 6 #include "chrome/browser/ui/panels/old_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 // Panel tests are flaking on linux CQ. http://crbug.com/135377 | |
13 #if !defined(OS_LINUX) | |
14 | |
15 class OldDetachedPanelBrowserTest : public OldBasePanelBrowserTest { | 12 class OldDetachedPanelBrowserTest : public OldBasePanelBrowserTest { |
16 }; | 13 }; |
17 | 14 |
18 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, | 15 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, |
19 CheckDetachedPanelProperties) { | 16 CheckDetachedPanelProperties) { |
20 PanelManager* panel_manager = PanelManager::GetInstance(); | 17 PanelManager* panel_manager = PanelManager::GetInstance(); |
21 DetachedPanelStrip* detached_strip = panel_manager->detached_strip(); | 18 DetachedPanelStrip* detached_strip = panel_manager->detached_strip(); |
22 | 19 |
23 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); | 20 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); |
24 scoped_ptr<NativePanelTesting> panel_testing( | 21 scoped_ptr<NativePanelTesting> panel_testing( |
(...skipping 29 matching lines...) Expand all Loading... |
54 EXPECT_TRUE(panel->IsActive()); | 51 EXPECT_TRUE(panel->IsActive()); |
55 EXPECT_FALSE(panel->IsDrawingAttention()); | 52 EXPECT_FALSE(panel->IsDrawingAttention()); |
56 panel->FlashFrame(true); | 53 panel->FlashFrame(true); |
57 EXPECT_FALSE(panel->IsDrawingAttention()); | 54 EXPECT_FALSE(panel->IsDrawingAttention()); |
58 MessageLoop::current()->RunAllPending(); | 55 MessageLoop::current()->RunAllPending(); |
59 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention()); | 56 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention()); |
60 | 57 |
61 panel->Close(); | 58 panel->Close(); |
62 } | 59 } |
63 | 60 |
64 // http://crbug.com/135377 | |
65 #if defined(OS_LINUX) | |
66 #define MAYBE_DrawAttentionOnInactive DISABLED_DrawAttentionOnInactive | |
67 #else | |
68 #define MAYBE_DrawAttentionOnInactive DrawAttentionOnInactive | |
69 #endif | |
70 | |
71 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, | 61 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, |
72 MAYBE_DrawAttentionOnInactive) { | 62 DrawAttentionOnInactive) { |
73 // Create an inactive detached panel. | 63 // Create an inactive detached panel. |
74 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); | 64 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); |
75 panel->Deactivate(); | 65 panel->Deactivate(); |
76 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE); | 66 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE); |
77 | 67 |
78 scoped_ptr<NativePanelTesting> native_panel_testing( | 68 scoped_ptr<NativePanelTesting> native_panel_testing( |
79 CreateNativePanelTesting(panel)); | 69 CreateNativePanelTesting(panel)); |
80 | 70 |
81 // Test that the attention is drawn when the detached panel is not in focus. | 71 // Test that the attention is drawn when the detached panel is not in focus. |
82 EXPECT_FALSE(panel->IsActive()); | 72 EXPECT_FALSE(panel->IsActive()); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // Test that the attention is cleared when panel gets focus. | 111 // Test that the attention is cleared when panel gets focus. |
122 panel1->Activate(); | 112 panel1->Activate(); |
123 WaitForPanelActiveState(panel1, SHOW_AS_ACTIVE); | 113 WaitForPanelActiveState(panel1, SHOW_AS_ACTIVE); |
124 EXPECT_FALSE(panel1->IsDrawingAttention()); | 114 EXPECT_FALSE(panel1->IsDrawingAttention()); |
125 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention()); | 115 EXPECT_FALSE(native_panel_testing->VerifyDrawingAttention()); |
126 | 116 |
127 panel1->Close(); | 117 panel1->Close(); |
128 panel2->Close(); | 118 panel2->Close(); |
129 } | 119 } |
130 | 120 |
131 // http://crbug.com/135377 | 121 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, ClickTitlebar) { |
132 #if defined(OS_LINUX) | |
133 #define MAYBE_ClickTitlebar DISABLED_ClickTitlebar | |
134 #else | |
135 #define MAYBE_ClickTitlebar ClickTitlebar | |
136 #endif | |
137 | |
138 IN_PROC_BROWSER_TEST_F(OldDetachedPanelBrowserTest, MAYBE_ClickTitlebar) { | |
139 PanelManager* panel_manager = PanelManager::GetInstance(); | 122 PanelManager* panel_manager = PanelManager::GetInstance(); |
140 | 123 |
141 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); | 124 Panel* panel = CreateDetachedPanel("1", gfx::Rect(300, 200, 250, 200)); |
142 EXPECT_TRUE(panel->IsActive()); | 125 EXPECT_TRUE(panel->IsActive()); |
143 EXPECT_FALSE(panel->IsMinimized()); | 126 EXPECT_FALSE(panel->IsMinimized()); |
144 | 127 |
145 // Clicking on an active detached panel's titlebar has no effect, regardless | 128 // Clicking on an active detached panel's titlebar has no effect, regardless |
146 // of modifier. | 129 // of modifier. |
147 scoped_ptr<NativePanelTesting> test_panel( | 130 scoped_ptr<NativePanelTesting> test_panel( |
148 CreateNativePanelTesting(panel)); | 131 CreateNativePanelTesting(panel)); |
149 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); | 132 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); |
150 test_panel->ReleaseMouseButtonTitlebar(); | 133 test_panel->ReleaseMouseButtonTitlebar(); |
151 EXPECT_TRUE(panel->IsActive()); | 134 EXPECT_TRUE(panel->IsActive()); |
152 EXPECT_FALSE(panel->IsMinimized()); | 135 EXPECT_FALSE(panel->IsMinimized()); |
153 | 136 |
154 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin(), | 137 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin(), |
155 panel::APPLY_TO_ALL); | 138 panel::APPLY_TO_ALL); |
156 test_panel->ReleaseMouseButtonTitlebar(panel::APPLY_TO_ALL); | 139 test_panel->ReleaseMouseButtonTitlebar(panel::APPLY_TO_ALL); |
157 EXPECT_TRUE(panel->IsActive()); | 140 EXPECT_TRUE(panel->IsActive()); |
158 EXPECT_FALSE(panel->IsMinimized()); | 141 EXPECT_FALSE(panel->IsMinimized()); |
159 | 142 |
160 // Create a second panel to cause the first to become inactive. | 143 // Create a second panel to cause the first to become inactive. |
161 CreateDetachedPanel("2", gfx::Rect(100, 200, 230, 345)); | 144 CreateDetachedPanel("2", gfx::Rect(100, 200, 230, 345)); |
162 EXPECT_FALSE(panel->IsActive()); | 145 WaitForPanelActiveState(panel, SHOW_AS_INACTIVE); |
163 | 146 |
164 // Clicking on an inactive detached panel's titlebar activates it. | 147 // Clicking on an inactive detached panel's titlebar activates it. |
165 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); | 148 test_panel->PressLeftMouseButtonTitlebar(panel->GetBounds().origin()); |
166 test_panel->ReleaseMouseButtonTitlebar(); | 149 test_panel->ReleaseMouseButtonTitlebar(); |
167 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE); | 150 WaitForPanelActiveState(panel, SHOW_AS_ACTIVE); |
168 EXPECT_FALSE(panel->IsMinimized()); | 151 EXPECT_FALSE(panel->IsMinimized()); |
169 | 152 |
170 panel_manager->CloseAll(); | 153 panel_manager->CloseAll(); |
171 } | 154 } |
172 | |
173 #endif // !OS_LINUX | |
OLD | NEW |